Class GeometryEngine
 java.lang.Object

 com.esri.arcgisruntime.geometry.GeometryEngine

public final class GeometryEngine extends java.lang.Object
Defines static methods for carrying out various operations on geometries.Performs geometric operations such as spatial relationship tests, reprojections, shape manipulations, topological queries, and spatial operations. Spatial relationship tests are based on the Dimensionally Extended 9 Intersection Model (DE9IM) developed by Clementini et al.. With this class you can:
 Perform spatial operations such as
clip(Geometry, Envelope)
andunion(Geometry, Geometry)
methods.  Test spatial relationships between geometries such as
intersects(Geometry, Geometry)
andcontains(Geometry, Geometry)
.  Perform proximitybased operations such as
buffer(Geometry, double)
,nearestVertex(Geometry, Point)
andnearestCoordinate(Geometry, Point)
.  Reproject geometries with
project(Geometry, SpatialReference)
andproject(Geometry, SpatialReference, DatumTransformation)
.  Calculate
area(Polygon)
andlength(Polyline)
.
GeometryEngine provides both planar (Euclidean) and geodetic versions of many operations. Be aware that methods named with only the operation are the planar versions (
buffer(Geometry, double)
, for example), while the geodetic equivalent has "Geodetic" appended to the name (for examplebufferGeodetic(Geometry, double, LinearUnit, double, GeodeticCurveType)
). Geodetic methods are better suited to data that have a geographic spatial reference, especially for largearea, smallscale use, while planar methods are suitable to data that have a projected coordinate system, especially for local, largescale. See the "Make measurements" topic in the developers guide for more information. Since:
 100.0.0
 Perform spatial operations such as


Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static double
area(Envelope envelope)
Calculates the area for the Envelope passed in.static double
area(Polygon polygon)
Calculates the area for the Polygon passed in.static double
areaGeodetic(Geometry geometry, AreaUnit areaUnit, GeodeticCurveType curveType)
Calculates the area of the given geometry using a geodetic curve.static java.util.List<Polygon>
autoComplete(java.lang.Iterable<Polygon> existingBoundaries, java.lang.Iterable<Polyline> newBoundaries)
Fills the closed gaps between polygons using polygon boundaries and polylines as the boundary for the new polygons.static Geometry
boundary(Geometry geometry)
Calculates the boundary of the given geometry.static Polygon
buffer(Geometry geometry, double distance)
Creates and returns a geometry object that represents a buffer polygon relative to the given geometry at the specified distance around the given geometry.static java.util.List<Polygon>
buffer(java.lang.Iterable<Geometry> geometries, java.lang.Iterable<java.lang.Double> distances, boolean unionResult)
Creates and returns a buffer or buffers relative to the specified collection of geometries.static Polygon
bufferGeodetic(Geometry geometry, double distance, LinearUnit distanceUnit, double maxDeviation, GeodeticCurveType curveType)
Returns a geometry object that represents a buffer around the given geometry, calculated using a geodetic curve.static java.util.List<Polygon>
bufferGeodetic(java.lang.Iterable<Geometry> geometries, java.lang.Iterable<java.lang.Double> distances, LinearUnit distanceUnit, double maxDeviation, GeodeticCurveType curveType, boolean unionResult)
Creates a buffer or buffers relative to a collection of geometries, basing calculations on a geodesic curve.static Geometry
clip(Geometry geometry, Envelope envelope)
Returns a geometry created by clipping the given Geometry with the given Envelope.static Envelope
combineExtents(Geometry geometry1, Geometry geometry2)
Combines the extents of two given geometries.static Envelope
combineExtents(java.lang.Iterable<Geometry> geometries)
Combines the extents of a collection of geometries.static boolean
contains(Geometry container, Geometry within)
Tests if geometry1 contains geometry2.static Geometry
convexHull(Geometry geometry)
Calculates the convex hull of the given geometry.static java.util.List<Geometry>
convexHull(java.lang.Iterable<Geometry> geometries, boolean unionResult)
Calculates the convex hull or hulls of the geometries in the given collection.static Point
createPointAlong(Polyline polyline, double distance)
Calculates the point at a given distance along a line.static boolean
crosses(Geometry geometry1, Geometry geometry2)
Tests if geometry1 crosses geometry2.static java.util.List<Geometry>
cut(Geometry geometry, Polyline cutter)
Cuts geometry with cutter.static Geometry
densify(Geometry geometry, double maxSegmentLength)
Densifies the input geometry by inserting additional vertices along the geometry at an interval defined bymaxSegmentLength
.static Geometry
densifyGeodetic(Geometry geometry, double maxSegmentLength, LinearUnit lengthUnit, GeodeticCurveType curveType)
Densifies the input geometry by creating additional vertices along the geometry, using a geodesic curve.static Geometry
difference(Geometry geometry1, Geometry geometry2)
Constructs the settheoretic difference between two geometries.static boolean
disjoint(Geometry geometry1, Geometry geometry2)
Tests whether two geometries are disjoint.static double
distanceBetween(Geometry geometry1, Geometry geometry2)
Measures the simple planar distance between two geometries.static GeodeticDistanceResult
distanceGeodetic(Point point1, Point point2, LinearUnit distanceUnit, AngularUnit azimuthUnit, GeodeticCurveType curveType)
Calculates the distance between two Points, returning the result in the given linear unit of measurement.static Geometry
ellipseGeodesic(GeodesicEllipseParameters parameters)
Calculates a geodesic ellipse (or geodesic circle, if semiAxis1Length = semiAxis2Length) centered on a specific point.static boolean
equals(Geometry geometry1, Geometry geometry2)
Tests if two geometries are equal.static Polyline
extend(Polyline polyline, Polyline extender, ExtendOptions... extendOptions)
Extends a polyline using a polyline as the extender.static double
fractionAlong(Polyline line, Point point, double tolerance)
Finds the location on the line nearest the point, expressed as the fraction along the line's total geodesic length, if the point is within the specified distance from the the closest location on the line.static Geometry
generalize(Geometry geometry, double maxDeviation, boolean removeDegenerateParts)
Generalizes the given geometry by removing vertices, based on the DouglasPeucker algorithm.static Geometry
intersection(Geometry geometry1, Geometry geometry2)
Calculates the intersection of two geometries.static java.util.List<Geometry>
intersections(Geometry geometry1, Geometry geometry2)
Calculates the intersections of two geometries.static boolean
intersects(Geometry geometry1, Geometry geometry2)
Tests if two geometries intersect.static boolean
isSimple(Geometry geometry)
Indicates if this Geometry is topologically simple (in other words, is topologically correct).static Point
labelPoint(Polygon polygon)
Calculates an interior point for the given polygon.static double
length(Polyline polyline)
Calculates the length of the given polyline.static double
lengthGeodetic(Geometry geometry, LinearUnit lengthUnit, GeodeticCurveType curveType)
Calculates the geodetic length of the geometry.static Point
moveGeodetic(Point point, double distance, LinearUnit distanceUnit, double azimuth, AngularUnit azimuthUnit, GeodeticCurveType curveType)
Returns a new Point, moved by the given distance at the given azimuth (angle) from the given input Point.static java.util.List<Point>
moveGeodetic(java.util.List<Point> points, double distance, LinearUnit distanceUnit, double azimuth, AngularUnit azimuthUnit, GeodeticCurveType curveType)
Returns a List of Points, moved by the given distance at the given azimuth (angle) from the given input List of Points.static ProximityResult
nearestCoordinate(Geometry geometry, Point point)
Returns aProximityResult
that describes the nearest point in the input geometry to the input point.static ProximityResult
nearestVertex(Geometry geometry, Point point)
Returns aProximityResult
that describes the nearest vertex in the input geometry to the input point.static Geometry
normalizeCentralMeridian(Geometry geometry)
Returns a copy of the input geometry that does not intersect the antimeridian.static Geometry
offset(Geometry geometry, double distance, GeometryOffsetType offsetType, double bevelRatio, double flattenError)
Creates an offset version of the input geometry.static boolean
overlaps(Geometry geometry1, Geometry geometry2)
Tests if two geometries overlap.static Geometry
project(Geometry geometry, SpatialReference spatialReference)
Projects the given geometry from its current spatial reference system into the given spatial reference system, using the default geographic transformation.static Geometry
project(Geometry geometry, SpatialReference spatialReference, DatumTransformation datumTransformation)
Projects the given geometry from its current spatial reference system into the given output spatial reference system, applying the datum transformation provided.static boolean
relate(Geometry geometry1, Geometry geometry2, java.lang.String relation)
Compares the spatial relationship of two geometries.static Geometry
removeM(Geometry geometry)
Creates a copy of a geometry with its mvalues removed.static Geometry
removeZ(Geometry geometry)
Creates a copy of a geometry with its zvalues removed.static Geometry
removeZAndM(Geometry geometry)
Creates a copy of a geometry with its z and mvalues removed.static Multipart
reshape(Multipart geometry, Polyline reshaper)
Reshapes a polygon or polyline using a single path polyline as thereshaper
.static Geometry
sectorGeodesic(GeodesicSectorParameters parameters)
Creates a sector as a polygon, polyline or multipoint geometry.static Geometry
setM(Geometry geometry, double m)
Creates a copy of a geometry with its mvalues set to the given value.static Geometry
setZ(Geometry geometry, double z)
Creates a copy of a geometry with its zvalues set to the given value.static Geometry
setZAndM(Geometry geometry, double z, double m)
Creates a copy of a geometry with its z and mvalues set to the given values.static Geometry
simplify(Geometry geometry)
Simplifies the given geometry to make it topologically consistent according to its geometry type.static Geometry
symmetricDifference(Geometry geometry1, Geometry geometry2)
Calculates the symmetric difference (exclusive or) of the two geometries.static boolean
touches(Geometry geometry1, Geometry geometry2)
Test if the two geometries touch on their borders.static Geometry
union(Geometry geometry1, Geometry geometry2)
Calculates the union of the two geometries.static Geometry
union(java.lang.Iterable<Geometry> geometries)
Calculates the union of a collection of geometries.static boolean
within(Geometry within, Geometry container)
Tests ifwithin
is withincontainer
.



