Interface IGeometryServer2
Provides access to more standard operations on geometric 'value' objects. The input geometries are never modified by these operations. Designed for use in building web services or other kinds of distributed applications.
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
[Guid("F3B51E61-2B28-4033-9615-D93A76171A85")]
public interface IGeometryServer2 : IGeometryServer
Methods
AutoComplete(ISpatialReference, IPolygonArray, IPolylineArray)
Discovers polygons bounded by existing polygons and input linework.
IPolygonArray AutoComplete(ISpatialReference pSR, IPolygonArray pInPolygons, IPolylineArray pCompletionLines)
Parameters
pSRISpatialReferencepInPolygonsIPolygonArraypCompletionLinesIPolylineArray
Returns
Buffer(ISpatialReference, ISpatialReference, ISpatialReference, IDoubleArray, IUnit, bool, IGeometryArray)
IGeometryArray Buffer(ISpatialReference pInSR, ISpatialReference pBufferSR, ISpatialReference pOutSR, IDoubleArray pDistances, IUnit pUnit, bool bUnion, IGeometryArray pInGeometries)
Parameters
pInSRISpatialReferencepBufferSRISpatialReferencepOutSRISpatialReferencepDistancesIDoubleArraypUnitIUnitbUnionboolpInGeometriesIGeometryArray
Returns
ConvexHull(ISpatialReference, IGeometryArray)
Computes the convex hull of the input geometries
IGeometry ConvexHull(ISpatialReference pSR, IGeometryArray pInGeometryArray)
Parameters
pSRISpatialReferencepInGeometryArrayIGeometryArray
Returns
Remarks
The convex hull of a set of points, polylines and polygons is shown below. If all the inputs are collinear, than a polyline will be returned instead of a polygon. If all inputs are located at a single point, then that point will be returned.

Cut(ISpatialReference, IGeometryArray, IPolyline, out ILongArray)
Cuts the target polyline or polygon Cutter.
IGeometryArray Cut(ISpatialReference pSR, IGeometryArray pTargets, IPolyline pCutter, out ILongArray ppCutIndexes)
Parameters
pSRISpatialReferencepTargetsIGeometryArraypCutterIPolylineppCutIndexesILongArray
Returns
Remarks
The target of the cut operation may be either a polyline or a polygon.
When it is a polyline, it is split where it intersects the cutter polyline. Each piece is classified as ‘left of’ or ‘right of’ the cutter. This classification is based on the orientation of the cutter line. The left pieces are returned in the first element of the output array and the right pieces are returned in the second element. Parts of the target polyline that do not intersect the cutting polyline are discarded. Figure below shows an example. The orientation of the cutter line is indicated with a red arrowhead. Notice that a polyline part is also cut when the cutter line just touches it (as opposed to crossing it). The lower right input part was not included in the output because it did not intersect the cutting line. The cutting line can also have multiple parts. The left/right decision is made per part.

The next figure shows an example of a cutting operation with a multipart cutting polyline. The orientation of each cutting part is shown with a red arrowhead. The ‘left’ result has been requested and is shown in the right box of the figure.

When the target is a polygon, the left/right classification it not done. The polygon pieces are returned in order of ascending area. In the figure below, the first cut part returned is to the right of the oriented cutting line, but it has the smallest area. Input parts that do not intersect the cutting line are discarded. The cutting line can be multi-part. See figure below.

Densify(ISpatialReference, IGeometryArray, double, bool, double)
IGeometryArray Densify(ISpatialReference pSR, IGeometryArray pInGeometries, double maxSegmentLength, bool useDeviationDensification, double densificationParameter)
Parameters
pSRISpatialReferencepInGeometriesIGeometryArraymaxSegmentLengthdoubleuseDeviationDensificationbooldensificationParameterdouble
Returns
DensifyGeodesic(ISpatialReference, IGeometryArray, double, ILinearUnit)
Densifies geometries by plotting points along the geodesics between existing vertices (uses IPolycurve4::GeodesicDensify).
IGeometryArray DensifyGeodesic(ISpatialReference pSR, IGeometryArray pInGeometries, double maxSegmentLength, ILinearUnit pLengthUnit)
Parameters
pSRISpatialReferencepInGeometriesIGeometryArraymaxSegmentLengthdoublepLengthUnitILinearUnit
Returns
Remarks
Densifies each polyline or polygon in the input array by plotting points along the geodesic paths between existing vertices. MaxSegmentLength is expressed in some linear unit of measure. If the LengthUnit parameter is specified, then MaxSegmentLength is expressed in those units. If the LengthUnit parameter is not specified, then MaxSegmentLength is expressed in the the linear units of the input spatial reference, if the spatial reference is a projected coordinate system. Otherwise, it is assumed to be expressed in meters.
If the spatial reference is a projected coordinate system, then the input geometries will be inversed projected, geodesic path points will be plotted, and the result will be forward projected into the same spatial reference.
The figure below illustrates the DensifyGeodesic operation applied to a polyline with 3 vertices, with a max output segment length of 10,000 meters.

Difference(ISpatialReference, IGeometryArray, IGeometry)
Returns an array of geometries where each result geometry R[i] is (array1[i] difference G2).
IGeometryArray Difference(ISpatialReference pSR, IGeometryArray pInGA1, IGeometry pInG2)
Parameters
pSRISpatialReferencepInGA1IGeometryArraypInG2IGeometry
Returns
Remarks
This operation constructs the set-theoretic difference between each element of the input array and InGeometry2. Each result is placed at the corresponding index in the output array – that is, Result[i] = InGeometryArray1[i] Difference InGeometry2. The only restriction on combinations of geometry types is that the dimension of InGeometry2 must be equal to or greater than the dimensions of the elements of InGeometryArray1. Any inputs that are completely within InGeometry2 are represented by empty geometries of the same type in the output array.
The figure below shows an example of the difference operation. The geometry array contains all geometries shown with the exception of the central circular polygon. The output array contains the modified geometries shown in the right part of the figure. Note that one of the output points will be “empty” because the corresponding input is inside the circular polygon.

