Package org.planit.geo
Class PlanitGeoUtils
- java.lang.Object
-
- org.planit.geo.PlanitGeoUtils
-
public class PlanitGeoUtils extends Object
General geotools related utils- Author:
- markr
-
-
Constructor Summary
Constructors Constructor Description PlanitGeoUtils()Constructor Uses default coordinate reference systemPlanitGeoUtils(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 directPositionsorg.opengis.geometry.coordinate.LineStringconvertToOpenGisLineString(com.vividsolutions.jts.geom.LineString jtsLineString)Convert a JTS line string object to an OpenGis LineString instance by transferring the internal coordinatesorg.opengis.geometry.coordinate.LineStringconvertToOpenGisLineString(com.vividsolutions.jts.geom.MultiLineString jtsMultiLineString)Converts a JTS MultiLineString with a single entry into an OpenGIS LineString instanceorg.opengis.geometry.DirectPositiongetDirectPositionFromValues(double xCoordinate, double yCoordinate)Create DirectPosition object from X- and Y-coordinatesdoublegetDistanceInKilometres(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 PlanItExceptionCompute the distance in kilometres between two positions in a geodetic coordinate reference system- Parameters:
startPosition- location of the start pointendPosition- 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 PlanItExceptionCreate DirectPosition object from X- and Y-coordinates- Parameters:
xCoordinate- X-coordinateyCoordinate- 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 PlanItExceptionConvert 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 PlanItExceptionConverts 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
-
-