Method Detail

area
public static double area(Envelope envelope)
Calculates the area for the Envelope passed in. This is a planar measurement to compute area for use on geometries using a projected coordinate system. UseareaGeodetic(Geometry, AreaUnit, GeodeticCurveType)
for geodetic measurement. Parameters:
envelope
 envelope whose area is to be calculated Returns:
 area in units matching the envelope's spatial reference
 Throws:
java.lang.NullPointerException
 if envelope is null Since:
 100.0.0

area
public static double area(Polygon polygon)
Calculates the area for the Polygon passed in. This is a planar measurement using 2D Cartesian mathematics to compute the area. UseareaGeodetic(Geometry, AreaUnit, GeodeticCurveType)
for geodetic measurement.The calculated area is based upon the
SpatialReference
of the input geometry. Planar measurements of distance and area can be extremely inaccurate if using an unsuitable spatial reference. Ensure that you understand the potential for error with the geometry's spatial reference.Some spatial references are more appropriate than others for measuring area, and an 'area preserving' spatial reference would be most appropriate with this method. If the input geometry to this method is not in an 'area preserving' spatial reference, you can calculate more accurate results by doing one of the following:
 Use a different spatial reference. Use the
project(Geometry, SpatialReference)
method to project the geometry to a spatial reference that is better suited for area calculations.  Use the geodetic equivalent:
areaGeodetic(Geometry, AreaUnit, GeodeticCurveType)
.
The input geometry must be topologically correct to get its accurate area. Geometries returned by ArcGIS Server services are always topologically correct. If the geometry is not topologically correct, then the resultant area from this method could give negative results. Best practice is to
simplify(Geometry)
geometries before passing to this method. Parameters:
polygon
 polygon whose area is to be calculated Returns:
 area of the given polygon, in the same units as the polygon's spatial reference
 Throws:
java.lang.NullPointerException
 if polygon is null Since:
 100.0.0
 Use a different spatial reference. Use the

areaGeodetic
public static double areaGeodetic(Geometry geometry, AreaUnit areaUnit, GeodeticCurveType curveType)
Calculates the area of the given geometry using a geodetic curve.The term geodesic means calculating the shortest distance between two points on a spheroid. Using geodesic algorithms to calculate distances provides a highly accurate way to obtain length and area of measurements of geographic features. The geodesic algorithm uses the concept of a great circle to obtain the shortest route between two points along the earth’s surface. The area measurement obtained via this method is typically superior to that of the
area(Polygon)
method, asarea(Polygon)
is based upon a projection (i.e. a flat 2D representation of a 3D surface) which often introduces distortion depending on theSpatialReference
the geometry is in.The input geometry must be topologically correct to get its accurate area. If the geometry is not topologically correct, then the resultant area from this method could give negative results. Best practice is to
simplify(Geometry)
geometries before passing to this method. Geometries returned by ArcGIS Server services are always correct. Therefore, if you construct geometries programmatically or using the sketch layer, or if you modify geometries returned by ArcGIS Server, you should always simplify them usingsimplify(Geometry)
first. Parameters:
geometry
 geometry whose area is to be calculatedareaUnit
 unit of measure for the return value. If null, defaults to unit of IdAreaUnitId.SQUARE_METERS
curveType
 type of curve to calculate the geodetic area Returns:
 the geodetic area of the given geometry
 Throws:
java.lang.IllegalArgumentException
 if geometry or curveType is null Since:
 100.0.0

autoComplete
public static java.util.List<Polygon> autoComplete(java.lang.Iterable<Polygon> existingBoundaries, java.lang.Iterable<Polyline> newBoundaries)
Fills the closed gaps between polygons using polygon boundaries and polylines as the boundary for the new polygons.The new polygons are created in the closed empty areas bounded by the edges of the existing polygon boundaries and the new boundary polylines. The newly created polygons do not overlap any existing polygons or polylines, and the boundary of a new polygon must contain at least one edge from the polylines. Only polygons that intersect the input polylines will participate in the operation, so it makes sense to filter the input accordingly.
The geometries in existingBoundaries and newBoundaries must have consistent spatial references.
 Parameters:
existingBoundaries
 the polygonsnewBoundaries
 the polylines Returns:
 an unmodifiable list of the new polygons that were created; empty if either existingBoundaries or newBoundaries is empty
 Throws:
java.lang.IllegalArgumentException
 if existingBoundaries or newBoundaries is nullArcGISRuntimeException
 if the geometries in existingBoundaries and newBoundaries have inconsistent spatial references Since:
 100.1.0

boundary
public static Geometry boundary(Geometry geometry)
Calculates the boundary of the given geometry. The boundary of a point is an empty geometry. Points have no boundary.
 The boundary of a polyline is a multipoint containing the end points of the polyline's parts.
 The boundary of a polygon is a polyline describing its outer and inner rings.
 Parameters:
geometry
 geometry whose boundary is to be calculated Returns:
 the boundary of the given geometry
 Throws:
