com.ibm.geolib

Interface SpatialService

  • All Known Implementing Classes:
    GeoSpatialService, SpatioTemporalService


    public interface SpatialService

    Location service API

    LocationService provides both methods for creating objects that represent location of various shape (e.g. point, line, polygon), and computational functions on these objects.

    The coordinate system used to refer geographic locations is EPSG:4326 (longitude, latitude, WGS84). See http://spatialreference.org/ref/epsg/4326/ for more details.

    • Method Detail

      • getDistance

        double getDistance(Spatial from,
                         Spatial to,
                         LengthUnit units)
        Compute distance between two spatial objects.
        Parameters:
        from - source object
        to - target object
        units - specifies unit for measuring distance.
        Returns:
        distance between the given objects measured in the specified length units.
      • contains

        boolean contains(Spatial container,
                       Spatial contained)
        Check if the given spatial object contains another spatial object
        Parameters:
        container -
        contained -
        Returns:
        true - if the contained object is inside the container object, otherwise - false
      • getNearestNeighbor

        <T extends Spatial> T getNearestNeighbor(Spatial source,
                                               java.util.Collection<T> all)
        Find the nearest neighbor of the given spatial object among a specified collection of spatial objects
        Parameters:
        source - object for which the nearest neighbor to be found
        all - - a collection of spatial objects to look for the nearest neighbor
        Returns:
        a spatial object nearest to the source
      • getWithinDistance

        <T extends Spatial> java.util.List<T> getWithinDistance(Spatial source,
                                                              java.util.Collection<T> all,
                                                              double maxDistance,
                                                              LengthUnit units)
        Find objects located within the specified distance from the source object
        Parameters:
        source -
        all - a collection of spatial objects to filter based on the proximity to the source
        maxDistance - - maximal distance at which returned object must be to the source
        units - - distance units
        Returns:
        a list of objects from the 'all' collections that are within 'maxDistance' proximity to the source, calculated in 'units' of length
      • contains

        boolean contains(java.util.Collection<? extends Spatial> containers,
                       Spatial contained)
        Check if any of the spatial objects in the collection contains the specified object.
        Parameters:
        containers -
        contained -
        Returns:
        true of any of the 'containers' objects contains the 'contained' one, otherwise - false
      • sortByProximity

        <T extends Spatial> java.util.List<T> sortByProximity(Spatial source,
                                                            java.util.Collection<T> all)
        Sort a collection of spatial objects based on their proximity to the given source object
        Parameters:
        source - object that should be used to measure distance to from any object of collection
        all - spatial objects to sort
        Returns:
        an ordered list of spatial objects sorted by their distance to the 'source', in ascending order.
      • getContained

        <T extends Spatial> java.util.Collection<T> getContained(Spatial container,
                                                               java.util.Collection<T> all)
        Find objects contained in the specified spatial object.
        Parameters:
        container - the containing object
        all - possible contained objects.
        Returns:
        A collection of spatial objects from 'all' that are contained in the 'container' object.
      • getContainers

        <T extends Spatial> java.util.Collection<T> getContainers(Spatial contained,
                                                                java.util.Collection<T> all)
        Find objects containing the specified spatial object.
        Parameters:
        contained - a spatial object which containers should be looked up
        all - possible containing objects
        Returns:
        A collection of spatial objects from 'all' that contain the 'contained' object.
      • intersects

        boolean intersects(Spatial object1,
                         Spatial object2)
        Check if two spatial objects intersect
        Parameters:
        object1 -
        object2 -
        Returns:
        true - if object1 intersects with object2, otherwise - false
      • getGeometryFactory

        GeometryFactory getGeometryFactory()
        Get a geometry factory that is used to create new geometries
        Returns:
        a geometry factory
      • getCoordinateReferenceSystemFactory

        CoordinateReferenceSystemFactory getCoordinateReferenceSystemFactory()
        Get a coordinate reference system factory that is used to get defined coordinate reference system or to create a new one
        Returns:
        a coordinate reference system factory

© Copyright IBM 2017