Class PlanitGeoUtils


  • public class PlanitGeoUtils
    extends Object
    General geotools related utils
    Author:
    markr
    • Constructor Summary

      Constructors 
      Constructor Description
      PlanitGeoUtils()
      Constructor Uses default coordinate reference system
      PlanitGeoUtils​(org.opengis.referencing.crs.CoordinateReferenceSystem coordinateReferenceSystem)
      Constructor
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      List<org.opengis.geometry.coordinate.Position> convertToDirectPositions​(com.vividsolutions.jts.geom.Coordinate[] coordinates)
      Convert JTS coordinates to OpenGIS directPositions
      org.opengis.geometry.coordinate.LineString convertToOpenGisLineString​(com.vividsolutions.jts.geom.LineString jtsLineString)
      Convert a JTS line string object to an OpenGis LineString instance by transferring the internal coordinates
      org.opengis.geometry.coordinate.LineString convertToOpenGisLineString​(com.vividsolutions.jts.geom.MultiLineString jtsMultiLineString)
      Converts a JTS MultiLineString with a single entry into an OpenGIS LineString instance
      org.opengis.geometry.DirectPosition getDirectPositionFromValues​(double xCoordinate, double yCoordinate)
      Create DirectPosition object from X- and Y-coordinates
      double getDistanceInKilometres​(org.opengis.geometry.coordinate.Position startPosition, org.opengis.geometry.coordinate.Position endPosition)
      Compute the distance in kilometres between two positions in a geodetic coordinate reference system
    • Constructor Detail

      • PlanitGeoUtils

        public PlanitGeoUtils()
        Constructor Uses default coordinate reference system
      • PlanitGeoUtils

        public PlanitGeoUtils​(org.opengis.referencing.crs.CoordinateReferenceSystem coordinateReferenceSystem)
        Constructor
        Parameters:
        coordinateReferenceSystem - OpenGIS CoordinateReferenceSystem object containing geometry
    • Method Detail

      • getDistanceInKilometres

        public double getDistanceInKilometres​(org.opengis.geometry.coordinate.Position startPosition,
                                              org.opengis.geometry.coordinate.Position endPosition)
                                       throws PlanItException
        Compute the distance in kilometres between two positions in a geodetic coordinate reference system
        Parameters:
        startPosition - location of the start point
        endPosition - location of the end point
        Returns:
        distance in kilometres between the points
        Throws:
        PlanItException - thrown if there is an error
      • getDirectPositionFromValues

        public org.opengis.geometry.DirectPosition getDirectPositionFromValues​(double xCoordinate,
                                                                               double yCoordinate)
                                                                        throws PlanItException
        Create DirectPosition object from X- and Y-coordinates
        Parameters:
        xCoordinate - X-coordinate
        yCoordinate - Y-coordinate
        Returns:
        DirectPosition object representing the location
        Throws:
        PlanItException - thrown if there is an error during processing
      • convertToOpenGisLineString

        public org.opengis.geometry.coordinate.LineString convertToOpenGisLineString​(com.vividsolutions.jts.geom.LineString jtsLineString)
                                                                              throws PlanItException
        Convert a JTS line string object to an OpenGis LineString instance by transferring the internal coordinates
        Parameters:
        jtsLineString - JTS line string input
        Returns:
        LineString GeoTools line string output object
        Throws:
        PlanItException - thrown if there is an error
      • convertToOpenGisLineString

        public org.opengis.geometry.coordinate.LineString convertToOpenGisLineString​(com.vividsolutions.jts.geom.MultiLineString jtsMultiLineString)
                                                                              throws PlanItException
        Converts a JTS MultiLineString with a single entry into an OpenGIS LineString instance
        Parameters:
        jtsMultiLineString - JTS MultiLineString input object
        Returns:
        LineString GeoTools MultiLineString output object
        Throws:
        PlanItException - thrown if there is an error
      • convertToDirectPositions

        public List<org.opengis.geometry.coordinate.Position> convertToDirectPositions​(com.vividsolutions.jts.geom.Coordinate[] coordinates)
                                                                                throws PlanItException
        Convert JTS coordinates to OpenGIS directPositions
        Parameters:
        coordinates - array of JTS Coordinate objects
        Returns:
        List of GeoTools Position objects
        Throws:
        PlanItException - thrown if there is an error