public class

GeometryEngine

extends Object
java.lang.Object
   ↳ com.esri.core.geometry.GeometryEngine

Class Overview

This class provides a set of static methods to perform geometric operations on geometry instances.

Geometric operations include:

  • Project
  • Buffer
  • Clip
  • Union
  • Simplify
  • Intersect
  • Difference
  • Normalize

A set of methods to perform geodesic operations, such as calculating a geodesic distance between two points or creating a geodesic ellipse, is also included.

Summary

Nested Classes
enum GeometryEngine.JoinType Join types for the geodesic offset operation. 
Public Constructors
GeometryEngine()
Public Methods
static Polygon[] buffer(Geometry[] geometries, SpatialReference spatialReference, double[] distances, Unit unit, 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, Unit unit)
Calculates 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 by an envelope.
static boolean contains(Geometry geometry1, Geometry geometry2, SpatialReference spatialReference)
Indicates if one geometry contains another geometry.
static boolean crosses(Geometry geometry1, Geometry geometry2, SpatialReference spatialReference)
Indicates if one geometry crosses another geometry.
static Geometry difference(Geometry inputGeometry, Geometry subtractor, SpatialReference spatialReference)
Creates the difference of two geometries.
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 geodesicArea(Geometry geometry, SpatialReference spatialReference, AreaUnit areaUnit)
Calculates the geodesic area of the input geometry.
static Geometry geodesicDensifyGeometry(Geometry geometry, SpatialReference spatialReference, double maxSegmentLength, LinearUnit lengthUnit)
Creates a geodesic geometry by densifying the input geometry.
static Geometry geodesicDensifyGeometry(Geometry geometry, SpatialReference spatialReference)
static double geodesicDistance(Point p1, Point p2, SpatialReference spatialReference, LinearUnit distanceUnit)
Calculates the geodesic distance between 2 points.
static Polygon geodesicEllipse(Point center, SpatialReference spatialReference, double semiAxis1Length, double semiAxis2Length, LinearUnit lengthUnit)
Same as geodesicEllipse(Point, SpatialReference, double, double, double, int, LinearUnit, com.esri.core.geometry.Geometry.Type) with majorAxisDirection=0, pointCount=100, outputType=Geometry.Type.POLYGON
static Geometry geodesicEllipse(Point center, SpatialReference spatialReference, double semiAxis1Length, double semiAxis2Length, double majorAxisDirection, int pointCount, LinearUnit lengthUnit, Geometry.Type outputType)
Creates a geodesic ellipse.
static double geodesicLength(Geometry geometry, SpatialReference spatialReference, LinearUnit lengthUnit)
A geodesic length is the shortest distance between any two points on the earth's surface when the earth's surface is approximated by a spheroid.
static Point geodesicMove(Point point, SpatialReference spatialReference, double distance, LinearUnit distanceUnit, double azimuth)
Returns a point that has been moved by geodesic calculation.
static List<Point> geodesicMove(List<Point> points, SpatialReference spatialReference, double distance, LinearUnit distanceUnit, double azimuth)
Returns a list of points that have been moved by geodesic calculations.
static List<Geometry> geodesicOffset(List<Geometry> geometries, SpatialReference spatialReference, double distance)
static List<Geometry> geodesicOffset(List<Geometry> geometries, SpatialReference spatialReference, double distance, GeometryEngine.JoinType joinType, double bevelRatio, double flattenError)
Creates offset versions of the input geometries.
static Geometry geodesicOffset(Geometry geometry, SpatialReference spatialReference, double distance)
static Geometry geodesicOffset(Geometry geometry, SpatialReference spatialReference, double distance, GeometryEngine.JoinType joinType, double bevelRatio, double flattenError)
static Polygon geodesicSector(Point center, SpatialReference spatialReference, double semiAxis1Length, double semiAxis2Length, double startDirection, double sectorAngle, LinearUnit lengthUnit)
Same as geodesicSector(Point, SpatialReference, double, double, double, double, double, double, double, LinearUnit, com.esri.core.geometry.Geometry.Type) with majorAxisDirection=0, maxArcSegmentLength=10, maxRadiusSegmentLength=10, outputType=Geometry.Type.POLYGON
static Geometry geodesicSector(Point center, SpatialReference spatialReference, double semiAxis1Length, double semiAxis2Length, double majorAxisDirection, double startDirection, double sectorAngle, double maxArcSegmentLength, double maxRadiusSegmentLength, LinearUnit lengthUnit, Geometry.Type outputType)
Creates a geodesic sector.
static Geometry geometryFromEsriShape(byte[] esriShapeBuffer, Geometry.Type geometryType)
Imports geometry from the binary ESRI shape file format.
static byte[] geometryToEsriShape(Geometry geometry)
Exports geometry to the ESRI shape file format; the exported binary can then be stored in SDE.
static String geometryToJson(SpatialReference spatialReference, Geometry geometry)
Exports the specified geometry instance to its JSON representation.
static Point getLabelPointForPolygon(Polygon polygon, SpatialReference sp)
Calculates an interior point for a specified polygon.
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 the nearest vertex on the geometry from the specified input 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 List<CompositeGeographicTransformation> getTransformations(SpatialReference fromSR, SpatialReference toSR)
Same as getTransformations(SpatialReference, SpatialReference, Envelope, int) with maxEntries=0, and extent=empty envelope.
static List<CompositeGeographicTransformation> getTransformations(SpatialReference fromSR, SpatialReference toSR, Envelope extent, int maxEntries)
Gets transformations to project from fromSR to toSR.
static Geometry intersect(Geometry inputGeometry, Geometry intersector, SpatialReference spatialReference)
Creates a geometry through intersection between two geometries.
static boolean intersects(Geometry geometry1, Geometry geometry2, SpatialReference spatialReference)
Indicates if one geometry intersects another geometry.
static MapGeometry jsonToGeometry(JsonParser json)
Imports the MapGeometry from its JSON representation.
static Geometry normalizeCentralMeridian(Geometry geometry, SpatialReference spatialReference)
Returns a copy of the input geometry that does not intersect the minimum or maximum meridian of the spatial reference.
static Geometry project(Geometry geometry, ProjectionTransformation tx)
Projects the given geometry using the provided projection transformation.
static Geometry project(Geometry geometry, SpatialReference inputSR, SpatialReference outputSR, CompositeGeographicTransformation tx)
Projects the given geometry using the provided spatial references and transformation.
static Point project(double x, double y, SpatialReference sr)
Projects the given point from a longitude/latitude (EPSG:4326 / WGS84 spatial reference) to the specified output spatial reference.
static Geometry project(Geometry geometry, SpatialReference inputSR, SpatialReference outputSR, GeographicTransformation tx)
static Geometry project(Geometry geometry, SpatialReference inputSR, SpatialReference outputSR)
Projects the given geometry instance from the input spatial reference to the output spatial reference.
static Geometry simplify(Geometry geometry, SpatialReference spatialReference)
Performs the simplify operation on the geometry.
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.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public GeometryEngine ()

