AnyLogic
Expand
Font size

public class BasicGISUtils
extends Object

Nested Class Summary

Modifier and TypeClassDescription
static interface BasicGISUtils.DistanceFunction 

Method Summary

Modifier and TypeMethodDescription
static doublegetDistanceGIS(double latitude1, double longitude1, double latitude2, double longitude2)
Returns the distance measured in meters between two given points
static doublegetGISRegionArea(double[] latlondeg) 
static double[]getSimplifiedRoute(double[] latLonPoints, double generalizationPrecision, BasicGISUtils.DistanceFunction distanceFunction)
Generalizes the given curve.
static doublegetSphericalAzimuth(double latitude1, double longitude1, double latitude2, double longitude2) 
static doublegetSphericalDistance(double latitude1, double longitude1, double latitude2, double longitude2)
Distance from one geographic point to another in radians
static com.bbn.openmap.proj.ProjectionmakeProjection(double centerLatitude, double centerLongitude, double projectionScale, int width, int height)
Create a Mercator projection.
static voidreadShapeFile(String shapefilePath, BiFunction<org.geotools.api.filter.FilterFactory,org.geotools.api.feature.type.FeatureType,org.geotools.api.filter.Filter> filterProvider, BiConsumer<org.locationtech.jts.geom.Geometry,org.geotools.api.feature.simple.SimpleFeature> action)
Reads the given shapefile (with optional filtering, e.g.
static StringshapeFileNameToSVGFileName(String shapefilename) 

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Method Details

getDistanceGIS

public static double getDistanceGIS(double latitude1,
 double longitude1,
 double latitude2,
 double longitude2)
Returns the distance measured in meters between two given points
Parameters:
latitude1 - the latitude of first point measured in degrees (-90 ... (South) ... 0 ... (North) ... +90)
longitude1 - the longitude of first point measured in degrees (-180 ... (West) ... 0 ... (East) ... +180)
latitude2 - the latitude of second point measured in degrees (-90 ... (South) ... 0 ... (North) ... +90)
longitude2 - the longitude of second point measured in degrees (-180 ... (West) ... 0 ... (East) ... +180)
Returns:
distance between two points measured in meters

getGISRegionArea

public static double getGISRegionArea(double[] latlondeg)

getSphericalDistance

public static double getSphericalDistance(double latitude1,
 double longitude1,
 double latitude2,
 double longitude2)
Distance from one geographic point to another in radians
Parameters:
latitude1 - the latitude of first point measured in degrees (-90 ... (South) ... 0 ... (North) ... +90)
longitude1 - the longitude of first point measured in degrees (-180 ... (West) ... 0 ... (East) ... +180)
latitude2 - the latitude of second point measured in degrees (-90 ... (South) ... 0 ... (North) ... +90)
longitude2 - the longitude of second point measured in degrees (-180 ... (West) ... 0 ... (East) ... +180)
Returns:
distance measured in radians

getSphericalAzimuth

public static double getSphericalAzimuth(double latitude1,
 double longitude1,
 double latitude2,
 double longitude2)

getSimplifiedRoute

public static double[] getSimplifiedRoute(double[] latLonPoints,
 double generalizationPrecision,
 BasicGISUtils.DistanceFunction distanceFunction)
Generalizes the given curve. Note the different format of returned result.
Parameters:
latLonPoints - (lat, lon) pairs representing, the start, then optional intermediate, and the end points, followed by a single number with the total distance. Array length is 2*N+1, where N is number of points.
generalizationPrecision -
distanceFunction -
Returns:
array comprising the array of N (lat, lon) pairs, then array of N-1 segment lengths, then a single number with the total distance.
Given the r result of this method call, the first segment would start at r[0], r[1], end at r[2], r[3] and will have 'real' distance length of r[r.length / 3 * 2 + 0].

makeProjection

@AnyLogicInternalAPI
public static com.bbn.openmap.proj.Projection makeProjection(double centerLatitude,
 double centerLongitude,
 double projectionScale,
 int width,
 int height)
Create a Mercator projection.
Parameters:
centerLatitude - the latitude of projection's center
centerLongitude - the longitude of projection's center
projectionScale - the scale for projection within the range from 0 to 1
width - the width of new projection measured in pixels
height - the height of new projection measured in pixels
Returns:
projection, or null if the projection can't be created.

shapeFileNameToSVGFileName

public static String shapeFileNameToSVGFileName(String shapefilename)

readShapeFile

public static void readShapeFile(String shapefilePath,
 BiFunction<org.geotools.api.filter.FilterFactory,org.geotools.api.feature.type.FeatureType,org.geotools.api.filter.Filter> filterProvider,
 BiConsumer<org.locationtech.jts.geom.Geometry,org.geotools.api.feature.simple.SimpleFeature> action)
Reads the given shapefile (with optional filtering, e.g. by clipping or by name) and executes the given action for each element found (which could be a geometry of polyline, polygon, point, or a collection of those)
Parameters:
shapefilePath - path to shapefile
filterProvider - details and example are in ShapeGISMap.Layer#forAllObjects(java.util.function.BiFunction, java.util.function.BiConsumer)
action - details and example are in ShapeGISMap.Layer#forAllObjects(java.util.function.BiConsumer)