Class Conversion

Namespace
ESRI.Server.SOESupport
Assembly
ESRI.Server.SOESupport.dll

Conversion class provides a set of static methods to convert a JSON string into a geometry and back..

public sealed class Conversion
Inheritance
Conversion
Inherited Members

Constructors

Conversion()

public Conversion()

Methods

ToGeometry(JsonObject, esriGeometryType)

Converts a JsonObject into an ArcObjects geometry.

public static IGeometry ToGeometry(JsonObject jsonGeometry, esriGeometryType geometryType)

Parameters

jsonGeometry JsonObject

The JsonObject to convert

geometryType esriGeometryType

The type of geometry to convert to.

Returns

IGeometry

The ArcObject geometry or null if the conversion can't be performed.

ToGeometry(string, esriGeometryType)

Converts a JSON string into an ArcObjects geometry.

public static IGeometry ToGeometry(string json, esriGeometryType geometryType)

Parameters

json string

The input JSON string.

geometryType esriGeometryType

The type of geometry to convert to.

Returns

IGeometry

The ArcObject geometry instance or null if the conversion can't be performed.

ToJson(IRecordSet)

Converts an ArcObjects RecordSet to a JSON UTF-8 string (and returns it as an array of bytes). The geometries in each Record will be generalized and densified, before they are serialized to JSON.

public static byte[] ToJson(IRecordSet recordset)

Parameters

recordset IRecordSet

The RecordSet to convert.

Returns

byte[]

The JSONN string (UTF-8) as an array of bytes.

ToJson(IGeometry)

Converts an ArcObjects geometry to a JSON UTF-8 string (and returns it an array of bytes).

public static byte[] ToJson(IGeometry geometry)

Parameters

geometry IGeometry

The ArcObjects geometry to convert to JSON.

Returns

byte[]

The JSON string (UTF-8) as an array of bytes.

ToJson(IGeometry, bool)

Converts an ArcObjects geometry to a JSON UTF-8 string (and returns it an array of bytes).

public static byte[] ToJson(IGeometry geometry, bool writeSpRef)

Parameters

geometry IGeometry

The ArcObjects geometry to convert to JSON.

writeSpRef bool

Set to true to include spatial reference.

Returns

byte[]

The JSON string (UTF-8) as an array of bytes.

ToJsonObject(IGeometry)

Converts an ArcObjects geometry to a JsonObject.

public static JsonObject ToJsonObject(IGeometry geometry)

Parameters

geometry IGeometry

The ArcObjects geometry to convert.

Returns

JsonObject

The resulting JsonObject.

ToJsonObject(IGeometry, bool)

Converts an ArcObjects geometry to a JsonObject.

public static JsonObject ToJsonObject(IGeometry geometry, bool writeSpRef)

Parameters

geometry IGeometry

The ArcObjects geometry to convert.

writeSpRef bool

Set to true to include spatial reference.

Returns

JsonObject

The resulting JsonObject.

ToSpatialReference(string)

Converts a JSON string into an ArcObjects spatial reference

public static ISpatialReference ToSpatialReference(string json)

Parameters

json string

Returns

ISpatialReference