BUG

In Web Application Developer Framework 9.2 (ADF), non-linear geometry (curves) is not supported

Last Published: April 25, 2020

Description


Note:
The issue of the Identify tool or tasks returning the message 'Curves are not supported' has been resolved at version 9.3.


The ArcObjects application programming interface (API) includes a geometry library that supports polygons and polylines composed of linear and non-linear segments. A linear segment is a straight line between two points. A non-linear segment is a curved line defined by one or more control points. Polygons and polylines that contain non-linear segments are often called curves.

Feature layers can store feature geometry as curves. These feature layers may be exposed by way of an ArcGIS Server service and accessed by client applications such as, the Web ADF. ArcGIS Server provides access to feature layer content by way of the ArcObjects and SOAP APIs - both APIs support curves. The Web ADF works with ArcGIS Server services and their feature layer content as an ArcGIS Server local or Internet data source. Both utilize the SOAP API, but only ArcGIS Server Local data sources provide access to the ArcObjects API.

The Web ADF includes a geometry library to support Web-tier geometry interaction and spatial operations in a Web application. A number of operations return feature geometry and attributes based on search criteria. For example, the IQueryFunctionality.Identify() method. The Web ADF also includes a set of convenient conversion classes to assist in converting between Web ADF and other geometry types, including those defined in the ArcGIS Server ArcObjects and SOAP APIs.

When converting curves to Web ADF geometry, an error occurs. Prior to ArcGIS Server 9.2 Service Pack 3, the error indicated that an object was not created:

"Object reference not set to an instance of an object."

This error may be visible in a pop-up window in a browser, or generated by way of a method call in the application code.

In ArcGIS Server 9.2 Service Pack 3, the error indicates the crux of the problem:

"Curves are not supported."

Cause

The Web ADF geometry library does not support curves. It only supports polygons and polylines composed of linear segments. As a result, polygon and polyline geometry returned from ArcGIS Server data sources must be linear to be used by the Web ADF.

Workaround

The ArcObjects API can convert non-linear segments to linear segments and vice versa. It is necessary to work with an ArcGIS Server local data source to gain access to the ArcObjects API.

ArcObjects defines four types of segments: Line, EllipticArc, CircularArc, BezierCurve. Line is linear, while EllipticArc, CircularArc and BezierCurve are non-linear. To determine if a Web ADF application needs to convert feature geometry from non-linear to linear, each geometry returned from an operation with an ArcGIS Server data source must be evaluated. The following code block presents a technique for evaluating ArcObjects polygons and polylines, densifying non-linear geometry to create linear geometry, and converting to Web ADF geometry types.


Code:
// Get the geometry (shape) in results returned from a call to a map service's Identify method.

// The _result variable implements IMapServerIdentifyResult.

ESRI.ArcGIS.Geometry.IGeometry igeometry = _result.Shape;

// Convert the ArcObjects geometry to Web ADF geometry and store in this variable

ESRI.ArcGIS.ADF.Web.Geometry.Geometry adf_geometry = null;

// If a type of polycurve (polyline, polygon, etc.) check to see if linear. If not a polycurve,

// simply convert to Web ADF geometry.

if (igeometry is ESRI.ArcGIS.Geometry.IPolycurve)

{

ESRI.ArcGIS.Geometry.IPolycurve ipolycurve = (ESRI.ArcGIS.Geometry.IPolycurve)igeometry;

ESRI.ArcGIS.Geometry.ISegmentCollection isegmentcollection =

(ESRI.ArcGIS.Geometry.ISegmentCollection)igeometry;

// Check first segment in polycurve.

ESRI.ArcGIS.Geometry.esriGeometryType ags_geometrytype = isegmentcollection.get_Segment(0).GeometryType;

// If non-linear, densify geometry using a resolution defined by the current map scale factor

// If linear, simply proceed without densifying

if (ags_geometrytype == ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryBezier3Curve ||

ags_geometrytype == ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryCircularArc ||

ags_geometrytype == ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryEllipticArc)

{



double mapscale = m_map.Extent.Width / m_map.TilingScheme.ViewWidth;

ipolycurve.Densify(mapscale, 0);

}

if (igeometry is ESRI.ArcGIS.Geometry.IPolyline)

{

ESRI.ArcGIS.Geometry.IPolyline ipolyline = (ESRI.ArcGIS.Geometry.IPolyline)ipolycurve;

ESRI.ArcGIS.ADF.ArcGISServer.PolylineN polylinen = (ESRI.ArcGIS.ADF.ArcGISServer.PolylineN)

ESRI.ArcGIS.ADF.ArcGISServer.Converter.ComObjectToValueObject(ipolyline, sc,

typeof(ESRI.ArcGIS.ADF.ArcGISServer.PolylineN));

adf_geometry = ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.Converter.ToAdfPolyline(polylinen);

}

else if (igeometry is ESRI.ArcGIS.Geometry.IPolygon)

{

ESRI.ArcGIS.Geometry.IPolygon ipolygon = (ESRI.ArcGIS.Geometry.IPolygon)ipolycurve;

ESRI.ArcGIS.ADF.ArcGISServer.PolygonN polygonn = (ESRI.ArcGIS.ADF.ArcGISServer.PolygonN)

ESRI.ArcGIS.ADF.ArcGISServer.Converter.ComObjectToValueObject(ipolygon, sc,

typeof(ESRI.ArcGIS.ADF.ArcGISServer.PolygonN));

adf_geometry = ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.Converter.ToAdfPolygon(polygonn);

}

}

Issues to consider:

The code only checks the first segment in a curve to determine if it is linear or non-linear. A polygon or polyline can have a mix of linear and non-linear segments. An option is to check every segment in a curve, but this option increases processing time. The amount of time depends on the number of segments in each curve that is to be evaluated.

When densifying non-linear segments, the current map scale factor (map units per pixel) is used. The densified curves may appear unchanged, but may appear too coarse when zooming in. Use a map scale factor that can densify curves without losing resolution.

To modify the Identify tool, included with the Web Mapping Application template, perform the following steps.

1. Build a new Web site using either the Web Mapping Application template or the ArcGIS Server Manager wizard. Make sure to specify an ArcGIS Server Local connection to the service that contains the data with true curves.
2. Open Visual Studio .NET. Select File > Open Web site, browse to the location of the new Web application and select Open.
3. In the Solution Explorer, expand the App_Code folder. Right-click the MapIdentify.cs file and select Open.
4. Replace the code in MapIdentify.cs with the code from the Arc Scripts Example in the Related Information section.
5.Add a reference to ESRI.ArcGIS.ADF.ArcGISServer.
6. Build and test the application.


Article ID:000009492

Software:
  • ArcGIS Server

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options

Related Information

Discover more on this topic