Public Methods

public static Polygon[] buffer (Geometry[] geometries, SpatialReference spatialReference, double[] distances, Unit unit, boolean toUnionResults)

Calculates a buffer polygon for each geometry at each of the corresponding specified distances. It is assumed all geometries have the same spatial reference. The unit variable defines the unit of all the distances. If unit == null then the unit of distances is assumed to be that of the spatial reference. There is an option to union the returned geometries.

Parameters
geometries Geometry: An array of geometries to be buffered.
spatialReference SpatialReference: The spatial reference of the geometries.
distances double: The corresponding distances for the input geometries to be buffered.
unit Unit: The unit of the values in the distances array. Must be of the same unit type as spatial reference.
toUnionResults boolean: True if all geometries buffered at a given distance are to be unioned into a single polygon.
Returns
Polygon[] The buffer of the geometries.
Throws
IllegalArgumentException if the input unit and the spatial reference unit are not of the same unit type.

public static Polygon buffer (Geometry geometry, SpatialReference spatialReference, double distance, Unit unit)

Calculates buffer polygon of the geometry as specified by the distance input. If unit == null, then the distance is assumed to be in the unit of the spatial reference.

Parameters
geometry Geometry: Geometry to be buffered.
spatialReference SpatialReference: The spatial reference of the geometry.
distance double: The specified distance for buffer.
unit Unit: The unit of the values in the distances array. Must be of the same unit type as spatial reference.
Returns
Polygon The buffer polygon at the specified distances.
Throws
IllegalArgumentException if the input unit and the spatial reference unit are not of the same unit type.

