public class GeometryEngine extends Object
Constructor and Description |
---|
GeometryEngine() |
Modifier and Type | Method and Description |
---|---|
static Polygon[] |
buffer(Geometry[] geometries,
SpatialReference spatialReference,
double[] distances,
boolean toUnionResults)
Calculates a buffer polygon for each geometry at each of the
corresponding specified distances.
|
static Polygon |
buffer(Geometry geometry,
SpatialReference spatialReference,
double distance)
Calculates a buffer polygon of the geometry as specified by the
distance input.
|
static Geometry |
clip(Geometry geometry,
Envelope envelope,
SpatialReference spatialReference)
Calculates the clipped geometry from a target geometry using an envelope.
|
static boolean |
contains(Geometry geometry1,
Geometry geometry2,
SpatialReference spatialReference)
Indicates if one geometry contains another geometry.
|
static Geometry |
convexHull(Geometry geometry)
Calculates the convex hull geometry.
|
static Geometry[] |
convexHull(Geometry[] geometries,
boolean b_merge)
Calculates the convex hull.
|
static boolean |
crosses(Geometry geometry1,
Geometry geometry2,
SpatialReference spatialReference)
Indicates if one geometry crosses another geometry.
|
static Geometry[] |
cut(Geometry cuttee,
Polyline cutter,
SpatialReference spatialReference)
Calculates the cut geometry from a target geometry using a polyline.
|
static Geometry |
difference(Geometry geometry1,
Geometry substractor,
SpatialReference spatialReference)
Creates the difference of two geometries.
|
static boolean |
disjoint(Geometry geometry1,
Geometry geometry2,
SpatialReference spatialReference)
See OperatorDisjoint.
|
static double |
distance(Geometry geometry1,
Geometry geometry2,
SpatialReference spatialReference)
Calculates the 2D planar distance between two geometries.
|
static boolean |
equals(Geometry geometry1,
Geometry geometry2,
SpatialReference spatialReference)
Indicates if two geometries are equal.
|
static double |
geodesicDistanceOnWGS84(Point ptFrom,
Point ptTo)
A geodesic distance is the shortest distance between any two points on the earth's surface when the earth's
surface is approximated by a spheroid.
|
static MapGeometry |
geoJsonToGeometry(String json,
int importFlags,
Geometry.Type type)
Imports the MapGeometry from its JSON representation.
|
static Geometry |
geometryFromEsriShape(byte[] esriShapeBuffer,
Geometry.Type geometryType)
Imports geometry from the ESRI shape file format.
|
static Geometry |
geometryFromWkt(String wkt,
int importFlags,
Geometry.Type geometryType)
Imports a geometry from a WKT string.
|
static byte[] |
geometryToEsriShape(Geometry geometry)
Exports geometry to the ESRI shape file format.
|
static String |
geometryToGeoJson(Geometry geometry) |
static String |
geometryToGeoJson(int wkid,
Geometry geometry)
Exports the specified geometry instance to its GeoJSON representation.
|
static String |
geometryToGeoJson(SpatialReference spatialReference,
Geometry geometry)
Exports the specified geometry instance to it's JSON representation.
|
static String |
geometryToJson(int wkid,
Geometry geometry)
Exports the specified geometry instance to it's JSON representation.
|
static String |
geometryToJson(SpatialReference spatialReference,
Geometry geometry)
Exports the specified geometry instance to it's JSON representation.
|
static String |
geometryToWkt(Geometry geometry,
int exportFlags)
Exports a geometry to a string in WKT format.
|
static Proximity2DResult |
getNearestCoordinate(Geometry geometry,
Point inputPoint,
boolean bTestPolygonInterior)
Finds the coordinate of the geometry which is closest to the specified
point.
|
static Proximity2DResult |
getNearestVertex(Geometry geometry,
Point inputPoint)
Finds nearest vertex on the geometry which is closed to the specified
point.
|
static Proximity2DResult[] |
getNearestVertices(Geometry geometry,
Point inputPoint,
double searchRadius,
int maxVertexCountToReturn)
Finds all vertices in the given distance from the specified point, sorted
from the closest to the furthest.
|
static Geometry |
intersect(Geometry geometry1,
Geometry intersector,
SpatialReference spatialReference)
Creates a geometry through intersection between two geometries.
|
static MapGeometry |
jsonToGeometry(com.fasterxml.jackson.core.JsonParser json)
Imports the MapGeometry from its JSON representation.
|
static MapGeometry |
jsonToGeometry(JsonReader json)
Imports the MapGeometry from its JSON representation.
|
static MapGeometry |
jsonToGeometry(String json)
Imports the MapGeometry from its JSON representation.
|
static boolean |
overlaps(Geometry geometry1,
Geometry geometry2,
SpatialReference spatialReference)
Indicates if one geometry overlaps another geometry.
|
static boolean |
relate(Geometry geometry1,
Geometry geometry2,
SpatialReference spatialReference,
String relation)
Indicates if the given relation holds for the two geometries.
|
static Geometry |
simplify(Geometry geometry,
SpatialReference spatialReference)
Performs the simplify operation on the geometry.
|
static Geometry |
symmetricDifference(Geometry leftGeometry,
Geometry rightGeometry,
SpatialReference spatialReference)
Creates the symmetric difference of two geometries.
|
static boolean |
touches(Geometry geometry1,
Geometry geometry2,
SpatialReference spatialReference)
Indicates if one geometry touches another geometry.
|
static Geometry |
union(Geometry[] geometries,
SpatialReference spatialReference)
Constructs a new geometry by union an array of geometries.
|
static boolean |
within(Geometry geometry1,
Geometry geometry2,
SpatialReference spatialReference)
Indicates if one geometry is within another geometry.
|
public static MapGeometry jsonToGeometry(com.fasterxml.jackson.core.JsonParser json)
json
- The JSON representation of the geometry (with spatial
reference).public static MapGeometry jsonToGeometry(JsonReader json)
json
- The JSON representation of the geometry (with spatial
reference).public static MapGeometry jsonToGeometry(String json)
json
- The JSON representation of the geometry (with spatial
reference).public static String geometryToJson(int wkid, Geometry geometry)
wkid
- The spatial reference Well Known ID to be used for the JSON
representation.geometry
- The geometry to be exported to JSON.geometryToJson(SpatialReference spatialiReference,
Geometry geometry)
public static String geometryToJson(SpatialReference spatialReference, Geometry geometry)
spatialReference
- The spatial reference of associated object.geometry
- The geometry.public static MapGeometry geoJsonToGeometry(String json, int importFlags, Geometry.Type type)
json
- The JSON representation of the geometry (with spatial
reference).public static String geometryToGeoJson(int wkid, Geometry geometry)
wkid
- The spatial reference Well Known ID to be used for the GeoJSON
representation.geometry
- The geometry to be exported to GeoJSON.geometryToGeoJson(SpatialReference spatialReference,
Geometry geometry)
public static String geometryToGeoJson(SpatialReference spatialReference, Geometry geometry)
spatialReference
- The spatial reference of associated object.geometry
- The geometry.public static Geometry geometryFromEsriShape(byte[] esriShapeBuffer, Geometry.Type geometryType)
esriShapeBuffer
- The buffer containing geometry in the ESRI shape file format.geometryType
- The required type of the Geometry to be imported. Use
Geometry.Type.Unknown if the geometry type needs to be
determined from the buffer content.GeometryException
- when the geometryType is not Geometry.Type.Unknown and the
buffer contains geometry that cannot be converted to the
given geometryType. or the buffer is corrupt. Another
exception possible is IllegalArgumentsException.public static byte[] geometryToEsriShape(Geometry geometry)
geometry
- The geometry to export. (null value is not allowed)public static Geometry geometryFromWkt(String wkt, int importFlags, Geometry.Type geometryType)
wkt
- The string containing the geometry in WKT format.importFlags
- Use the WktImportFlags
interface.geometryType
- The required type of the Geometry to be imported. Use Geometry.Type.Unknown if the geometry type needs to be determined from the WKT context.GeometryException
- when the geometryType is not Geometry.Type.Unknown and the WKT contains a geometry that cannot be converted to the given geometryType.IllegalArgumentException
- if an error is found while parsing the WKT string.public static String geometryToWkt(Geometry geometry, int exportFlags)
geometry
- The geometry to export. (null value is not allowed)exportFlags
- Use the WktExportFlags
interface.public static Geometry union(Geometry[] geometries, SpatialReference spatialReference)
geometries
- The geometries to union.spatialReference
- The spatial reference of the geometries.public static Geometry difference(Geometry geometry1, Geometry substractor, SpatialReference spatialReference)
geometry1
- The geometry being subtracted.substractor
- The geometry object to subtract from.spatialReference
- The spatial reference of the geometries.public static Geometry symmetricDifference(Geometry leftGeometry, Geometry rightGeometry, SpatialReference spatialReference)
leftGeometry
- is one of the Geometry instances in the XOR operation.rightGeometry
- is one of the Geometry instances in the XOR operation.spatialReference
- The spatial reference of the geometries.public static boolean equals(Geometry geometry1, Geometry geometry2, SpatialReference spatialReference)
geometry1
- Geometry.geometry2
- Geometry.spatialReference
- The spatial reference of the geometries.public static boolean disjoint(Geometry geometry1, Geometry geometry2, SpatialReference spatialReference)
public static Geometry intersect(Geometry geometry1, Geometry intersector, SpatialReference spatialReference)
geometry1
- The first geometry.intersector
- The geometry to intersect the first geometry.spatialReference
- The spatial reference of the geometries.public static boolean within(Geometry geometry1, Geometry geometry2, SpatialReference spatialReference)
geometry1
- The base geometry that is tested for within relationship to
the other geometry.geometry2
- The comparison geometry that is tested for the contains
relationship to the other geometry.spatialReference
- The spatial reference of the geometries.public static boolean contains(Geometry geometry1, Geometry geometry2, SpatialReference spatialReference)
geometry1
- The geometry that is tested for the contains relationship to
the other geometry..geometry2
- The geometry that is tested for within relationship to the
other geometry.spatialReference
- The spatial reference of the geometries.public static boolean crosses(Geometry geometry1, Geometry geometry2, SpatialReference spatialReference)
geometry1
- The geometry to cross.geometry2
- The geometry being crossed.spatialReference
- The spatial reference of the geometries.public static boolean touches(Geometry geometry1, Geometry geometry2, SpatialReference spatialReference)
geometry1
- The geometry to touch.geometry2
- The geometry to be touched.spatialReference
- The spatial reference of the geometries.public static boolean overlaps(Geometry geometry1, Geometry geometry2, SpatialReference spatialReference)
geometry1
- The geometry to overlap.geometry2
- The geometry to be overlapped.spatialReference
- The spatial reference of the geometries.public static boolean relate(Geometry geometry1, Geometry geometry2, SpatialReference spatialReference, String relation)
geometry1
- The first geometry for the relation.geometry2
- The second geometry for the relation.spatialReference
- The spatial reference of the geometries.relation
- The DE-9IM relation.public static double distance(Geometry geometry1, Geometry geometry2, SpatialReference spatialReference)
geometry1
- Geometry.geometry2
- Geometry.spatialReference
- The spatial reference of the geometries. This parameter is not
used and can be null.public static Geometry clip(Geometry geometry, Envelope envelope, SpatialReference spatialReference)
geometry
- The geometry to be clipped.envelope
- The envelope used to clip.spatialReference
- The spatial reference of the geometries.public static Geometry[] cut(Geometry cuttee, Polyline cutter, SpatialReference spatialReference)
cuttee
- The geometry to be cut.cutter
- The polyline to cut the geometry.spatialReference
- The spatial reference of the geometries.public static Polygon[] buffer(Geometry[] geometries, SpatialReference spatialReference, double[] distances, boolean toUnionResults)
geometries
- An array of geometries to be buffered.spatialReference
- The spatial reference of the geometries.distances
- The corresponding distances for the input geometries to be buffered.toUnionResults
- TRUE if all geometries buffered at a given distance are to be unioned into a single polygon.public static Polygon buffer(Geometry geometry, SpatialReference spatialReference, double distance)
geometry
- Geometry to be buffered.spatialReference
- The spatial reference of the geometry.distance
- The specified distance for buffer. Same units as the spatial reference.public static Geometry convexHull(Geometry geometry)
geometry
- The input geometry.public static Geometry[] convexHull(Geometry[] geometries, boolean b_merge)
geometries
- The input geometry array.b_merge
- Put true if you want the convex hull of all the geometries in
the array combined. Put false if you want the convex hull of
each geometry in the array individually.public static Proximity2DResult getNearestCoordinate(Geometry geometry, Point inputPoint, boolean bTestPolygonInterior)
inputPoint
- The point to find the nearest coordinate in the geometry for.geometry
- The geometry to consider.public static Proximity2DResult getNearestVertex(Geometry geometry, Point inputPoint)
inputPoint
- The point to find the nearest vertex of the geometry for.geometry
- The geometry to consider.public static Proximity2DResult[] getNearestVertices(Geometry geometry, Point inputPoint, double searchRadius, int maxVertexCountToReturn)
inputPoint
- The point to start from.geometry
- The geometry to consider.searchRadius
- The search radius.maxVertexCountToReturn
- The maximum number number of vertices to return.public static Geometry simplify(Geometry geometry, SpatialReference spatialReference)
geometry
- The geometry to be simplified.spatialReference
- The spatial reference of the geometry to be simplified.public static double geodesicDistanceOnWGS84(Point ptFrom, Point ptTo)
ptFrom
- The "from" point: long, lat in degrees.ptTo
- The "to" point: long, lat in degrees.Copyright © 2018. All rights reserved.