Geometry service FindUnitsByWKT method

The FindUnitsByWKT method defines a unit object based on its well- known text string.

FindUnitsByWKT(string WKT)

Parameter

Description

WKT

A string that defines a well-known text string for a predefined unit.

Return Value

A Unit object. Depending on the type of unit, you can cast to an AngularUnit or LinearUnit.

Remarks

The Unit returned is often used in other Geometry service methods such as Buffer. Here are some examples of WKT strings for linear and angular units:

Examples

C#

Geometry_GeometryServer geometryService = new Geometry_GeometryServer();

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

 

// International Meter

LinearUnit linearUnit = (LinearUnit)geometryService.FindUnitsByWKT("UNIT[\"Meter\",1.0,AUTHORITY[\"EPSG\",9001]]");

VB.NET

Dim geomeTryService As Geometry_GeometryServer = New Geometry_GeometryServer()

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

 

' International Meter

Dim linearUnit As LinearUnit = CType(geomeTryService.FindUnitsByWKT("UNIT[""Meter"",1.0,AUTHORITY[""EPSG"",9001]]"), LinearUnit)

Java

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

GeometryServerBindingStub geometryService = new GeometryServerBindingStub(serviceURL);

 

//Test FindUnitsByWKT - International Meter

LinearUnit linearUnit2 = (LinearUnit) geometryService.findUnitsByWKT(

      "UNIT[\"Foot_US\",0.3048006096012192,AUTHORITY[\"EPSG\",9003]]");

System.out.println("WKID: " + linearUnit2.getWKID());

2/28/2020