public static Geometry clip (Geometry geometry, Envelope envelope, SpatialReference spatialReference)

Calculates the clipped geometry from a target geometry by an envelope.

Parameters
geometry Geometry: The geometry to be clipped.
envelope Envelope: The envelope used to clip.
spatialReference SpatialReference: The spatial reference of the geometries.
Returns
Geometry The geometry created by the clipping.

public static boolean contains (Geometry geometry1, Geometry geometry2, SpatialReference spatialReference)

Indicates if one geometry contains another geometry.

Parameters
geometry1 Geometry: The geometry that is tested for the contains relationship to the other geometry..
geometry2 Geometry: The geometry that is tested for within relationship to the other geometry.
spatialReference SpatialReference: The spatial reference of the geometries.
Returns
boolean True if geometry1 contains geometry2.
Throws
IllegalArgumentException if any of the input geometries is null.

public static boolean crosses (Geometry geometry1, Geometry geometry2, SpatialReference spatialReference)

Indicates if one geometry crosses another geometry.

Parameters
geometry1 Geometry: The geometry to cross.
geometry2 Geometry: The geometry being crossed.
spatialReference SpatialReference: The spatial reference of the geometries.
Returns
boolean True if geometry1 crosses geometry2
Throws
IllegalArgumentException if any of the input geometries is null.

public static Geometry difference (Geometry inputGeometry, Geometry subtractor, SpatialReference spatialReference)

Creates the difference of two geometries. The resultant geometry is the part of inputGeometry not in the subtractor. The dimension of subtractor has to be equal to or greater than that of inputGeometry.

Parameters
inputGeometry Geometry: The geometry being subtracted.
subtractor Geometry: The geometry object to subtract from.
spatialReference SpatialReference: The spatial reference of the geometries.
Returns
Geometry The geometry of the differences.
Throws
IllegalArgumentException if inputGeometry or subtractor parameter is null.

public static double distance (Geometry geometry1, Geometry geometry2, SpatialReference spatialReference)

Calculates the 2D planar distance between two geometries.

Parameters
geometry1 Geometry: Geometry.
geometry2 Geometry: Geometry.
spatialReference SpatialReference: The spatial reference of the geometries.
Returns
double The distance between the two geometries.
Throws
IllegalArgumentException if any of the input geometries is null.

public static boolean equals (Geometry geometry1, Geometry geometry2, SpatialReference spatialReference)

Indicates if two geometries are equal.

Parameters
geometry1 Geometry: Geometry.
geometry2 Geometry: Geometry.
spatialReference SpatialReference: The spatial reference of the geometries.
Returns
boolean True if both geometry objects are equal.

public static double geodesicArea (Geometry geometry, SpatialReference spatialReference, AreaUnit areaUnit)

Calculates the geodesic area of the input geometry.

Parameters
geometry Geometry: The geometry to calculate the area of.
spatialReference SpatialReference: The spatial reference of the geometry.
areaUnit AreaUnit: Unit of the area returned. If this is null, returned area is in square meters.
Returns
double the geodesic area of the input geometry; 0 if geometry is not a polygon or a envelope. Returned area is in square meters if the input areaUnit is null.
Throws
IllegalArgumentException if input geometry or spatial reference is null.

