IGeometryServer2 Interface

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.

Members

Name Description
Method AutoComplete Discovers polygons bounded by existing polygons and input linework.
Method Buffer Buffers an array of geometries by each distance specified in an array of distances. The distance units can optionally be specified. Geometries buffered at a given distance can optionally be unioned together.
Method ConvexHull Computes the convex hull of the input geometries
Method Cut Cuts the target polyline or polygon Cutter.
Method Densify Applies the ArcObjects 'Densify' operation to each element of the geometry array.
Method DensifyGeodesic Densifies geometries by plotting points along the geodesics between existing vertices (uses IPolycurve4::GeodesicDensify).
Method Difference Returns an array of geometries where each result geometry R[i] is (array1[i] difference G2).
Method FindSRByWKID Defines an SR based upon its well known identifier (WKID) and optionally a WKID for a vertical datum. The resolution and xy tolerances are either computed from the sr horizon or set to defaults. 'authority' is typically either 'EPSG' or 'Esri'.
Method FindSRByWKT Defines a spatial reference object based upon its well known text string (WKT) and optionally a WKT for a vertical datum. The resolution and xy tolerances are either computed from the sr horizon or set to defaults. The output sr is always high precision.
Method FindUnitsByWKID Defines a unit object based upon its well known identified (WKID). 'authority' is typically either 'EPSG' or 'Esri'.
Method FindUnitsByWKT Defines a unit object based upon its well known text string.
Method Generalize Returns generalized (Douglas-Peucker) versions of the input polylines and polygons (uses IPolycurve::Generalize).
Method GetAreasAndLengths Calculates areas and perimeter lengths for each polygon in the specified array.
Method GetAreasAndLengths2 Calculates areas and perimeter lengths for each polygon in the specified array. Optionally does unit conversion.
Method GetDistance Reports shortest distance between G1 and G2.
Method GetDistanceGeodesic Reports the shortest geodesic distance between G1 and G2.
Method GetLabelPoints Calculates an interior point for each polygon.
Method GetLengths Calculates the length of eacch polyline in the specified array.
Method GetLengths2 Calculates the length of eacch polyline in the specified array. Optionally does unit conversion.
Method GetLengthsGeodesic Returns geodesic length of each Polyline.
Method Intersect 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.
Method Offset Returns an array of polylines and polygons that are offset versions of the input polylines and polygons (uses ITopologicalOperator::ConstructOffset).
Method Project Projects an array of geometries from their current spatial reference (pInSR) to a destination spatial reference (pOutSR). The projection process can optionally include a datum transformation if the source and destination SRs have different GCSs.
Method Relation Determines the pairs of geometries from the input geometry arrays that participate in the specified spatial relation.
Method Reshape 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.
Method Simplify Applies the ArcObjects 'Simplify' operation to each element of the geometry array.
Method TrimExtend Trims or extends each polyline in the input array using TrimExtendTo (uses IConstructCurve::ConstructExtended for extension operation).
Method Union Returns the topological union of the input geometries (uses ITopologicalOperator::ConstructUnion). The input geometries must have the same dimension (0d, 1d, 2d).

IGeometryServer2.AutoComplete Method

Discovers polygons bounded by existing polygons and input linework.

Public Function AutoComplete ( _
    ByVal pSR As ISpatialReference, _
    ByVal pInPolygons As IPolygonArray, _
    ByVal pCompletionLines As IPolylineArray _
) As IPolygonArray
public IPolygonArray AutoComplete (
    ISpatialReference pSR,
    IPolygonArray pInPolygons,
    IPolylineArray pCompletionLines
);

IGeometryServer2.ConvexHull Method

Computes the convex hull of the input geometries

Public Function ConvexHull ( _
    ByVal pSR As ISpatialReference, _
    ByVal pInGeometryArray As IGeometryArray _
) As IGeometry
public IGeometry ConvexHull (
    ISpatialReference pSR,
    IGeometryArray pInGeometryArray
);

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.

ConvexHull.jpg

IGeometryServer2.Cut Method

Cuts the target polyline or polygon Cutter.

Public Function Cut ( _
    ByVal pSR As ISpatialReference, _
    ByVal pTargets As IGeometryArray, _
    ByVal pCutter As IPolyline, _
    ByRef ppCutIndexes As ILongArray _
) As IGeometryArray
public IGeometryArray Cut (
    ISpatialReference pSR,
    IGeometryArray pTargets,
    IPolyline pCutter,
    ref ILongArray ppCutIndexes
);

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.

Cut1

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.

Cut2

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.

Cut3

IGeometryServer2.DensifyGeodesic Method

Densifies geometries by plotting points along the geodesics between existing vertices (uses IPolycurve4::GeodesicDensify).

Public Function DensifyGeodesic ( _
    ByVal pSR As ISpatialReference, _
    ByVal pInGeometries As IGeometryArray, _
    ByVal maxSegmentLength As Double, _
    ByVal pLengthUnit As ILinearUnit _
) As IGeometryArray
public IGeometryArray DensifyGeodesic (
    ISpatialReference pSR,
    IGeometryArray pInGeometries,
    double maxSegmentLength,
    ILinearUnit pLengthUnit
);

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.

DensifyGeodesic

IGeometryServer2.Difference Method

Returns an array of geometries where each result geometry R[i] is (array1[i] difference G2).

Public Function Difference ( _
    ByVal pSR As ISpatialReference, _
    ByVal pInGA1 As IGeometryArray, _
    ByVal pInG2 As IGeometry _
) As IGeometryArray
public IGeometryArray Difference (
    ISpatialReference pSR,
    IGeometryArray pInGA1,
    IGeometry pInG2
);

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.

Difference

IGeometryServer2.Generalize Method

Returns generalized (Douglas-Peucker) versions of the input polylines and polygons (uses IPolycurve::Generalize).

Public Function Generalize ( _
    ByVal pSR As ISpatialReference, _
    ByVal pInGA As IGeometryArray, _
    ByVal maxDeviation As Double, _
    ByVal pDeviationUnit As ILinearUnit _
) As IGeometryArray
public IGeometryArray Generalize (
    ISpatialReference pSR,
    IGeometryArray pInGA,
    double maxDeviation,
    ILinearUnit pDeviationUnit
);

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.

IGeometryServer2.GetAreasAndLengths2 Method

Calculates areas and perimeter lengths for each polygon in the specified array. Optionally does unit conversion.

Public Sub GetAreasAndLengths2 ( _
    ByVal pSR As ISpatialReference, _
    ByVal pInPolygons As IPolygonArray, _
    ByVal pLengthUnit As ILinearUnit, _
    ByVal pAreaUnit As ILinearUnit, _
    ByVal areaUnitEnum As esriAreaUnits, _
    ByRef ppAreas As IDoubleArray, _
    ByRef ppLengths As IDoubleArray _
)
public void GetAreasAndLengths2 (
    ISpatialReference pSR,
    IPolygonArray pInPolygons,
    ILinearUnit pLengthUnit,
    ILinearUnit pAreaUnit,
    esriAreaUnits areaUnitEnum,
    ref IDoubleArray ppAreas,
    ref IDoubleArray ppLengths
);

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.

IGeometryServer2.GetDistance Method

Reports shortest distance between G1 and G2.

Public Function GetDistance ( _
    ByVal pSR As ISpatialReference, _
    ByVal pG1 As IGeometry, _
    ByVal pG2 As IGeometry, _
    ByVal pDistanceUnit As ILinearUnit _
) As Double
public double GetDistance (
    ISpatialReference pSR,
    IGeometry pG1,
    IGeometry pG2,
    ILinearUnit pDistanceUnit
);

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.

IGeometryServer2.GetDistanceGeodesic Method

Reports the shortest geodesic distance between G1 and G2.

Public Function GetDistanceGeodesic ( _
    ByVal pSR As ISpatialReference, _
    ByVal pG1 As IGeometry, _
    ByVal pG2 As IGeometry, _
    ByVal pDistanceUnit As ILinearUnit _
) As Double
public double GetDistanceGeodesic (
    ISpatialReference pSR,
    IGeometry pG1,
    IGeometry pG2,
    ILinearUnit pDistanceUnit
);

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.

IGeometryServer2.GetLengths2 Method