java.lang.IllegalArgumentException
 if geometry is null Since:
 100.0.0

buffer
public static Polygon buffer(Geometry geometry, double distance)
Creates and returns a geometry object that represents a buffer polygon relative to the given geometry at the specified distance around the given geometry. This is a planar buffer operation. UsebufferGeodetic(Geometry, double, LinearUnit, double, GeodeticCurveType)
to produce a geodetic buffer.The returned polygon is based upon the
SpatialReference
of the input geometry. Planar measurements of distance and area can be extremely inaccurate if using an unsuitable spatial reference. Ensure that you understand the potential for error with the geometry's spatial reference. For this method, some spatial references are better than others for getting accurate results. To get the most accurate buffer polygons using this method, consider using an 'area preserving' spatial reference such as: Albers, Lambert, Mollweide, Hammer, Sinusoidal, etc.If the input geometry to this method is not based on a good 'area preserving' spatial reference, then there are two options available to produce accurate buffers:
 Use the
project(Geometry, SpatialReference)
method to project the geometry to a coordinate system that is better suited for buffers.  Use the
bufferGeodetic(Geometry, double, LinearUnit, double, GeodeticCurveType)
. method which projects the geometry to a geographic coordinate system to obtain the most accurate buffers possible.
 Parameters:
geometry
 geometry to bufferdistance
 buffer distance for the geometry in the same units as the geometry's spatial reference Returns:
 a polygon that represents a buffer at the desired distance around the given geometry
 Throws:
java.lang.NullPointerException
 if geometry is null Since:
 100.0.0
 Use the

buffer
public static java.util.List<Polygon> buffer(java.lang.Iterable<Geometry> geometries, java.lang.Iterable<java.lang.Double> distances, boolean unionResult)
Creates and returns a buffer or buffers relative to the specified collection of geometries. The geometries must have the same spatial references. This is a planar buffer operation. UsebufferGeodetic(Iterable, Iterable, LinearUnit, double, GeodeticCurveType, boolean)
to produce geodetic buffers.The polygons returned from this method are based upon the
SpatialReference
of the input geometry. Planar measurements of distance and area can be extremely inaccurate if using an unsuitable spatial reference. Ensure that you understand the potential for error with the geometry's spatial reference. For this method, some spatial references are better than others for getting accurate results. To get the most accurate buffer polygons using this method, consider using an 'area preserving' SpatialReference such as: Albers, Lambert, Mollweide, Hammer, Sinusoidal, etc.If the input geometry to this method is not based on a good 'area preserving' spatial reference, then there are two options available to produce accurate buffers:
 Use the
project(Geometry, SpatialReference)
method to project the geometry to a coordinate system that is better suited for buffers.  Use the
buffer(Iterable, Iterable, boolean)
method, which projects the geometry to a geographic coordinate system to obtain the most accurate buffers possible.
 Parameters:
geometries
 the geometries to bufferdistances
 the buffer distances for the geometries' in the same units as the geometry's spatial reference. If the number of distances is fewer than the number of geometries, the last distance value is used for the rest of the geometries.unionResult
 true to return a single geometry that buffers all the input geometries; false to return a separate buffer for each of the input geometries. Returns:
 an unmodifiable list containing either a single polygon or one polygon per input geometry, depending on the value of unionResult
 Throws:
java.lang.IllegalArgumentException
 if geometries is null, or if distances is null or emptyArcGISRuntimeException
 if the spatial references of the input geometries are inconsistent Since:
 100.1.0
 Use the

bufferGeodetic
public static Polygon bufferGeodetic(Geometry geometry, double distance, LinearUnit distanceUnit, double maxDeviation, GeodeticCurveType curveType)
Returns a geometry object that represents a buffer around the given geometry, calculated using a geodetic curve. Parameters:
geometry
 the geometry to bufferdistance
 the buffer distance for the geometrydistanceUnit
 the unit of measurement for distancemaxDeviation
 the maximum deviation between pointscurveType
 the type of geodetic curve to use Returns:
 a polygon that represents a buffer at the desired distance around the given geometry
 Throws:
java.lang.IllegalArgumentException
 if geometry, distanceUnit or curveType is nullArcGISRuntimeException
 if the spatial reference of geometry is null Since:
 100.1.0

bufferGeodetic
public static java.util.List<Polygon> bufferGeodetic(java.lang.Iterable<Geometry> geometries, java.lang.Iterable<java.lang.Double> distances, LinearUnit distanceUnit, double maxDeviation, GeodeticCurveType curveType, boolean unionResult)
Creates a buffer or buffers relative to a collection of geometries, basing calculations on a geodesic curve. The geometries must have consistent, nonnull spatial references. Parameters:
geometries
 the geometries to bufferdistances
 the buffer distances for the geometries. If the number of distances is fewer than the number of geometries, the last distance value is used for the rest of the geometries.distanceUnit
 the unit of measurement for distancesmaxDeviation
 the maximum deviation between pointscurveType
 the type of geodetic curve to useunionResult
 true to return a single geometry that buffers all the input geometries; false to return a separate buffer for each of the input geometries Returns:
 an unmodifiable list of polygon geometries that represent a geodesic buffer at the desired distance(s)
relative to the given geometries. If
unionResult
is true, there will be only one polygon in the resulting list. Ifgeometries
is an empty list, the returned list of polygons is also empty.  Throws:
java.lang.IllegalArgumentException
 if geometries, distanceUnit or curveType is null, or if distances is null or emptyArcGISRuntimeException
 if the spatial references of the input geometries are inconsistent Since:
 100.1.0

combineExtents
public static Envelope combineExtents(Geometry geometry1, Geometry geometry2)
Combines the extents of two given geometries. The input geometries must have consistent spatial references. Parameters:
geometry1
 a geometrygeometry2
 another geometry Returns:
 an envelope that covers the extents of the input geometries
 Throws:
java.lang.IllegalArgumentException
 if geometry1 or geometry2 is nullArcGISRuntimeException
 if the spatial references of the input geometries are inconsistent or null Since:
 100.1.0

combineExtents
public static Envelope combineExtents(java.lang.Iterable<Geometry> geometries)
Combines the extents of a collection of geometries. The input geometries must have consistent spatial references. Parameters:
geometries
 the input geometries Returns:
 an envelope that covers the extents of the input geometries
 Throws:
java.lang.IllegalArgumentException
 if geometries is null or emptyArcGISRuntimeException
 if the spatial references of the input geometries are inconsistent Since:
 100.1.0

contains
public static boolean contains(Geometry container, Geometry within)
Tests if geometry1 contains geometry2. Parameters:
container
 geometry that is tested for the "contains" relationship towithin
within
 geometry that is tested for the "within" relationship tocontainer
 Returns:
 true if
container
containswithin
, false otherwise  Throws:
java.lang.NullPointerException
 if container or within is nullArcGISRuntimeException
 if the spatial references of the input geometries are inconsistent or null Since:
 100.0.0

convexHull
public static Geometry convexHull(Geometry geometry)
Calculates the convex hull of the given geometry. The convex hull of a geometry is the minimal bounding geometry such that all outer angles are convex. If you imagine a rubber band stretched around the input geometry, the rubber band takes the shape of the convex hull. Parameters:
geometry
 the input geometry Returns:
 the convex hull of the given geometry
 Throws:
java.lang.IllegalArgumentException
 if geometry is null Since:
 100.0.0