public static Geometry geodesicDensifyGeometry (Geometry geometry, SpatialReference spatialReference, double maxSegmentLength, LinearUnit lengthUnit)

Creates a geodesic geometry by densifying the input geometry.

Parameters
geometry Geometry: input geometry to be used to create corresponding geodesic geometry.
spatialReference SpatialReference: spatial reference of input and output geometry.
maxSegmentLength double: the geodesic geometry consists of a number of segments. This specifies the maximum length of those segments.
lengthUnit LinearUnit: Unit of the input lengthMaxSegment. If null, the unit assumed is meters.
Returns
Geometry geodesic line/polygon if input is a line/polygon; same geometry for point.
Throws
IllegalArgumentException if input geometry is null, or if spatial reference is null, or if the lengthMaxSegment is 0 or negative.

public static Geometry geodesicDensifyGeometry (Geometry geometry, SpatialReference spatialReference)

Same as geodesicDensifyGeometry(Geometry, SpatialReference, double, LinearUnit) with maxSegmentLength=10000 meters.

Parameters
geometry Geometry
spatialReference SpatialReference
Returns
Geometry

public static double geodesicDistance (Point p1, Point p2, SpatialReference spatialReference, LinearUnit distanceUnit)

Calculates the geodesic distance between 2 points.

Parameters
p1 Point: One of the 2 points.
p2 Point: The other point.
spatialReference SpatialReference: spatial reference of the input geometry.
distanceUnit LinearUnit: Unit of the result. If null, the unit assumed is meters.
Returns
double the geodesic distance between 2 points.
Throws
IllegalArgumentException if any of the input points or spatial reference is null.

public static Polygon geodesicEllipse (Point center, SpatialReference spatialReference, double semiAxis1Length, double semiAxis2Length, LinearUnit lengthUnit)

Same as geodesicEllipse(Point, SpatialReference, double, double, double, int, LinearUnit, com.esri.core.geometry.Geometry.Type) with majorAxisDirection=0, pointCount=100, outputType=Geometry.Type.POLYGON

Parameters
center Point
spatialReference SpatialReference
semiAxis1Length double
semiAxis2Length double
lengthUnit LinearUnit
Returns
Polygon

public static Geometry geodesicEllipse (Point center, SpatialReference spatialReference, double semiAxis1Length, double semiAxis2Length, double majorAxisDirection, int pointCount, LinearUnit lengthUnit, Geometry.Type outputType)

Creates a geodesic ellipse.

Parameters
center Point: center of ellipse in the coordinates of the specified spatial reference.
spatialReference SpatialReference: spatial reference of the input center and the output geometry.
semiAxis1Length double: length of one of the semi-axes.
semiAxis2Length double: length of the other semi-axis.
majorAxisDirection double: direction of major axis of the ellipse. Specified in degrees, 0 is East, measured anti-clockwise.
pointCount int: the calculated geodesic geometry is a piecewise approximation. This specifies the number of vertices in the result. (A projection applied on the result to consider the input spatialReference may add or remove or add some vertices). Values less than 10 will reset to 10.
lengthUnit LinearUnit: Unit used to specify the length values. If null, the unit assumed is meters.
outputType Geometry.Type: One of Geometry.Type.MULTIPOINT, Geometry.Type.POLYLINE, or Geometry.Type.POLYGON.

For polygon or polyline, the result may have more than one path depending on the size of the ellipse and its position relative to the horizon of the coordinate system.
For Polygon, the interior of the polygon is the interior of the ellipse.
For Multipoint or polyline, the result vertices lie on the boundary of the ellipse.
Returns
Geometry geometry that represents the geodesic ellipse.
Throws
IllegalArgumentException if any of the input is null, or if any of the lengths is 0 or negative.
IllegalArgumentException if the outputType is not one of MULTIPOINT, POLYLINE, or POLYGON.

public static double geodesicLength (Geometry geometry, SpatialReference spatialReference, LinearUnit lengthUnit)

A geodesic length is the shortest distance between any two points on the earth's surface when the earth's surface is approximated by a spheroid.

