Class FeatureLibrary

java.lang.Object
com.geodesk.feature.FeatureLibrary
All Implemented Interfaces:
Features, AutoCloseable, Iterable<Feature>

public class FeatureLibrary extends Object implements AutoCloseable
A Geographic Object Library containing features.
  • Constructor Details

    • FeatureLibrary

      public FeatureLibrary(String path)
      Creates a FeatureLibrary instance associated with an existing GOL file.
      Parameters:
      path - the path of the GOL file.
    • FeatureLibrary

      public FeatureLibrary(Path path)
      Creates a FeatureLibrary instance associated with an existing GOL file.
      Parameters:
      path - the path of the GOL file.
    • FeatureLibrary

      public FeatureLibrary(String path, String url)
      Creates a FeatureLibrary instance associated with the given GOL file; if the file does not exist, an empty library will be created.
      Parameters:
      path - the path of the GOL file
      url - the URL from which missing tiles are downloaded into the library
    • FeatureLibrary

      public FeatureLibrary(Path path, String url)
      Creates a FeatureLibrary instance associated with the given GOL file; if the file does not exist, an empty library will be created.
      Parameters:
      path - the path of the GOL file
      url - the URL from which missing tiles are downloaded into the library
  • Method Details

    • geometryFactory

      public GeometryFactory geometryFactory()
    • close

      public void close()

      Closes the library and releases its resources.

      Important: Do not call the methods of any collections or features you have retrieved from this library after you've closed it. Doing so leads to undefined results and may cause a segmentation fault.

      Specified by:
      close in interface AutoCloseable
    • in

      public Features in(Bounds bbox)
      Description copied from interface: Features
      Returns a view of this collection that contains only features whose bounding box intersects the given Bounds.
      Parameters:
      bbox - the bounding box to use as a filter
      Returns:
      a collection of Feature objects
    • contains

      public boolean contains(Object obj)
      Description copied from interface: Features
      Checks whether this collection contains the given object.
      Parameters:
      obj - the object whose presence in this collection is to be tested
      Returns:
      true if this collection contains the specified object
    • select

      public Features select(Filter filter)
      Specified by:
      select in interface Features
    • iterator

      public Iterator<Feature> iterator()
    • types

      public int types()
    • select

      public Features select(String query)
      Description copied from interface: Features
      Returns a view of this collection that only contains features matching the given query.
      Specified by:
      select in interface Features
      Parameters:
      query - a query in GOQL format
      Returns:
      a feature collection
    • nodes

      public Features nodes()
      Description copied from interface: Features
      Returns a view of this collection that contains only nodes.
      Specified by:
      nodes in interface Features
      Returns:
      a collection of Node objects
    • nodes

      public Features nodes(String query)
      Description copied from interface: Features
      Returns a view of this collection that contains only nodes matching the given query.
      Specified by:
      nodes in interface Features
      Parameters:
      query - a query in GOQL format
      Returns:
      a collection of Node objects
    • ways

      public Features ways()
      Description copied from interface: Features
      Returns a view of this collection that contains only ways.
      Specified by:
      ways in interface Features
      Returns:
      a collection of Way objects
    • ways

      public Features ways(String query)
      Description copied from interface: Features
      Returns a view of this collection that contains only ways matching the given query.
      Specified by:
      ways in interface Features
      Parameters:
      query - a query in GOQL format
      Returns:
      a collection of Way objects
    • relations

      public Features relations()
      Description copied from interface: Features
      Returns a view of this collection that contains only relations.
      Specified by:
      relations in interface Features
      Returns:
      a collection of Relation objects
    • relations

      public Features relations(String query)
      Description copied from interface: Features
      Returns a view of this collection that contains only relations matching the given query.
      Specified by:
      relations in interface Features
      Parameters:
      query - a query in GOQL format
      Returns:
      a collection of Relation objects
    • parentsOf

      public Features parentsOf(Feature child)
      Description copied from interface: Features
      Returns the features that are parent elements of the given feature (ways and/or relations).
      Specified by:
      parentsOf in interface Features
      Parameters:
      child - a way or relation
      Returns:
      a collection of features
    • membersOf

      public Features membersOf(Feature parent)
      Description copied from interface: Features
      Returns the features that are nodes of the given way, or members of the given relation. If a node is passed as parent, an empty view is returned (as nodes cannot have child elements).
      Specified by:
      membersOf in interface Features
      Parameters:
      parent - a way or relation
      Returns:
      a collection of features
    • nodesOf

      public Features nodesOf(Feature parent)
      Description copied from interface: Features
      Returns a sub-view that contains only the features that are nodes of the given way.
      Specified by:
      nodesOf in interface Features
      Parameters:
      parent - a way or relation
      Returns:
      a collection of features
    • select

      public Features select(Features otherFeatures)
      Description copied from interface: Features
      Returns the features present in both this collection and other.
      Specified by:
      select in interface Features
      Parameters:
      otherFeatures -
      Returns: