Geometry service Simplify method

The Simplify method generates topologically correct geometry by removing extraneous bends while preserving essential shape.

Simplify(SpatialReference SpatialReference, Geometry[] InGeometryArray)

Parameter

Description

SpatialReference

The SpatialReference of the geometries in InGeometryArray. Cannot be null.

InGeometryArray

The array of Geometry to be simplified. All geometries are assumed to be in the coordinate system defined by the SpatialReference parameter.

Return Value

An array of Geometry (Geometry[]).

Remarks

Input geometry can be points, multipoints, polylines, or polygons. Geometry that cannot be simplifed are replaced with empty geometries of the same type. This operation uses the coordinate grid and the xy and z cluster tolerances of the spatial reference. For more information on these properties and how they can affect your coordinates, please refer to the Esri whitepaper, Understanding Coordinate Management in the geodatabase.

Simplify alters the input geometry making its definition "topologically legal" with respect to its geometry type:

This operation uses the xy cluster tolerance of the associated spatial reference to determine when two vertices are the same, or when a vertex needs to be snapped to a line. This specific approach is subject to change in future releases of Esri software.

At the end of Simplify, no rings will overlap, no self intersection will occur (except in certain circumstances) and, in general, an arbitrary point can always be classified unambiguously as either outside, on the boundary of, or inside the polygon. All exterior rings are oriented clockwise. All interior rings (i.e. holes) are counter-clockwise.

Linework input to the polygon simplify operation.
Linework input to the polygon simplify operation.
Polygon created via the simplify operation. Two outer rings have been created.
Polygon created via the simplify operation. Two outer rings have been created.

Examples

C#

Geometry_GeometryServer geometryService = new Geometry_GeometryServer();

geometryService.Url = "http://localhost:6080/arcgis/services/Geometry/GeometryServer";

 

SpatialReference inputSpatialReference = geometryService.FindSRByWKID("EPSG", 4326, -1, true, true);

 

// Ring 1

PointN pnt1a = new PointN();

pnt1a.X = 10.0;

pnt1a.Y = 30.0;

PointN pnt2a = new PointN();

pnt2a.X = 10.0;

pnt2a.Y = 45.0;

PointN pnt3a = new PointN();

pnt3a.X = 25.0;

pnt3a.Y = 45.0;

PointN pnt4a = new PointN();

pnt4a.X = 25.0;

pnt4a.Y = 30.0;

PointN pnt5a = new PointN();

pnt5a.X = 10.0;

pnt5a.Y = 30.0;

 

PointN[] pnts1a = new PointN[] { pnt1a, pnt2a, pnt3a, pnt4a, pnt5a };

Ring ring1 = new Ring();

ring1.PointArray = pnts1a;

 

// Ring 2

PointN pnt1b = new PointN();

pnt1b.X = 15.0;

pnt1b.Y = 35.0;

PointN pnt2b = new PointN();

pnt2b.X = 15.0;

pnt2b.Y = 50.0;

PointN pnt3b = new PointN();

pnt3b.X = 30.0;

pnt3b.Y = 50.0;

PointN pnt4b = new PointN();

pnt4b.X = 30.0;

pnt4b.Y = 35.0;

PointN pnt5b = new PointN();

pnt5b.X = 15.0;

pnt5b.Y = 35.0;

 

PointN[] pnts1b = new PointN[] { pnt1b, pnt2b, pnt3b, pnt4b, pnt5b };

Ring ring2 = new Ring();

ring2.PointArray = pnts1b;

 

// Multipart Polygon (2 overlapping rings)

Ring[] rings = new Ring[] { ring1, ring2 };

PolygonN polygon1 = new PolygonN();

polygon1.RingArray = rings;

 

Geometry[] geometryArray = new Geometry[] { polygon1 };

 

// Overlapping section removed

Geometry[] simplifiedGeometry = geometryService.Simplify(inputSpatialReference, geometryArray);

VB.NET

Dim geomeTryService As Geometry_GeometryServer = New Geometry_GeometryServer()

geomeTryService.Url = "http://localhost:6080/arcgis/services/Geometry/GeometryServer"

 

Dim inputSpatialReference As SpatialReference = geomeTryService.FindSRByWKID("EPSG", 4326, -1, True, True)

 

' Ring 1

Dim pnt1a As PointN = New PointN()

pnt1a.X = 10.0

pnt1a.Y = 30.0

 

Dim pnt2a As PointN = New PointN()

pnt2a.X = 10.0

pnt2a.Y = 45.0

 

Dim pnt3a As PointN = New PointN()

pnt3a.X = 25.0

pnt3a.Y = 45.0

 

Dim pnt4a As PointN = New PointN()

pnt4a.X = 25.0

pnt4a.Y = 30.0

 

Dim pnt5a As PointN = New PointN()

pnt5a.X = 10.0

pnt5a.Y = 30.0

 

Dim pnts1a() As PointN = New PointN() {pnt1a, pnt2a, pnt3a, pnt4a, pnt5a}

Dim ring1 As Ring = New Ring()

ring1.PointArray = pnts1a

 

' Ring 2

Dim pnt1b As PointN = New PointN()

pnt1b.X = 15.0

pnt1b.Y = 35.0

 

Dim pnt2b As PointN = New PointN()

pnt2b.X = 15.0

pnt2b.Y = 50.0

 

Dim pnt3b As PointN = New PointN()

pnt3b.X = 30.0

pnt3b.Y = 50.0

 

Dim pnt4b As PointN = New PointN()

pnt4b.X = 30.0

pnt4b.Y = 35.0

 

Dim pnt5b As PointN = New PointN()

pnt5b.X = 15.0

pnt5b.Y = 35.0

 

Dim pnts1b() As PointN = New PointN() {pnt1b, pnt2b, pnt3b, pnt4b, pnt5b}

Dim ring2 As Ring = New Ring()

ring2.PointArray = pnts1b

 

' Multipart Polygon (2 overlapping rings)

Dim rings() As Ring = New Ring() {ring1, ring2}

Dim polygon1 As PolygonN = New PolygonN()

polygon1.RingArray = rings

Dim geomeTryArray() As Geometry = New Geometry() {polygon1}

 

' Overlapping section removed

Dim simplifiedGeomeTry() As Geometry = geomeTryService.Simplify(inputSpatialReference, geomeTryArray)

Java

String serviceURL = "http://localhost:6080/arcgis/services/Geometry/GeometryServer";

GeometryServerBindingStub geometryService = new GeometryServerBindingStub(serviceURL);

 

SpatialReference inputSpatialReference = geometryService.findSRByWKID(

      "EPSG", 4326, -1, true, true);

 

//Ring 1

PointN pnt1a = new PointN();

pnt1a.setX(10.0);

pnt1a.setY(30.0);

 

PointN pnt2a = new PointN();

pnt2a.setX(10.0);

pnt2a.setY(45.0);

 

PointN pnt3a = new PointN();

pnt3a.setX(25.0);

pnt3a.setY(45.0);

 

PointN pnt4a = new PointN();

pnt4a.setX(25.0);

pnt4a.setY(30.0);

 

PointN pnt5a = new PointN();

pnt5a.setX(10.0);

pnt5a.setY(30.0);

 

PointN[] pnts1a = new PointN[] { pnt1a, pnt2a, pnt3a, pnt4a, pnt5a };

 

Ring ring1 = new Ring();

ring1.setPointArray(pnts1a);

 

//Ring 2

PointN pnt1b = new PointN();

pnt1b.setX(15.0);

pnt1b.setY(35.0);

 

PointN pnt2b = new PointN();

pnt2b.setX(15.0);

pnt2b.setY(50.0);

 

PointN pnt3b = new PointN();

pnt3b.setX(30.0);

pnt3b.setY(50.0);

 

PointN pnt4b = new PointN();

pnt4b.setX(30.0);

pnt4b.setY(35.0);

 

PointN pnt5b = new PointN();

pnt5b.setX(15.0);

pnt5b.setY(35.0);

 

PointN[] pnts1b = new PointN[] { pnt1b, pnt2b, pnt3b, pnt4b, pnt5b };

Ring ring2 = new Ring();

ring2.setPointArray(pnts1b);

 

//Multipart Polygon (2 overlapping rings)

Ring[] rings = new Ring[] { ring1, ring2 };

PolygonN polygon1 = new PolygonN();

polygon1.setRingArray(rings);

 

Geometry[] geometryArray = new Geometry[] { polygon1 };

 

//Overlapping section removed

Geometry[] simplifiedGeometries = geometryService.simplify(inputSpatialReference, geometryArray);

 

for (Geometry geom : simplifiedGeometries) {

      PolygonN polygon = (PolygonN) geom;

      EnvelopeN extent = (EnvelopeN) polygon.getExtent();

      System.out.println("Extent - XMin,YMin: " + extent.getXMin() + "," + extent.getYMin() + " XMax,YMax: " + extent.getXMax() + "," + extent.getYMax());

}

2/28/2020