Parameters
geometry Geometry: The input geometry.
spatialReference SpatialReference: The spatial reference in which the coordinates of the geometry are defined. This spatial reference can be a Geographic Coordinate System or a Projected Coordinate System, but it cannot be local.
lengthUnit LinearUnit: The units to return the length in. If null is specified, the length is returned in meters.
Returns
double The geodesic length of geometry. Note: This method will always return 0 for Point and MultiPoint instances.

public static Point geodesicMove (Point point, SpatialReference spatialReference, double distance, LinearUnit distanceUnit, double azimuth)

Returns a point that has been moved by geodesic calculation. The input point is moved by specified distance and azimuth.

Parameters
point Point: point to be moved.
spatialReference SpatialReference: spatial reference of the input point.
distance double: distance to be moved.
distanceUnit LinearUnit: unit of distance specified. If null, unit assumed is meters.
azimuth double: the angle for the points to be moved along, in degrees.
Returns
Point the point moved.
Throws
IllegalArgumentException if the input point or spatial reference is null.

public static List<Point> geodesicMove (List<Point> points, SpatialReference spatialReference, double distance, LinearUnit distanceUnit, double azimuth)

Returns a list of points that have been moved by geodesic calculations. Each input point is moved by specified distance and azimuth.

Parameters
points List: points to be moved.
spatialReference SpatialReference: spatial reference of the input points.
distance double: distance to be moved.
distanceUnit LinearUnit: unit of distance specified. If null, unit assumed is meters.
azimuth double: the angle for the points to be moved along, in degrees.
Returns
List<Point> list of points moved, in same order as the input.
Throws
IllegalArgumentException if any of the input points or spatial reference is null.

public static List<Geometry> geodesicOffset (List<Geometry> geometries, SpatialReference spatialReference, double distance)

Parameters
geometries List
spatialReference SpatialReference
distance double
Returns
List<Geometry>

public static List<Geometry> geodesicOffset (List<Geometry> geometries, SpatialReference spatialReference, double distance, GeometryEngine.JoinType joinType, double bevelRatio, double flattenError)

Creates offset versions of the input geometries.

The offset operation creates a geometry that is at a constant distance (offset distance) from an input polyline or polygon. It is similar to buffering, but produces a one sided result.

For transforming geometries (such as shift, rotate), see Transformation2D.

Parameters
geometries List: The geometries to calculate the offset for. Point and Multipoint are not supported.
spatialReference SpatialReference: The Spatial reference of the Geometries.
distance double: The offset distance for the Geometries, in units of the spatial reference.
If offsetDistance > 0, then the offset geometry is constructed to the right of the oriented input geometry, if offsetDistance = 0, then there is no change in the geometries, otherwise it is constructed to the left.
For a simple polygon, the orientation of outer rings is clockwise and for inner rings it is counter clockwise. So the "right side" of a simple polygon is always its inside.
joinType GeometryEngine.JoinType: The GeometryEngine.JoinType of the offset geometry.
bevelRatio double: Applicable to MITER, bevelRatio is multiplied by the offset distance and the result determines how far a mitered offset intersection can be located before it is beveled.
flattenError double: Applicable to ROUND, flattenError determines the maximum distance of the resulting segments compared to the true circular arc. The algorithm never produces more than around 180 vertices for each round join.
Returns
List<Geometry> the result of the offset operation; result is in order of the input geometries.
Throws
RuntimeException if any of the input geometry is a point or multipoint.
IllegalArgumentException if the input geometries or join type is null.

public static Geometry geodesicOffset (Geometry geometry, SpatialReference spatialReference, double distance)

Parameters
geometry Geometry
spatialReference SpatialReference
distance double
Returns
Geometry

public static Geometry geodesicOffset (Geometry geometry, SpatialReference spatialReference, double distance, GeometryEngine.JoinType joinType, double bevelRatio, double flattenError)