FindSRByWKID(string, int, int, bool, bool)
ISpatialReference FindSRByWKID(string authority, int wkid, int WKID_Z, bool bDefaultXYResolution, bool bDefaultXYTolerance)
Parameters
Returns
FindSRByWKT(string, string, bool, bool)
ISpatialReference FindSRByWKT(string wkt, string WKT_Z, bool bDefaultXYResolution, bool bDefaultXYTolerance)
Parameters
Returns
FindUnitsByWKID(string, int)
IUnit FindUnitsByWKID(string authority, int wkid)
Parameters
Returns
FindUnitsByWKT(string)
IUnit FindUnitsByWKT(string wkt)
Parameters
wktstring
Returns
Generalize(ISpatialReference, IGeometryArray, double, ILinearUnit)
Returns generalized (Douglas-Peucker) versions of the input polylines and polygons (uses IPolycurve::Generalize).
IGeometryArray Generalize(ISpatialReference pSR, IGeometryArray pInGA, double maxDeviation, ILinearUnit pDeviationUnit)
Parameters
pSRISpatialReferencepInGAIGeometryArraymaxDeviationdoublepDeviationUnitILinearUnit
Returns
Remarks
The Generalize operation applies Douglas-poiker line generalization to each element of the input array. The results are placed in corresponding indexes of the output array. If DeviationUnit is specified, then MaxDeviation is expressed in those units, otherwise it is expressed in the units of the spatial reference.
GetAreasAndLengths(ISpatialReference, IPolygonArray, out IDoubleArray, out IDoubleArray)
void GetAreasAndLengths(ISpatialReference pSR, IPolygonArray pInPolygons, out IDoubleArray ppAreas, out IDoubleArray ppLengths)
Parameters
pSRISpatialReferencepInPolygonsIPolygonArrayppAreasIDoubleArrayppLengthsIDoubleArray
GetAreasAndLengths2(ISpatialReference, IPolygonArray, ILinearUnit, ILinearUnit, esriAreaUnits, out IDoubleArray, out IDoubleArray)
Calculates areas and perimeter lengths for each polygon in the specified array. Optionally does unit conversion.
void GetAreasAndLengths2(ISpatialReference pSR, IPolygonArray pInPolygons, ILinearUnit pLengthUnit, ILinearUnit pAreaUnit, esriAreaUnits areaUnitEnum, out IDoubleArray ppAreas, out IDoubleArray ppLengths)
Parameters
pSRISpatialReferencepInPolygonsIPolygonArraypLengthUnitILinearUnitpAreaUnitILinearUnitareaUnitEnumesriAreaUnitsppAreasIDoubleArrayppLengthsIDoubleArray
Remarks
The area and length values are computed in the units specified as input parameters, if they are present, otherwise they are computed in the units of the spatial reference. It is not recommended that this method be used on geometries having latitude-longitude coordinates. You can use the GetLengthsGeodesic method to compute accurate lengths for polylines with latitude-longitude coordinates.
GetDistance(ISpatialReference, IGeometry, IGeometry, ILinearUnit)
Reports shortest distance between G1 and G2.
double GetDistance(ISpatialReference pSR, IGeometry pG1, IGeometry pG2, ILinearUnit pDistanceUnit)
Parameters
pSRISpatialReferencepG1IGeometrypG2IGeometrypDistanceUnitILinearUnit
Returns
Remarks
The distance value is computed in the specified linear units, if present, or in the units of the spatial reference. It is not recommended that this method be used on geometries with lat-long coordinates. Use GetDistanceGeodesic instead.
GetDistanceGeodesic(ISpatialReference, IGeometry, IGeometry, ILinearUnit)
Reports the shortest geodesic distance between G1 and G2.
double GetDistanceGeodesic(ISpatialReference pSR, IGeometry pG1, IGeometry pG2, ILinearUnit pDistanceUnit)
Parameters
pSRISpatialReferencepG1IGeometrypG2IGeometrypDistanceUnitILinearUnit
Returns
Remarks
The distance value is computed in the specified linear units, if present, or in the units of the spatial reference. If SpatialReference is a projected coordinate system, the input geometries will first be inverse projected and then shortest geodesic distance will be computed on the latitude-longitude coordinates.
GetLabelPoints(ISpatialReference, IPolygonArray)
IPointArray GetLabelPoints(ISpatialReference pSR, IPolygonArray pInPolygons)
Parameters
pSRISpatialReferencepInPolygonsIPolygonArray
Returns
GetLengths(ISpatialReference, IPolylineArray)
IDoubleArray GetLengths(ISpatialReference pSR, IPolylineArray pInPolylines)
Parameters
pSRISpatialReferencepInPolylinesIPolylineArray
Returns
GetLengths2(ISpatialReference, IPolylineArray, ILinearUnit)
Calculates the length of eacch polyline in the specified array. Optionally does unit conversion.
IDoubleArray GetLengths2(ISpatialReference pSR, IPolylineArray pInPolylines, ILinearUnit pLengthUnit)
Parameters
pSRISpatialReferencepInPolylinesIPolylineArraypLengthUnitILinearUnit
Returns
Remarks
The length values are computed in the specified linear units, if present, or in the units of the spatial reference. It is not recommended that this method be used on geometries having latitude-longitude coordinates, since the length would then be calculated in units of "degrees". You can use the GetLengthsGeodesic method to compute accurate lengths for polylines with latitude-longitude coordinates.
GetLengthsGeodesic(ISpatialReference, IPolylineArray, ILinearUnit)
Returns geodesic length of each Polyline.
IDoubleArray GetLengthsGeodesic(ISpatialReference pSR, IPolylineArray polylines, ILinearUnit pLengthUnit)
Parameters
pSRISpatialReferencepolylinesIPolylineArraypLengthUnitILinearUnit
Returns
Remarks
The returned lengths are expressed in the specified linear units, if present, or in the units of the spatial reference. If LengthUnit is not specified and the input spatial reference is a geographic coordinate system, then the lengths are expressed in meters. This method calculates the ellipsoidal shortest path distance between each pair of the vertices in the polylines.
The spatial reference can be a projected or a geographic coordinate system. If the former, then the geometries are first inverse projected into its associated geographic coordinate system and then the distance calculations are performed.
Intersect(ISpatialReference, IGeometryArray, IGeometry)
Returns an array of geometries where each result geometry R[i] is (array1[i] intersect G2. If G2 is an Envelope, then this is clipping.
IGeometryArray Intersect(ISpatialReference pSR, IGeometryArray pInGA1, IGeometry pInG2)
Parameters
pSRISpatialReferencepInGA1IGeometryArraypInG2IGeometry
Returns
Remarks
This operation constructs the set-theoretic intersection between each element of the input array and InGeometry2. Each result is placed at the corresponding index in the output array – that is, Result[i] = InGeometryArray1[i] Intersect InGeometry2. If inGeometryArray1[i] and InGeometry2 disjoint, the output is an empty geometry of the type with the minimum dimension between inGeometryArray1[i] and InGeometry2.
The figure below shows an example of the intersect operation. The input geometry array contains all geometries shown on the left of the figure with the exception of the central circular polygon. The output array contains the modified geometries shown in the right part of the figure. Note that two of the output points will be “empty” because their corresponding inputs are outside the circular polygon.

Offset(ISpatialReference, IGeometryArray, double, ILinearUnit, int, double)
Returns an array of polylines and polygons that are offset versions of the input polylines and polygons (uses ITopologicalOperator::ConstructOffset).
IGeometryArray Offset(ISpatialReference pSR, IGeometryArray pInGA, double offsetDistance, ILinearUnit pOffsetUnit, int offsetHow, double bevelRatio)
Parameters
pSRISpatialReferencepInGAIGeometryArrayoffsetDistancedoublepOffsetUnitILinearUnitoffsetHowintbevelRatiodouble
Returns
Remarks
The offset operation creates a geometry that is a constant distance from an input polyline or polygon. It is similar to buffering, but produces a one sided result. If offsetDistance > 0, then the offset geometry is constructed to the right of the oriented input geometry, otherwise it is constructed to the left. For a polygon, the orientation of outer rings is clockwise and for inner rings it is counter clockwise. So the “right side” of a polygon is always its inside.
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 or rounded. When esriGeometryOffsetMitered is specified, the input bevel ratio is ignored and 10 is used internally.When esriGeometryOffsetBevelled is specified, 1.1 will be used if bevelRatio is not specified.
The figures below show some examples of offsetting polylines. The red arrowhead shows the orientation of the input polyline.

Project(ISpatialReference, ISpatialReference, esriTransformDirection, ITransformation, IEnvelope, IGeometryArray)
IGeometryArray Project(ISpatialReference pInSR, ISpatialReference pOutSR, esriTransformDirection xFormDir, ITransformation pXForm, IEnvelope pExtent, IGeometryArray pInGeometries)
Parameters
pInSRISpatialReferencepOutSRISpatialReferencexFormDiresriTransformDirectionpXFormITransformationpExtentIEnvelopepInGeometriesIGeometryArray
Returns
Relation(ISpatialReference, IGeometryArray, IGeometryArray, esriSpatialRelationEnum, string)
IRelationResultArray Relation(ISpatialReference pSR, IGeometryArray pInGA1, IGeometryArray pInGA2, esriSpatialRelationEnum r, string param)
Parameters
pSRISpatialReferencepInGA1IGeometryArraypInGA2IGeometryArrayresriSpatialRelationEnumparamstring
Returns
Reshape(ISpatialReference, IGeometry, IPolyline)
Reshapes the target polyline or polygon. The reshaping polyline can have only one part. If the target was not reshaped, an empty geometry of the saem type is returned.
IGeometry Reshape(ISpatialReference pSR, IGeometry pTarget, IPolyline pReshaper)
Parameters
pSRISpatialReferencepTargetIGeometrypReshaperIPolyline
Returns
Remarks
Reshapes the target polyline or polygon. The reshaping polyline can have only one part. If the reshaper does not intersect the target polyline, or does not define a closed loop for the target polygon, then an empty geometry of the same type as the target geometry is returned. The orientation of the reshaper is not considered. The following rules for polygon and polyline reshaping are used:
Polygons:. only one ring (part) is explicitly reshaped – the first one in index order that intersects the reshaping path. The longest portion of the original ring boundary is preserved. The reshaped polygon is re-simplified after the reshape operation has been applied, so the rules for simplification will determine what happens if multiple rings interact with the reshaping path. The graphics show how preserving the longest portion of the boundary can invert the ring in some cases. If more complicated reshaping behavior is desired, a combination of auto-complete, cutting and union can be used.

Polylines: multiple paths (parts) can be affected by the reshaping path. The following graphics show three cases. The polyline being reshaped has part sequence and part orientations shown in red in the upper left graphic. The reshape is shown on the left of each row. The result is shown on the right of each row.

Simplify(ISpatialReference, IGeometryArray)
IGeometryArray Simplify(ISpatialReference pSR, IGeometryArray pInGeometries)
Parameters
pSRISpatialReferencepInGeometriesIGeometryArray
Returns
TrimExtend(ISpatialReference, IPolylineArray, IPolyline, int)
Trims or extends each polyline in the input array using TrimExtendTo (uses IConstructCurve::ConstructExtended for extension operation).
IPolylineArray TrimExtend(ISpatialReference pSR, IPolylineArray pInPA, IPolyline pTrimExtendTo, int extendHow)
Parameters
pSRISpatialReferencepInPAIPolylineArraypTrimExtendToIPolylineextendHowint
Returns
Remarks
Trims (cuts) polylines that intersect the trim-extend line, or extends polylines to it that don’t intersect it. See the figure below for some examples. The details of how polylines are extended can be controlled by adding together combinations of the values listed in the table below.
values to be used with the trim-extend operation
|
Value |
Description |
|
|
esriDefaultCurveExtension |
0 |
By default, extension considers both ends of paths. The old ends remain and new points are added at the extended ends. The new points have attributes that are extrapolated from adjacent existing segments. |
|
esriRelocateEnds |
1 |
If an extension is performed at an end, relocate the end point to the new position instead of leaving the old point and adding a new point at the new position. |
|
esriKeepEndAttributes |
2 |
If an extension is performed at an end, do not extrapolate the end-segment's attributes for the new point. Instead, make its attributes the same as the current end. Incompatible with esriNoAttributes. |
|
esriNoEndAttributes |
4 |
If an extension is performed at an end, do not extrapolate the end-segment's attributes for the new point. Instead, make its attributes be empty. Incompatible with esriKeepAttributes. |
|
esriNoExtendAtFrom |
8 |
Do not extend the 'from' end of any path. |
|
esriNoExtendAtTo |
16 |
Do not extend the 'to' end of any path. |

Union(ISpatialReference, IGeometryArray)
Returns the topological union of the input geometries (uses ITopologicalOperator::ConstructUnion). The input geometries must have the same dimension (0d, 1d, 2d).
IGeometry Union(ISpatialReference pSR, IGeometryArray pInGA)
Parameters
pSRISpatialReferencepInGAIGeometryArray
Returns
Remarks
This operation constructs the set-theoretic union of the geometries in the input array. All inputs must be of the same type.