convexHull
public static java.util.List<Geometry> convexHull(java.lang.Iterable<Geometry> geometries, boolean unionResult)
Calculates the convex hull or hulls of the geometries in the given collection. The geometries must have consistent spatial references. The convex hull of a geometry is the minimal bounding geometry such that all outer angles are convex. If you imagine a rubber band stretched around the input geometry, the rubber band takes the shape of the convex hull. Parameters:
geometries
 the input geometriesunionResult
 true to return a single convex hull that encloses all the input geometries, false to return a separate convex hull for each of the input geometries Returns:
 an unmodifiable list containing either a single geometry or one geometry per input geometry, depending on the value of unionResult
 Throws:
java.lang.IllegalArgumentException
 if geometries is nullArcGISRuntimeException
 if the spatial references of the input geometries are inconsistent Since:
 100.1.0

crosses
public static boolean crosses(Geometry geometry1, Geometry geometry2)
Tests if geometry1 crosses geometry2.This method returns true if an intersection results in a geometry whose dimension is one less than the maximum dimension of the two source geometries and the intersection set is interior to both source geometries. This method only returns true for the following combinations of geometries: Multipoint/Polygon, Multipoint/Polyline, Polyline/Polyline, and Polyline/Polygon comparisons.
 Parameters:
geometry1
 one of the two geometriesgeometry2
 the other geometry Returns:
 true if
geometry1
crossesgeometry2
, false otherwise  Throws:
java.lang.IllegalArgumentException
 if geometry1 or geometry2 is nullArcGISRuntimeException
 if the spatial references of the input geometries are inconsistent or null Since:
 100.0.0

cut
public static java.util.List<Geometry> cut(Geometry geometry, Polyline cutter)
Cuts geometry with cutter.The cutter and geometry's spatial references must match.
When cutting a
Polyline
, all left cuts will be grouped together in the firstGeometry
, right cuts and coincident cuts are grouped in the secondGeometry
, and each undefined cut, along with any uncut parts, are output as separate Polylines. A touch is considered to be a cut.When cutting a
Polygon
, all left cuts are grouped in the firstGeometry
, all right cuts are in the secondGeometry
, and each undefined cut, along with any leftover parts after cutting, are output as a separateGeometry
.If there were no cuts then an empty collection will be returned.
If the left or right cut does not exist, the returned
Geometry
will be empty for this type of cut. An undefined cut will only be produced if a left cut or right cut was produced, and there was a part left over after cutting or a cut is bounded to the left and right of the cutter. Parameters:
geometry
 geometry to cutcutter
 polyline that cuts the geometry Returns:
 collection of geometries after cut
 Throws:
java.lang.IllegalArgumentException
 if geometry or cutter is null Since:
 100.0.0

densify
public static Geometry densify(Geometry geometry, double maxSegmentLength)
Densifies the input geometry by inserting additional vertices along the geometry at an interval defined bymaxSegmentLength
. Additional vertices are not inserted on segments of the inputPolyline
orPolygon
that are shorter thanmaxSegmentLength
. Parameters:
geometry
 aPolyline
orPolygon
to densifymaxSegmentLength
 The maximum distance between vertices when the input geometry is densified. The linear unit is assumed to be that of the input geometry's spatial reference (decimal degrees for a geometry with a geographic spatial reference, meters for geometry with a Mercator spatial reference, and so on). See the table of projected coordinate systems in the REST API documentation to determine the unit used by a specific spatial reference https://developers.arcgis.com/rest/servicesreference/projectedcoordinatesystems.htm. Returns:
 the densified geometry
 Throws:
java.lang.IllegalArgumentException
 if geometry is null Since:
 100.0.0

densifyGeodetic
public static Geometry densifyGeodetic(Geometry geometry, double maxSegmentLength, LinearUnit lengthUnit, GeodeticCurveType curveType)
Densifies the input geometry by creating additional vertices along the geometry, using a geodesic curve. Parameters:
geometry
 geometry to densifymaxSegmentLength
 the maximum distance between vertices when the input geometry is densified. Must be a positive value.lengthUnit
 unit of measure formaxSegmentLength
. If null, defaults to linear unit of IdLinearUnitId.METERS
.curveType
 type of geodetic curve to calculate Returns:
 the geodesic densified geometry
 Throws:
java.lang.IllegalArgumentException
 if geometry or curveType is nullArcGISRuntimeException
 if the spatial reference of geometry is null Since:
 100.0.0

difference
public static Geometry difference(Geometry geometry1, Geometry geometry2)
Constructs the settheoretic difference between two geometries. This will return a geometry consisting of the parts of geometry1 that are not in geometry2.This method performs a spatial subtraction from the two input geometries. This means that the order of the two input geometry arguments of the difference method will have different results if they are switched. Think of the difference equation as:
A (Difference) B = C
B (Difference) A = D
See
symmetricDifference(Geometry, Geometry)
to get the parts that are in either geometry, but not in both. Parameters:
geometry1
 first geometrygeometry2
 second geometry Returns:
 new geometry object that represents the difference of the two given input geometries
 Throws:
java.lang.NullPointerException
 if geometry1 or geometry2 is nullArcGISRuntimeException
 if the spatial references of the input geometries are inconsistent or null Since:
 100.0.0

disjoint
public static boolean disjoint(Geometry geometry1, Geometry geometry2)
Tests whether two geometries are disjoint. Parameters:
geometry1
 geometry1 one of the two geometriesgeometry2
 geometry2 the other geometry Returns:
 true if
geometry1
andgeometry2
do not intersect/overlap, false otherwise  Throws:
java.lang.IllegalArgumentException
 if geometry1 or geometry2 are nullArcGISRuntimeException
 if the spatial references of the input geometries are inconsistent or null Since:
 100.0.0

distanceBetween
public static double distanceBetween(Geometry geometry1, Geometry geometry2)
Measures the simple planar distance between two geometries. This is a planar measurement using 2D Cartesian mathematics to calculate the distance in the same coordinate space as the inputs. UsedistanceGeodetic(Point, Point, LinearUnit, AngularUnit, GeodeticCurveType)
for a geodetic measurement of distance.This distance calculation is based upon the
SpatialReference
of the input geometries. In general, planar measurements of distance and area can be extremely inaccurate if using an unsuitable spatial reference. Distortion may be negligible, however, for large scale maps (small areas) that use a suitable map projection. Ensure that you understand the potential for error with the geometry's spatial reference.If you need to calculate more accurate results, do one of the following:
 Use a different spatial reference.
 Use the geodetic equivalent:
distanceGeodetic(Point, Point, LinearUnit, AngularUnit, GeodeticCurveType)
.
 Parameters:
geometry1
 first geometrygeometry2
 second geometry Returns:
 the distance between the two geometries in the same units as the geometry's spatial reference
 Throws:
java.lang.NullPointerException
 if geometry1 or geometry2 is nullArcGISRuntimeException
 if the spatial references of the input geometries are inconsistent or null Since:
 100.0.0
 See Also:
distanceGeodetic(Point, Point, LinearUnit, AngularUnit, GeodeticCurveType)

distanceGeodetic
public static GeodeticDistanceResult distanceGeodetic(Point point1, Point point2, LinearUnit distanceUnit, AngularUnit azimuthUnit, GeodeticCurveType curveType)
Calculates the distance between two Points, returning the result in the given linear unit of measurement. The distance is calculated by accounting for the curvature of the earth's surface, using the given geodetic curve type. Use this method as an alternative to thedistanceBetween(Geometry, Geometry)
method for points that have ageographic
spatial reference. The returned result includes additional information about the azimuths between the input points, in the given angular units. Parameters:
point1
 the Point to calculate distance frompoint2
 the Point to calculate distance todistanceUnit
 the linear unit of measurement for the returned resultazimuthUnit
 the angular unit of measurement for the returned resultcurveType
 the type of geodetic curve between the two points to use to calculate distance Returns:
 the calculated geodetic distance, and other information resulting from the measurement
 Throws:
java.lang.IllegalArgumentException
 if any of the arguments is nullArcGISRuntimeException
 if point1 and point2 have different spatial references Since:
 100.0.0

moveGeodetic
public static java.util.List<Point> moveGeodetic(java.util.List<Point> points, double distance, LinearUnit distanceUnit, double azimuth, AngularUnit azimuthUnit, GeodeticCurveType curveType)
Returns a List of Points, moved by the given distance at the given azimuth (angle) from the given input List of Points. The distance is calculated by accounting for the curvature of the earth's surface, using the given geodetic curve type.Each Point must have the same
SpatialReference
. The returned unmodifiable collection is in the same order as the input, but with new Points at their destination locations. Parameters:
points
 the points to use as the starting locations for the returned pointsdistance
 the distance to move the pointsdistanceUnit
 the unit of measure of distance. If null,LinearUnitId.METERS
will be used.azimuth
 the azimuth angle of the direction for the pointsazimuthUnit
 the angular unit of measure of azimuth. If null,AngularUnitId.DEGREES
will be used.curveType
 the type of geodetic curve to move the points along Returns:
 an unmodifiable List of new Points, moved by the given distance from the input points
 Throws:
java.lang.IllegalArgumentException
 if points or curveType is nullArcGISRuntimeException
 if the spatial references of the input points are inconsistent or null Since:
 100.0.0

moveGeodetic
public static Point moveGeodetic(Point point, double distance, LinearUnit distanceUnit, double azimuth, AngularUnit azimuthUnit, GeodeticCurveType curveType)
Returns a new Point, moved by the given distance at the given azimuth (angle) from the given input Point. The distance is calculated by accounting for the curvature of the earth's surface, using the given geodetic curve type. Parameters:
point
 the point to use as starting location for the returned pointdistance
 the distance to move the pointsdistanceUnit
 the unit of measure of distance. If null,LinearUnitId.METERS
will be used.azimuth
 the azimuth (angle) of the direction of movementazimuthUnit
 the angular unit of measure of azimuth. If null,AngularUnitId.DEGREES
will be used.curveType
 the type of geodetic curve to move the point along Returns:
 a new Point moved by the given distance from the input point
 Throws:
java.lang.IllegalArgumentException
 if point or curveType is nullArcGISRuntimeException
 if point spatial reference is null Since:
 100.0.0

ellipseGeodesic
public static Geometry ellipseGeodesic(GeodesicEllipseParameters parameters)
Calculates a geodesic ellipse (or geodesic circle, if semiAxis1Length = semiAxis2Length) centered on a specific point. If this method is used to generate a polygon or a polyline, the result may have more than one part depending on the size of the ellipse and its position relative to the horizon of the coordinate system. When the method generates a polyline or a multipoint, the result vertices lie on the boundary of the ellipse. When a polygon is generated, the interior of the polygon is the interior of the ellipse.If the smaller axis is zero, the ellipse will degenerate to a line segment, a point, or an empty geometry (depending on the larger axis and output type). Otherwise, if
GeodesicEllipseParameters.getMaxPointCount()
< 10, the number of vertices will default to 10. Parameters:
parameters
 various options needed to construct the ellipse Returns:
 a geodesic ellipse centered on a specific point
 Throws:
java.lang.IllegalArgumentException
 if parameters is nulljava.lang.IllegalArgumentException
 if theGeodesicEllipseParameters.getGeometryType()
is not one ofGeometryType.MULTIPOINT
,GeometryType.POLYLINE
,GeometryType.POLYGON
ArcGISRuntimeException
 if parameters is not valid Since:
 100.0.0

equals
public static boolean equals(Geometry geometry1, Geometry geometry2)
Tests if two geometries are equal. Does not take coordinate order into account.For the strictest equals comparisons of two geometries (which do take into account coordinate order) use:
 Parameters:
geometry1
 does this geometry equal geometry2?geometry2
 does this geometry equal geometry1? Returns:
 true if the two geometries are equal, false otherwise
 Throws:
java.lang.NullPointerException
 if geometry1 or geometry2 is null Since:
 100.0.0

extend
public static Polyline extend(Polyline polyline, Polyline extender, ExtendOptions... extendOptions)
Extends a polyline using a polyline as the extender.The output polyline will have the first and last segment of each path extended to the extender if the segments can be interpolated to intersect the extender. In the case that the segments can be extended to multiple segments of the extender, the shortest extension is chosen. Only end points for paths that are not shared by the end points of other paths will be extended.
 Parameters:
polyline
 the polyline to be extendedextender
 the polyline to extend toextendOptions
 an array or sequence of one or more ExtendOptions, indicating the type of extend operation to perform Returns:
 the extended polyline, or null if polyline cannot be extended by extender
 Throws:
java.lang.IllegalArgumentException
 if polyline, extender or extendOptions is null, or extendOptions is emptyjava.lang.IllegalArgumentException
 if multiple extendOptions are passed and they contain values that are incompatible with each other Since:
 100.1.0

fractionAlong
public static double fractionAlong(Polyline line, Point point, double tolerance)
Finds the location on the line nearest the point, expressed as the fraction along the line's total geodesic length, if the point is within the specified distance from the the closest location on the line. The line and point must have consistent spatial references. Parameters:
line
 the line to locate the point's distance along its lengthpoint
 the point to locatetolerance
 maximum distance that a point is allowed to be from the line, in the units of theSpatialReference
. If the tolerance is 1, the fraction of the closest location on the line is always returned as long as the point lies between the two ends of the polyline. If the distance from the point to the closest location on the line is greater than the tolerance, or the tolerance is 1 and the point does not lie between the two ends of the polyline, NaN is returned. Returns:
 the length along the line nearest the input point, expressed as the fraction of the line's length between 0.0 and 1.0, or NAN if the point is outside the tolerance
 Throws:
java.lang.IllegalArgumentException
 if the line or point parameters are null Since:
 100.6.0

generalize
public static Geometry generalize(Geometry geometry, double maxDeviation, boolean removeDegenerateParts)
Generalizes the given geometry by removing vertices, based on the DouglasPeucker algorithm. Point and Multipoint geometries cannot be generalized. Parameters:
geometry
 geometry to generalizemaxDeviation
 the maximum distance that the generalized geometry can deviate from the original, in the same units as the geometry's spatial reference systemremoveDegenerateParts
 if true, degenerate parts of the resulting geometry that are undesired for drawing will be removed Returns:
 geometry that represents the generalization of the input geometry
 Throws:
java.lang.IllegalArgumentException
 if geometry is null Since:
 100.0.0

intersection
public static Geometry intersection(Geometry geometry1, Geometry geometry2)
Calculates the intersection of two geometries.The result has the same dimensionality as the lower dimensionality of the two intersecting geometries. Returns an empty geometry if there is no intersection with this dimensionality. For example, the intersection of two polygons (geometries with area, so they have dimensionality of 2) or, say, a polygon and an envelope (also an area) is a polygon. Similarly, the intersection of a polyline (a line, so dimensionality of 1) and another polyline is always a polyline. Therefore when computing the intersection of polylines, this function does not return points where they cross, but rather lines of overlap. If there are no lines of overlap, an empty polyline is returned even if the input lines cross. To obtain all intersections, irrespective of dimensionality, see
intersections(Geometry, Geometry)
. Parameters:
geometry1
 first geometrygeometry2
 second geometry Returns:
 geometry object that represents the intersection of the given geometries
 Throws:
java.lang.NullPointerException
 if geometry1 or geometry2 is nullArcGISRuntimeException
 if the spatial references of the input geometries are inconsistent or null Since:
 100.0.0

intersections
public static java.util.List<Geometry> intersections(Geometry geometry1, Geometry geometry2)
Calculates the intersections of two geometries.The returned list contains one geometry of each dimension for which there are intersections. For example, if both inputs are polylines, the list will contain at most two geometries: the first a multipoint containing the points at which the lines cross, and the second a polyline containing the lines of overlap. If a crossing point lies within a line of overlap, only the line of overlap is present  the result set is not selfintersecting. If there are no crossing points or there are no lines of overlap, the respective geometry will not be present in the list. If the input geometries do not intersect, the list will be empty. The table below shows, for each combination of pairs of input geometry types, the types of geometry that will be contained within the list if there are intersections of that type.
Set of potential output geometry types for pairs of input geometry types: Input type Point/Multipoint Polyline Polygon/Envelope Point/Multipoint Multipoint Multipoint Multipoint Polyline Multipoint Multipoint, Polyline Multipoint, Polyline Polygon/Envelope Multipoint Multipoint, Polyline Multipoint, Polyline, Polygon The geometries in the returned list are sorted by ascending dimensionality, for example multipoint (dimension 0) then polyline (dimension 1) then polygon (dimension 2) for the intersection of two geometries with area that have intersections of those types.
 Parameters:
geometry1
 first geometrygeometry2
 second geometry Returns:
 an unmodifiable list containing geometry objects that represent the intersection of the given geometries
 Throws:
java.lang.IllegalArgumentException
 if geometry1 or geometry2 is nullArcGISRuntimeException
 if the spatial references of the input geometries are inconsistent or null Since:
 100.1.0

intersects
public static boolean intersects(Geometry geometry1, Geometry geometry2)
Tests if two geometries intersect. Parameters:
geometry1
 first geometrygeometry2
 second geometry Returns:
 true if the two geometries intersect, false otherwise
 Throws:
java.lang.NullPointerException
 if geometry1 or geometry2 is nullArcGISRuntimeException
 if the spatial references of the input geometries are inconsistent or null Since:
 100.0.0

labelPoint
public static Point labelPoint(Polygon polygon)
Calculates an interior point for the given polygon. This point can be used by clients to place a label for the polygon. Parameters:
polygon
 polygon to calculate the interior point of Returns:
 a point that represents the interior point for the given polygon
 Throws:
java.lang.IllegalArgumentException
 if polygon is null Since:
 100.0.0

length
public static double length(Polyline polyline)
Calculates the length of the given polyline. This is a planar measurement using 2D Cartesian mathematics to compute the length. UselengthGeodetic(Geometry, LinearUnit, GeodeticCurveType)
for geodetic measurement.This length calculation is based upon the
SpatialReference
of the input geometry. Although some projections are better than others for preserving distance, it will always be distorted in some areas of the map. Distortion may be negligible for large scale maps (small areas) that use a suitable map projection. Make sure you know your data and spatial reference if accurate measurements are required. For more accurate results, consider using thelengthGeodetic(Geometry, LinearUnit, GeodeticCurveType)
operation. Parameters:
polyline
 polyline to calculate the length of Returns:
 the length of the given geometry in the same units as the polyline's spatial reference
 Throws:
java.lang.NullPointerException
 if polyline is null Since:
 100.0.0

lengthGeodetic
public static double lengthGeodetic(Geometry geometry, LinearUnit lengthUnit, GeodeticCurveType curveType)
Calculates the geodetic length of the geometry. Geodesic length is calculated using only the vertices of the geometry and defines the lines between vertices as geodesic segments independent of the actual shape of the geometry. A geodesic segment is the shortest path between two points on an ellipsoid. Parameters:
geometry
 geometry to calculate the geodetic length oflengthUnit
 unit of measure for the return value. If null, defaults to linear unit of IdLinearUnitId.METERS
.curveType
 geodetic curve type to calculate the length Returns:
 the geodetic length of the given geometry
 Throws:
java.lang.IllegalArgumentException
 if geometry or curveType is nullArcGISRuntimeException
 if the spatial reference of geometry is null Since:
 100.0.0

nearestCoordinate
public static ProximityResult nearestCoordinate(Geometry geometry, Point point)
Returns aProximityResult
that describes the nearest point in the input geometry to the input point.Input geometry of type
Envelope
is not supported. To find the nearest coordinate on anEnvelope
, convert it to aPolygon
first.If the specified geometry is a polyline or polygon, the nearest coordinate is the closest point on or along the line segment that comprises the geometry; it may not necessarily be the closest vertex of the line segment. If you want to obtain the closest vertex in the polyline or polygon use the
nearestVertex(Geometry, Point)
method instead. Parameters:
geometry
 geometry on which to find the nearest coordinate.Envelope
is not supportedpoint
 point to calculate the nearest coordinate from Returns:
 result containing the nearest coordinate
 Throws:
java.lang.IllegalArgumentException
 if geometry or point is nulljava.lang.IllegalArgumentException
 if geometry is of typeEnvelope
ArcGISRuntimeException
 if the spatial references of the input geometries are inconsistent or null Since:
 100.0.0

nearestVertex
public static ProximityResult nearestVertex(Geometry geometry, Point point)
Returns aProximityResult
that describes the nearest vertex in the input geometry to the input point.Input geometry of type
Envelope
is not supported. To find the nearest vertex on anEnvelope
, convert it to aPolygon
first.If the specified geometry is a polyline or polygon, the nearest vertex is the closest end point of the line segment that comprises the geometry; it may not necessarily be the closest point along the line segment. If you want to obtain the closest point in the polyline or polygon use the
nearestCoordinate(Geometry, Point)
method instead. Parameters:
geometry
 geometry on which to find the nearest vertex.Envelope
is not supportedpoint
 point to calculate the nearest vertex from Returns:
 result containing the nearest vertex
 Throws:
java.lang.IllegalArgumentException
 if geometry or point is nulljava.lang.IllegalArgumentException
 if geometry is of typeEnvelope
ArcGISRuntimeException
 if the spatial references of the input geometries are inconsistent or null Since:
 100.0.0

normalizeCentralMeridian
public static Geometry normalizeCentralMeridian(Geometry geometry)
Returns a copy of the input geometry that does not intersect the antimeridian. 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 may have multiple parts, in order to ensure each part does not intersect the antimeridian. 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
 the geometry to be normalized Returns:
 the normalized geometry
 Throws:
java.lang.NullPointerException
 if geometry is null Since:
 100.0.0

offset
public static Geometry offset(Geometry geometry, double distance, GeometryOffsetType offsetType, double bevelRatio, double flattenError)
Creates an offset version of the input geometry.The offset operation creates a geometry that is a constant distance from the input geometry. It is similar to buffering, but produces a one sided result. If offset distance is greater than 0, then the offset geometry is constructed to the right of the oriented input geometry, otherwise it is constructed to the left. For a simple polygon, the orientation of outer rings is clockwise and for inner rings it is counterclockwise. So the "right side" of a simple polygon is always its inside. The bevelRatio is multiplied by the offset distance and the result determines how far a mitered offset intersection can be from the input curve before it is beveled.
 Parameters:
geometry
 geometry to create the offset fromdistance
 offset distance for the geometry result. If distance is greater than 0, then the offset geometry is constructed to the right of the input geometry, otherwise it is constructed to the leftoffsetType
 offset type of the geometry resultbevelRatio
 the ratio used to produce a bevel join instead of a miter join (used only when the offset type isGeometryOffsetType.MITERED
)flattenError
 the maximum distance of the resulting segments compared to the true circular arc (used only when the offset type isGeometryOffsetType.ROUNDED
). The algorithm never produces more than around 180 vertices for each round join. Returns:
 an offset version of the input geometry
 Throws:
java.lang.IllegalArgumentException
 if geometry or offsetType is null Since:
 100.0.0

overlaps
public static boolean overlaps(Geometry geometry1, Geometry geometry2)
Tests if two geometries overlap. Parameters:
geometry1
 one of the two geometriesgeometry2
 the other geometry Returns:
 true if the two geometries overlap, false otherwise
 Throws:
java.lang.IllegalArgumentException
 ifgeometry1
orgeometry2
is nullArcGISRuntimeException
 if the spatial references of the input geometries are inconsistent or null Since:
 100.0.0

project
public static Geometry project(Geometry geometry, SpatialReference spatialReference)
Projects the given geometry from its current spatial reference system into the given spatial reference system, using the default geographic transformation.A default bestchoice
DatumTransformation
is applied to the project operation. You can use theTransformationCatalog.getTransformation(SpatialReference, SpatialReference)
method to find out which transformation is used by default for the given spatial references. To control the specific transformation used, use theproject(Geometry, SpatialReference, DatumTransformation)
overload.If the geometry parameter has zvalues, those zvalues will also be transformed, provided that both the
SpatialReference
of that geometry and thespatialReference
parameter have a vertical coordinate system. Parameters:
geometry
 input geometry to projectspatialReference
 the output spatial reference into which the geometry will be projected Returns:
 the geometry projected into the output spatial reference. If the input
geometry
has a nullSpatialReference
, no projection occurs; instead, this method returns an identical geometry that has the spatial reference specified by thespatialReference
parameter.  Throws:
java.lang.NullPointerException
 if geometry or spatialReference is null Since:
 100.0.0

project
public static Geometry project(Geometry geometry, SpatialReference spatialReference, DatumTransformation datumTransformation)
Projects the given geometry from its current spatial reference system into the given output spatial reference system, applying the datum transformation provided.Use this overload to project a geometry if the difference between the input geometry's
SpatialReference
and the outputSpatialReference
involves a change of datum, and you do not wish to use the default datum transformation used byproject(Geometry, SpatialReference)
.// Create a geometry located in London, UK, with British National Grid spatial reference Point britishNationalGridPt = new Point(538985.355, 177329.516, SpatialReference.create(27700)); // Create a GeographicTransformation with a single step using WKID for OSGB_1936_To_WGS_1984_NGA_7PAR transformation GeographicTransformation transform = GeographicTransformation.create(GeographicTransformationStep.create(108336)); // Project the point to WGS84, using the transformation Point wgs84Pt = (Point) GeometryEngine.project(britishNationalGridPt, SpatialReferences.getWgs84(), transform);
 Parameters:
geometry
 the input geometry to projectspatialReference
 the output spatial reference into which the geometry will be projecteddatumTransformation
 the datum transformation that describes how coordinates are converted from one coordinate system to another; if null, then the default transformation is used. Returns:
 the geometry projected into the output spatial reference. If the input
geometry
has a nullSpatialReference
no projection occurs; instead, this method returns an identical geometry that has the spatial reference specified by thespatialReference
parameter.  Throws:
java.lang.IllegalArgumentException
 if geometry or spatialReference is nullArcGISRuntimeException
 if the datumTransformation'sDatumTransformation.isMissingProjectionEngineFiles()
method returns true Since:
 100.2.0

relate
public static boolean relate(Geometry geometry1, Geometry geometry2, java.lang.String relation)
Compares the spatial relationship of two geometries. Can compare interior, boundary and exterior of two geometries based on a DE9IM encoded string. Parameters:
geometry1
 one of the two geometriesgeometry2
 the other geometryrelation
 the DE9IM string to be evaluated. Strings such as "T*****FF*" are accepted. Returns:
 true if the two geometries are related by the given relation, false otherwise
 Throws:
java.lang.IllegalArgumentException
 if geometry1 or geometry2 is nulljava.lang.IllegalArgumentException
 if relation is null or emptyArcGISRuntimeException
 if relation is not valid Since:
 100.0.0

removeM
public static Geometry removeM(Geometry geometry)
Creates a copy of a geometry with its mvalues removed. If the given geometry has no mvalues, the given geometry itself is returned. The resulting geometry will haveGeometry.hasM()
false. Parameters:
geometry
 the input geometry Returns:
 a copy of the input geometry with its mvalues removed, or the input geometry itself if it already has no mvalues
 Throws:
java.lang.IllegalArgumentException
 if geometry is null Since:
 100.1.0

removeZ
public static Geometry removeZ(Geometry geometry)
Creates a copy of a geometry with its zvalues removed. If the given geometry has no zvalues, the given geometry itself is returned. The resulting geometry will haveGeometry.hasZ()
false. Parameters:
geometry
 the input geometry Returns:
 a copy of the input geometry with its zvalues removed, or the input geometry itself if it already has no zvalues
 Throws:
java.lang.IllegalArgumentException
 if geometry is null Since:
 100.1.0

removeZAndM
public static Geometry removeZAndM(Geometry geometry)
Creates a copy of a geometry with its z and mvalues removed. If the given geometry has no z or mvalues, the given geometry itself is returned. The resulting geometry will haveGeometry.hasZ()
andGeometry.hasM()
false. Parameters:
geometry
 the input geometry Returns:
 a copy of the input geometry with its z and mvalues removed, or the input geometry itself if it already has no z or mvalues
 Throws:
java.lang.IllegalArgumentException
 if geometry is null Since:
 100.1.0

reshape
public static Multipart reshape(Multipart geometry, Polyline reshaper)
Reshapes a polygon or polyline using a single path polyline as thereshaper
. The output geometry takes the shape of the input geometry where it first intersects thereshaper
to the last intersection. The first and last intersection points of thereshaper
are chosen closest to the end points of thereshaper
in the case that multiple intersections are found. For polygons, only individual paths can be reshaped. However, polylines can be reshaped across paths. Parameters:
geometry
 the polygon or polyline to be reshapedreshaper
 the single path polyline reshaper Returns:
 the reshaped polygon or polyline, or null if the input geometry cannot be reshaped by the reshaper
 Throws:
java.lang.IllegalArgumentException
 if geometry or reshaper is null Since:
 100.1.0

sectorGeodesic
public static Geometry sectorGeodesic(GeodesicSectorParameters parameters)
Creates a sector as a polygon, polyline or multipoint geometry. A geodesic sector is defined by a geodesic elliptical arc and two radii extending from the center point of the arc to the points where they each intersect the arc. The arc is a portion of an ellipse. The ellipse is defined by a center point, the lengths of its semimajor and semiminor axes, and the direction of its semimajor axis. The first radius of the sector is defined by the start direction angle relative to the direction of the semimajor axis. The second radius is the sum of the start direction and the sector angle. Parameters:
parameters
 options for constructing the sector Returns:
 a geometry representing the geodesic sector
 Throws:
java.lang.IllegalArgumentException
 if parameters is nulljava.lang.IllegalArgumentException
 if theGeodesicEllipseParameters.getGeometryType()
is not one ofGeometryType.MULTIPOINT
,GeometryType.POLYLINE
,GeometryType.POLYGON
ArcGISRuntimeException
 if parameters is not valid Since:
 100.0.0

