Geometry service FindSRByWKT method

The FindSRByWKT method defines a spatial reference based upon its well known text string (WKT) and optionally a WKT for a vertical datum (WKT_Z). The resolution and XY tolerances are either computed from the spatial reference horizon or set to defaults.

FindSRByWKT(string WKT, string WKT_Z, boolean DefaultXYResolution, boolean DefaultXYTolerance)

Parameter

Description

WKT

A string that defines a well-known text string for a pre-defined spatial reference.

WKT_Z

As a string, if WKT_Z is specified and not empty, then a vertical coordinate system will be created and associated with the horizontal coordinate system.

DefaultXYResolution

If true, then the XY coordinate grid resolution will be set to its default value (see the default XY resolution values table in the FindSRByWKID method remarks section for more details). If false, the finest possible resolution that covers the horizon of the spatial reference will be used (see "Defining an XY resolution" in the FindSRByWKID method remarks section for more details).

DefaultXYTolerance

If true, then the default XY tolerance of 1mm will be used (see "Default XY Tolerance calculations" in the FindSRByWKID method remarks section for more details). If false, then the minimum allowable XY tolerance will be used (2.0 * XY resolution).

Return Value

A SpatialReference object. The output spatial reference is always high precision.

Remarks

Finds a predefined spatial reference based on its OGC/EPSG definition string, otherwise known as its well-known text string (WKT). The text string contains individual parameters of a spatial reference. A valid spatial reference for a geographic coordinate system (GEOGCS) may appears as follows:

GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]

Note the nested structure of parameters includes a datum, spheriod, prime meridian, and angular unit. A valid spatial reference for a projected coordinate system (PROJCS) may appear as follows:

PROJCS["World_Mercator",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]], PROJECTION["Mercator"],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",0.0],PARAMETER["Standard_Parallel_1",0.0],UNIT["Meter",1.0]]]

NoteNote:

The nested structure of parameters includes a geographic coordinate system (GEOGCS), a projection, and a set of projection parameters such as false easting, false northing, and standard parallel.

Examples

C#

Geometry_GeometryServer geometryService = new Geometry_GeometryServer();

geometryService.Url = "http://localhost:6080/arcgis/services/Geometry/GeometryServer";

 

// Geographic WGS84

SpatialReference outputSpatialReference = geometryService.FindSRByWKT("GEOGCS[\"GCS_WGS_1984\", DATUM[\"D_WGS_1984\", SPHEROID[\"WGS_1984\",6378137.0,298.257223563]], PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.0174532925199433]]", "", true, true);

 

int predefinedWKID = outputSpatialReference.WKID;

VB.NET

Dim geomeTryService As Geometry_GeometryServer = New Geometry_GeometryServer()

geomeTryService.Url = "http://localhost:6080/arcgis/services/Geometry/GeometryServer"

 

' Geographic WGS84

Dim outputSpatialReference As SpatialReference = geomeTryService.FindSRByWKT("GEOGCS[""GCS_WGS_1984"",DATUM[""D_WGS_1984"",SPHEROID[""WGS_1984"",6378137.0,298.257223563]],PRIMEM[""Greenwich"",0.0],UNIT[""Degree"",0.0174532925199433]]", "", True, True)

 

Dim predefinedWKID As Integer = outputSpatialReference.WKID

Java

String serviceURL = "http://localhost:6080/arcgis/services/Geometry/GeometryServer";

GeometryServerBindingStub geometryService = new GeometryServerBindingStub(serviceURL);

 

//Test FindSRByWKT - Geographic WGS84

SpatialReference outputSpatialReference = geometryService.findSRByWKT(

      "GEOGCS[\"GCS_WGS_1984\",DATUM[\"D_WGS_1984\",SPHEROID[\"WGS_1984\",6378137.0,298.257223563]],PRIMEM[\"Greenwich\",0.0],"

      + "UNIT[\"Degree\",0.0174532925199433]]","", true, true);

int expectedWKID = outputSpatialReference.getWKID();

System.out.println("Output Spatial Reference WKID: " + expectedWKID);

2/28/2020