Calculates the length of eacch polyline in the specified array. Optionally does unit conversion.

Public Function GetLengths2 ( _
    ByVal pSR As ISpatialReference, _
    ByVal pInPolylines As IPolylineArray, _
    ByVal pLengthUnit As ILinearUnit _
) As IDoubleArray
public IDoubleArray GetLengths2 (
    ISpatialReference pSR,
    IPolylineArray pInPolylines,
    ILinearUnit pLengthUnit
);

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.

IGeometryServer2.GetLengthsGeodesic Method

Returns geodesic length of each Polyline.

Public Function GetLengthsGeodesic ( _
    ByVal pSR As ISpatialReference, _
    ByVal polylines As IPolylineArray, _
    ByVal pLengthUnit As ILinearUnit _
) As IDoubleArray
public IDoubleArray GetLengthsGeodesic (
    ISpatialReference pSR,
    IPolylineArray polylines,
    ILinearUnit pLengthUnit
);

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.

IGeometryServer2.Intersect Method

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.

Public Function Intersect ( _
    ByVal pSR As ISpatialReference, _
    ByVal pInGA1 As IGeometryArray, _
    ByVal pInG2 As IGeometry _
) As IGeometryArray
public IGeometryArray Intersect (
    ISpatialReference pSR,
    IGeometryArray pInGA1,
    IGeometry pInG2
);

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.

Intersect

IGeometryServer2.Offset Method

Returns an array of polylines and polygons that are offset versions of the input polylines and polygons (uses ITopologicalOperator::ConstructOffset).

Public Function Offset ( _
    ByVal pSR As ISpatialReference, _
    ByVal pInGA As IGeometryArray, _
    ByVal offsetDistance As Double, _
    ByVal pOffsetUnit As ILinearUnit, _
    ByVal offsetHow As Integer, _
    ByVal bevelRatio As Double _
) As IGeometryArray
public IGeometryArray Offset (
    ISpatialReference pSR,
    IGeometryArray pInGA,
    double offsetDistance,
    ILinearUnit pOffsetUnit,
    int offsetHow,
    double bevelRatio
);

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.

Offset

IGeometryServer2.Reshape Method

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.

Public Function Reshape ( _
    ByVal pSR As ISpatialReference, _
    ByVal pTarget As IGeometry, _
    ByVal pReshaper As IPolyline _
) As IGeometry
public IGeometry Reshape (
    ISpatialReference pSR,
    IGeometry pTarget,
    IPolyline pReshaper
);

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.

Reshape1

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.

Reshape2

IGeometryServer2.TrimExtend Method

Trims or extends each polyline in the input array using TrimExtendTo (uses IConstructCurve::ConstructExtended for extension operation).

Public Function TrimExtend ( _
    ByVal pSR As ISpatialReference, _
    ByVal pInPA As IPolylineArray, _
    ByVal pTrimExtendTo As IPolyline, _
    ByVal extendHow As Integer _
) As IPolylineArray
public IPolylineArray TrimExtend (
    ISpatialReference pSR,
    IPolylineArray pInPA,
    IPolyline pTrimExtendTo,
    int extendHow
);

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

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

TrimExtend

IGeometryServer2.Union Method

Returns the topological union of the input geometries (uses ITopologicalOperator::ConstructUnion). The input geometries must have the same dimension (0d, 1d, 2d).

Public Function Union ( _
    ByVal pSR As ISpatialReference, _
    ByVal pInGA As IGeometryArray _
) As IGeometry
public IGeometry Union (
    ISpatialReference pSR,
    IGeometryArray pInGA
);

Remarks

This operation constructs the set-theoretic union of the geometries in the input array. All inputs must be of the same type.

Union

Inherited Interfaces

Interfaces Description
IGeometryServer Provides access to standard operations on geometric 'value' objects. The input geometries are never modified by these operations. Designed for use in building web services and web applications.

Classes that implement IGeometryServer2

Classes Description
GeometryServer (esriGeoDatabase) Provides access to standard operations on geometric 'value' objects. The input geometries are never modified by these operations. Designed for use in building web services and web applications.
GeometryServerImpl Provides access to 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.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.