Show / Hide Table of Contents

Method Create

Create(int)

Returns an instance of the SpatialReference class based on the given well-known ID.

Declaration
public static SpatialReference Create(int wkid)
Parameters
Type Name Description
int wkid

The well-known ID of the horizontal coordinate system. Must be a positive value.

Returns
Type Description
SpatialReference

A SpatialReference object.

Remarks

The returned SpatialReference has only horizontal coordinate system and does not have vertical coordinate system associated with it.

Exceptions
Type Condition
ArgumentException

The provided WKID is not a supported well-known ID.

Applies to

Platforms and versions
TargetVersions
.NET Standard 2.0100.3 - 200.8
.NET100.13 - 300.0
.NET Windows100.13 - 300.0
.NET Android200.0 - 300.0
.NET iOS200.0 - 300.0
.NET Framework100.0 - 200.8
Xamarin.Android100.0 - 100.15
Xamarin.iOS100.0 - 100.15
UWP100.0 - 200.8
Relevant samples
Densify and generalize: A multipart geometry can be densified by adding interpolated points at regular intervals. Generalizing multipart geometry simplifies it while preserving its general shape. Densifying a multipart geometry adds more vertices at regular intervals.
Identify layers: Identify features in all layers in a map. MapView supports identifying features across multiple layers. Because some layer types have sublayers, the sample recursively counts results for sublayers within each layer.

Create(int, int)

Returns an instance of the SpatialReference class based on well-known IDs for the horizontal and vertical coordinate systems.

Declaration
public static SpatialReference Create(int wkid, int verticalWkid)
Parameters
Type Name Description
int wkid

The well-known ID of the horizontal coordinate system. Must be a supported well-known ID.

int verticalWkid

The well-known ID of the vertical coordinate system. Must be a supported well-known ID.

Returns
Type Description
SpatialReference

A SpatialReference object.

Remarks

When the vertical WKID is less than or equal to 0, this is equivalent to calling Create(int), and the spatial reference will not have a vertical coordinate system associated with it. If verticalWkid is greater than zero but is not a supported well-known ID, an exception will be thrown.

Exceptions
Type Condition
ArgumentException

The provided WKID or verticalWKID is not a supported well-known ID.

Applies to

Platforms and versions
TargetVersions
.NET Standard 2.0100.3 - 200.8
.NET100.13 - 300.0
.NET Windows100.13 - 300.0
.NET Android200.0 - 300.0
.NET iOS200.0 - 300.0
.NET Framework100.0 - 200.8
Xamarin.Android100.0 - 100.15
Xamarin.iOS100.0 - 100.15
UWP100.0 - 200.8

Create(string)

Returns an instance of the SpatialReference class based on well-known text (WKT).

Declaration
public static SpatialReference Create(string wktext)
Parameters
Type Name Description
string wktext

A well-known text (WKT) string that defines a horizontal and optionally vertical coordinate system. Must be a supported well-known ID.

Returns
Type Description
SpatialReference

A SpatialReference object.

Exceptions
Type Condition
ArgumentException

The provided wktext does not contain a supported coordinate system well-known text string.

Applies to

Platforms and versions
TargetVersions
.NET Standard 2.0100.3 - 200.8
.NET100.13 - 300.0
.NET Windows100.13 - 300.0
.NET Android200.0 - 300.0
.NET iOS200.0 - 300.0
.NET Framework100.0 - 200.8
Xamarin.Android100.0 - 100.15
Xamarin.iOS100.0 - 100.15
UWP100.0 - 200.8
In this article
Provide feedback
Back to top Copyright © 2025 Esri.