# Geometry service FindSRByWKID method

The FindSRByWKID method defines a spatial reference based upon its well-known id (WKID) and optionally a WKID for a vertical datum (WKID_Z).

FindSRByWKID(string Authority, int WKID, int WKID_Z, boolean DefaultXYResolution, boolean DefaultXYTolerance)

Parameter |
Description |
---|---|

Authority |
Usually "EPSG" or "ESRI", but can also be an arbitrary string. If empty, the default authority will be returned. |

WKID |
Integer that defines a well-known ID (WKID) for a spatial reference. For a list of valid EPSG and ESRI WKID codes, see the discussion Finding a Well-Known ID. |

WKID_Z |
Integer to define the vertical coordinate system. If WKID_Z > -1, then a vertical coordinate system will be created and associated with the horizontal coordinate system. If WKID_Z = -1, no vertical coordinate system will be generated. |

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 remarks section below). If false, the finest possible resolution that covers the horizon of the spatial reference will be used (see "Defining an XY resolution" in the remarks section below for details). |

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

## Return Value

A SpatialReference object.

## Remarks

Clients can associate their own authority names with factory codes that are currently associated with the EPSG or ESRI authority names because only the WKID is used to create the spatial reference. Here are the current rules for mapping WKID ranges to default authority names:

- A WKID in the EPSG code range (1000 - 32768) will result in an AUTHORITY name of "EPSG".
- A WKID in the ESRI code range (33000 - 199999) will result in an AUTHORITY name of "ESRI".
- A WKID in the user code range (200000 - 209199) will result in an AUTHORITY name of "CUSTOM".

The returned WKT (well-known text) element of the spatial reference will have an "AUTHORITY" tag in it containing the default or the client-specified authority name and the specified WKID. For a list of valid EPSG and ESRI WKID codes, see the discussion Finding a Well-Known ID.

### Default XY Resolution values

SpatialReference type |
Precision |
Default value |
---|---|---|

ProjectedCoordinateSystem |
High |
1/10 mm |

ProjectedCoordinateSystem |
Low |
1 mm |

GeographicCoordinateSystem |
High |
1/10,000 arc-second |

GeographicCoordinateSystem |
Low |
1/500 arc-second |

UnknownCoordinateSystem |
High |
1/10 mm |

UnknownCoordinateSystem |
Low |
1 mm |

### Defining an XY resolution

Defining an XY resolution for a spatial reference depends on the type and precision of a coordinate system. For high precision spatial references, the domain extent and resolution must be sufficient to cover the horizon of a given coordinate system. For low-precision spatial references, the domain extent is centered on the horizon center.

For a high precision ProjectedCoordinateSystem (PCS), the domain extent is a square completely covering, and slightly larger than, the horizon extent of the PCS (which is an arbitrary rectangle). The scale factor (1/precision) is chosen to fit this domain. For a low precision PCS, the center of the domain extent is aligned with the center of the horizon extent and expanded to achieve a target resolution of 1mm.

For a high precision GeographicCoordinateSystem (GCS), the square domain (-400, -400, 400, 400), expressed in the units of the spatial reference, is used. For a low precision GCS, the upper right hand corner is adjusted to achieve a default resolution of 1/500 of an arc-second.

For an UnknownCoordinateSystem (UCS), the "horizon" is defined to be a square that produces a resolution of 1 millimeter for a low precision UCS or 1/10 mm for a high precision UCS.

### Default XY Tolerance calculations

For a ProjectedCoordinateSystem or an UnknownCoordinateSystem, the default tolerance is 1 mm (expressed in the units of the spatial reference) or 2.0 * XYResolution, whichever is larger. For a GeographicCoordinateSystem, the default tolerance is the angle subtending 1 mm at the equator, or 2.0 * XYResolution, whichever is larger.

## Examples

### C#

```
Geometry_GeometryServer geometryService = new Geometry_GeometryServer();
geometryService.Url = "http://localhost:6080/arcgis/services/Geometry/GeometryServer";
// Geographic WGS84
SpatialReference outputSpatialReference = geometryService.FindSRByWKID("EPSG", 4326, -1, true, true);
bool isHighPrecision = outputSpatialReference.HighPrecision;
```

### 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.FindSRByWKID("EPSG", 4326,-1, True, True)
Dim isHighPrecision As Boolean = outputSpatialReference.HighPrecision
```

### Java

```
String serviceURL = "http://localhost:6080/arcgis/services/Geometry/GeometryServer";
GeometryServerBindingStub geometryService = new GeometryServerBindingStub(serviceURL);
SpatialReference outputSpatialReference = null;
//Test FindSRByWKID - Geographic WGS84
outputSpatialReference = geometryService.findSRByWKID("EPSG", 4326, -1, true, true);
boolean bIsHighPrecision = outputSpatialReference.getHighPrecision();
System.out.println("IsHighPrecision: " + bIsHighPrecision);
```