Parameters
geometry Geometry
spatialReference SpatialReference
distance double
joinType GeometryEngine.JoinType
bevelRatio double
flattenError double
Returns
Geometry

public static Polygon geodesicSector (Point center, SpatialReference spatialReference, double semiAxis1Length, double semiAxis2Length, double startDirection, double sectorAngle, LinearUnit lengthUnit)

Same as geodesicSector(Point, SpatialReference, double, double, double, double, double, double, double, LinearUnit, com.esri.core.geometry.Geometry.Type) with majorAxisDirection=0, maxArcSegmentLength=10, maxRadiusSegmentLength=10, outputType=Geometry.Type.POLYGON

Parameters
center Point
spatialReference SpatialReference
semiAxis1Length double
semiAxis2Length double
startDirection double
sectorAngle double
lengthUnit LinearUnit
Returns
Polygon

public static Geometry geodesicSector (Point center, SpatialReference spatialReference, double semiAxis1Length, double semiAxis2Length, double majorAxisDirection, double startDirection, double sectorAngle, double maxArcSegmentLength, double maxRadiusSegmentLength, LinearUnit lengthUnit, Geometry.Type outputType)

Creates a geodesic sector.

Parameters
center Point: center of the sector.
spatialReference SpatialReference: spatial reference of the center.
semiAxis1Length double: length of one of the semi-axes.
semiAxis2Length double: length of the other semi-axes.
majorAxisDirection double: direction of the major axis. 0 is East, measured anti-clockwise. Measured in degrees.
startDirection double: direction of start of the sector relative to majorAxisDirection, measured anti-clockwise. Measured in degrees.
sectorAngle double: sector angle relative to the startDirection, measured clockwise. Measured in degrees.
maxArcSegmentLength double: maximum length of a segment along the arc.
maxRadiusSegmentLength double: maximum length of a segment along the radius.
lengthUnit LinearUnit: unit to be used to measure the input lengths. If null, unit assumed is meters.
outputType Geometry.Type: output type that will represent the sector.

When output type is polyline or a multipoint, the result vertices line on the boundary of the sector.
When output type is a polygon, the interior of the polygon is the interior of the sector.
When output type is a polyline or a polygon, the result may have more than one path, depending on the size of the sector and its position relative to the horizon of the coordinate system.
Returns
Geometry a geodesic sector.
Throws
IllegalArgumentException if the center point or spatial reference is null.
IllegalArgumentException if input length of any axis is 0 or negative.
IllegalArgumentException if input arc or radius length is 0 or negative.
IllegalArgumentException if outputType parameter is null.

public static Geometry geometryFromEsriShape (byte[] esriShapeBuffer, Geometry.Type geometryType)

Imports geometry from the binary ESRI shape file format. Note: this is not from a shape-file on disk.

Parameters
esriShapeBuffer byte: The buffer containing geometry in the ESRI shape file format.
geometryType Geometry.Type: 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.
Returns
Geometry The geometry or null if the buffer contains null shape.
Throws
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)

Exports geometry to the ESRI shape file format; the exported binary can then be stored in SDE.

Parameters
geometry Geometry: The geometry to export. (null value is not allowed)
Returns
byte[] Array containing the exported ESRI shape file. Note: this is not a shape-file on disk.

public static String geometryToJson (SpatialReference spatialReference, Geometry geometry)

Exports the specified geometry instance to its JSON representation.

Parameters
spatialReference SpatialReference: The spatial reference of associated object.
geometry Geometry: The geometry.
Returns
String String The JSON representation of the specified geometry.

public static Point getLabelPointForPolygon (Polygon polygon, SpatialReference sp)

Calculates an interior point for a specified polygon. This interior point can be used by clients to place a label for the polygon.

Parameters
polygon Polygon: The polygon to get label point for.
sp SpatialReference: SpatialReference
Returns
Point the label point, null returned if Polygon or SpatialReference is invalid

public static Proximity2DResult getNearestCoordinate (Geometry geometry, Point inputPoint, boolean bTestPolygonInterior)