setM
public static Geometry setM(Geometry geometry, double m)
Creates a copy of a geometry with its mvalues set to the given value. If the given geometry already has mvalues, they will be replaced within the resulting geometry by the given mvalue. The resulting geometry will haveGeometry.hasM()
true. Parameters:
geometry
 the input geometrym
 the mvalue to set Returns:
 a copy of the input geometry with its mvalues set to the given value
 Throws:
java.lang.IllegalArgumentException
 if geometry is null Since:
 100.1.0

setZ
public static Geometry setZ(Geometry geometry, double z)
Creates a copy of a geometry with its zvalues set to the given value. If the given geometry already has zvalues, they will be replaced within the resulting geometry by the given zvalue. The resulting geometry will haveGeometry.hasZ()
true. Parameters:
geometry
 the input geometryz
 the zvalue to set Returns:
 a copy of the input geometry with its zvalues set to the given value
 Throws:
java.lang.IllegalArgumentException
 if geometry is null Since:
 100.1.0

setZAndM
public static Geometry setZAndM(Geometry geometry, double z, double m)
Creates a copy of a geometry with its z and mvalues set to the given values. If the given geometry already has z or mvalues, they will be replaced within the resulting geometry by the given values. The resulting geometry will haveGeometry.hasZ()
andGeometry.hasM()
true. Parameters:
geometry
 the input geometryz
 the zvalue to setm
 the mvalue to set Returns:
 a copy of the input geometry with its z and mvalues set to the given values
 Throws:
java.lang.IllegalArgumentException
 if geometry is null Since:
 100.1.0

simplify
public static Geometry simplify(Geometry geometry)
Simplifies the given geometry to make it topologically consistent according to its geometry type. For instance, it rectifies polygons that may be selfintersecting, or contain incorrect ring orientations.Many of the methods in the geometry engine only work on geometry that is simple, and only simple geometries can be stored in a geodatabase.
 Parameters:
geometry
 geometry to simplify Returns:
 simplified geometry
 Throws:
java.lang.NullPointerException
 if geometry is null Since:
 100.0.0

symmetricDifference
public static Geometry symmetricDifference(Geometry geometry1, Geometry geometry2)
Calculates the symmetric difference (exclusive or) of the two geometries. Parameters:
geometry1
 one of the two geometriesgeometry2
 the other geometry Returns:
 the symmetric difference of the two geometries
 Throws:
java.lang.IllegalArgumentException
 if geometry1 or geometry2 is nullArcGISRuntimeException
 if the spatial references of the input geometries are inconsistent or null Since:
 100.0.0

touches
public static boolean touches(Geometry geometry1, Geometry geometry2)
Test if the two geometries touch on their borders. Parameters:
geometry1
 does this geometry touch geometry2?geometry2
 does this geometry touch geometry1? Returns:
 true if the two geometries have at least one boundary point in common, but no interior points. False otherwise.
 Throws:
java.lang.NullPointerException
 if geometry1 or geometry2 is nullArcGISRuntimeException
 if the spatial references of the input geometries are inconsistent or null Since:
 100.0.0

union
public static Geometry union(Geometry geometry1, Geometry geometry2)
Calculates the union of the two geometries.Returns those parts of the two input geometries which overlap, combined into a single geometry. This means that the order of the input parameters of the GeometryEngine.Intersection is irrelevant. Think of the union equation as:
A (Union) B = C
B (Union) A = C
 Parameters:
geometry1
 first geometrygeometry2
 second geometry Returns:
 the union of the two geometries
 Throws:
java.lang.NullPointerException
 if geometry1 or geometry2 is nullArcGISRuntimeException
 if the spatial references of the input geometries are inconsistent or null Since:
 100.0.0

union
public static Geometry union(java.lang.Iterable<Geometry> geometries)
Calculates the union of a collection of geometries.If the collection contains geometries of differing dimensionality, returns the union of the subset of geometries with the highest dimensionality. For example, given a collection of polygons, polylines and points, returns the union of the polygons.
The input geometries must have consistent spatial references.
 Parameters:
geometries
 the input geometries Returns:
 the union of the input geometries
 Throws:
java.lang.IllegalArgumentException
 if geometries is null or emptyArcGISRuntimeException
 if the spatial references of the input geometries are inconsistent Since:
 100.1.0

within
public static boolean within(Geometry within, Geometry container)
Tests ifwithin
is withincontainer
. Parameters:
within
 geometry that is tested for the "within" relationship tocontainer
container
 geometry that is tested for the "contains" relationship towithin
 Returns:
 true if
within
lies in the interior of thecontainer
, false otherwise. The boundary and interior ofwithin
is not allowed to intersect the exterior of thecontainer
andwithin
may not equal thecontainer
.  Throws:
java.lang.NullPointerException
 if within or container is nullArcGISRuntimeException
 if the spatial references of the input geometries are inconsistent or null Since:
 100.0.0

clip
public static Geometry clip(Geometry geometry, Envelope envelope)
Returns a geometry created by clipping the given Geometry with the given Envelope. If no part of the Geometry lies within the Envelope, then the returned Geometry will be empty. Parameters:
geometry
 the geometry to be clipped by the given envelopeenvelope
 the extent at which to clip the given geometry Returns:
 the clipped geometry
 Throws:
java.lang.IllegalArgumentException
 if geometry or envelope is nullArcGISRuntimeException
 if geometry and envelope arguments have different spatial references Since:
 100.0.0
 See Also:
intersection(Geometry, Geometry)

isSimple
public static boolean isSimple(Geometry geometry)
Indicates if this Geometry is topologically simple (in other words, is topologically correct).Point geometries are always simple.
Multipoint geometries cannot have any points with exactly equal x and y values.
Polylines can have no degenerate segments.
For Polygons, the following must be true for the polygon to be considered simple:
 Exterior rings must be clockwise, and holes must be counterclockwise.
 Rings can touch other rings only at a finite number of vertices.
 Rings can be self tangent only at a finite number of vertices.
 Segments with a length less than zero are not allowed.
 Each path must contain at least three noncoincident vertices.
 Paths must not be empty.
 Parameters:
geometry
 the geometry to be tested if it is simple Returns:
 true if the provided geometry is simple, false otherwise
 Throws:
java.lang.IllegalArgumentException
 if the geometry is null Since:
 100.0.0

createPointAlong
public static Point createPointAlong(Polyline polyline, double distance)
Calculates the point at a given distance along a line.If the distance is less than or equal to zero, the point returned is coincident with the start of the line. If the distance is greater than or equal to the line's length, the point returned is coincident with the end of the line. If the line has multiple parts (notes: the gap does not count as part of line, it is ignored), and the distance falls exactly on a boundary between two parts, the returned point will be coincident with either the end of one part or the start of the next – which is undetermined.
As an example to illustrate the returned point you expect to obtain, suppose that you have a polyline with two parts, one is from [0, 0] to [10, 0], the other from [30, 0] to [50, 0], here is the table for the returned point at a given distance:
Distance Point returned Comments 0 [0, 0] Start of part 0 5 [5, 0] Midpoint of part 0 10 [10, 0] End of part 0 10 [30, 0] OR start of part 1 20 [40, 0] Midpoint of part 1 30 [50, 0] end of part 1  Parameters:
polyline
 the polyline from which the point is createddistance
 the distance along the polyline, in the units of the polyline, where to create the point Returns:
 the point at the given distance along the line
 Throws:
java.lang.IllegalArgumentException
 if polyline is null Since:
 100.3.0