Finds the coordinate of the geometry which is closest to the specified point.

Parameters
geometry Geometry: The geometry to consider.
inputPoint Point: The point to find the nearest coordinate in the geometry for.
bTestPolygonInterior boolean
Returns
Proximity2DResult Proximity2DResult containing the nearest coordinate
Throws
IllegalArgumentException if any of the input geometries is null.

public static Proximity2DResult getNearestVertex (Geometry geometry, Point inputPoint)

Finds the nearest vertex on the geometry from the specified input point.

Parameters
geometry Geometry: The geometry to consider.
inputPoint Point: The point from which to find the nearest vertex of the geometry.
Returns
Proximity2DResult Proximity2DResult containing the nearest vertex.
Throws
IllegalArgumentException if any of the input geometries is null.

public 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.

Parameters
geometry Geometry: The geometry to consider.
inputPoint Point: The point to start from.
searchRadius double: The search radius.
maxVertexCountToReturn int: The maximum number number of vertices to return.
Returns
Proximity2DResult[] Proximity2DResult containing the array of nearest vertices.
Throws
IllegalArgumentException if any of the input geometries is null.

public static List<CompositeGeographicTransformation> getTransformations (SpatialReference fromSR, SpatialReference toSR)

Same as getTransformations(SpatialReference, SpatialReference, Envelope, int) with maxEntries=0, and extent=empty envelope.

Parameters
fromSR SpatialReference
toSR SpatialReference
Returns
List<CompositeGeographicTransformation>
Throws
IllegalArgumentException if any of the spatial reference parameters is null

public static List<CompositeGeographicTransformation> getTransformations (SpatialReference fromSR, SpatialReference toSR, Envelope extent, int maxEntries)

Gets transformations to project from fromSR to toSR.

Parameters
fromSR SpatialReference: spatial reference to project from.
toSR SpatialReference: spatial reference to project to.
extent Envelope: area of interest to decide the best applicable projection, input empty envelope if area is to be ignored.
maxEntries int: maximum number of entries in the return list, set to 0 for all entries.
Returns
List<CompositeGeographicTransformation> list of all transformations, empty list if fromSR equals toSR.
Throws
IllegalArgumentException if any of the spatial reference parameters is null, or if the input extent is null, or if maxEntries is negative.

public static Geometry intersect (Geometry inputGeometry, Geometry intersector, SpatialReference spatialReference)

Creates a geometry through intersection between two geometries.

Parameters
inputGeometry Geometry: Geometry.
intersector Geometry: Geometry
spatialReference SpatialReference: The spatial reference of the geometries.
Returns
Geometry The geometry created through intersection.
Throws
IllegalArgumentException if inputGeometry or intersector parameter is null.

public static boolean intersects (Geometry geometry1, Geometry geometry2, SpatialReference spatialReference)

Indicates if one geometry intersects another geometry.

Parameters
geometry1 Geometry: The geometry that is tested for the intersects relationship to the other geometry.
geometry2 Geometry: The geometry being intersected.
spatialReference SpatialReference: The spatial reference of the geometries.
Returns
boolean True if geometry1 intersects geometry2.
Throws
IllegalArgumentException if any of the input geometries is null.

public static MapGeometry jsonToGeometry (JsonParser json)

Imports the MapGeometry from its JSON representation.

Parameters
json JsonParser: The JSON representation of the geometry (with spatial reference).
Returns
MapGeometry The MapGeometry instance containing the imported geometry and its spatial reference.

public static Geometry normalizeCentralMeridian (Geometry geometry, SpatialReference spatialReference)

Returns a copy of the input geometry that does not intersect the minimum or maximum meridian of the spatial reference. The returned geometry may be cut into multiple parts. You may wish to use this method to normalize geometries before passing them to methods that require coordinates within the spatial reference domain, for example geodatabase editing methods or geocoding services.

The returned geometry is the same type as the input geometry, except in the case of an Envelope in which case the returned geometry is a Polygon.

Parameters
geometry Geometry: The geometry that you want normalized. This must be an Envelope, Point, MultiPoint, Polygon or Polyline.
spatialReference SpatialReference: The geometry's spatial reference.
Returns
Geometry The normalized geometry. May be empty if the input geometry is empty or invalid.
Throws
IllegalArgumentException if geometry or spatialReference is null, or if the type of geometry is invalid (for example a Line).

public static Geometry project (Geometry geometry, ProjectionTransformation tx)

Projects the given geometry using the provided projection transformation.

Parameters
geometry Geometry: geometry to project.
tx ProjectionTransformation: transformation to be used to project.
Returns
Geometry projected geometry.

public static Geometry project (Geometry geometry, SpatialReference inputSR, SpatialReference outputSR, CompositeGeographicTransformation tx)

Projects the given geometry using the provided spatial references and transformation.

Parameters
geometry Geometry: geometry to project.
inputSR SpatialReference: spatial reference to project from.
outputSR SpatialReference: spatial reference to project to.
tx CompositeGeographicTransformation: transformation to be used to project.
Returns
Geometry projected geometry. Default transformation will be applied if input transformation is null or empty.

public static Point project (double x, double y, SpatialReference sr)

Projects the given point from a longitude/latitude (EPSG:4326 / WGS84 spatial reference) to the specified output spatial reference.

Parameters
x double: the x coordinate (longitude)
y double: the y coordinate (latitude)
sr SpatialReference: The spatial reference to project the point to
Returns
Point Returns the projected point

public static Geometry project (Geometry geometry, SpatialReference inputSR, SpatialReference outputSR, GeographicTransformation tx)

Parameters
geometry Geometry
inputSR SpatialReference
outputSR SpatialReference
tx GeographicTransformation
Returns
Geometry

public static Geometry project (Geometry geometry, SpatialReference inputSR, SpatialReference outputSR)

Projects the given geometry instance from the input spatial reference to the output spatial reference. To perform the projection, this method creates an instance of the ProjectionTransformation using the domain of the input spatial reference as the area of interest.

Parameters
geometry Geometry: The input geometry to be projected.
inputSR SpatialReference: The spatial reference of the input geometry.
outputSR SpatialReference: The spatial reference to project the geometry to.
Returns
Geometry Returns the projected geometry.

public static Geometry simplify (Geometry geometry, SpatialReference spatialReference)

Performs the simplify operation on the geometry.

Parameters
geometry Geometry: The geometry to be simplified.
spatialReference SpatialReference: The spatial reference of the geometry to be simplified.
Returns
Geometry The simplified geometry.

public static boolean touches (Geometry geometry1, Geometry geometry2, SpatialReference spatialReference)

Indicates if one geometry touches another geometry.

Parameters
geometry1 Geometry: The geometry which may be touching another geometry.
geometry2 Geometry: The geometry to be touched.
spatialReference SpatialReference: The spatial reference of the geometries.
Returns
boolean True if geometry1 touches geometry2.
Throws
IllegalArgumentException if any of the input geometries is null.

public static Geometry union (Geometry[] geometries, SpatialReference spatialReference)

Constructs a new geometry by union an array of geometries. All inputs must be of the same type of geometries and share one spatial reference.

Parameters
geometries Geometry: The geometries to union.
spatialReference SpatialReference: The spatial reference of the geometries.
Returns
Geometry The geometry object representing the resultant union.
Throws
IllegalArgumentException if geometries parameter is null.

public static boolean within (Geometry geometry1, Geometry geometry2, SpatialReference spatialReference)

Indicates if one geometry is within another geometry.

Parameters
geometry1 Geometry: The base geometry that is tested for within relationship to the other geometry.
geometry2 Geometry: The comparison geometry that is tested for the contains relationship to the other geometry.
spatialReference SpatialReference: The spatial reference of the geometries.
Returns
boolean True if the first geometry (geometry1) is within the other geometry (geometry2).
Throws
IllegalArgumentException if any of the input geometries is null.