geonetadmin

Using the OutSpatialReference property: Putting the points where they belong

Blog Post created by geonetadmin on Dec 23, 2010

How many times have you tried to geocode a point somewhere in the continental United States and the point appears off the coast of East Africa? For example, you call Esri Support and we tell you that the locator is giving you lat/long but your map service is using a projection other than WGS 1984, Web Mercator, for instance. Solution? Re-project your geocoded results: from Geographic to Web Mercator. If your map service uses a spatial reference other than Web Mercator, then you would need to use a Geometry Service to do the reprojection.

OutSpatialReference (Silverlight, Flex, JavaScript). This is the keyword that is going to make life easier for you. A new property of the Locator task (or of AddressToLocationsParameters class in Silverlight) introduced in the ArcGIS Server 10.0 REST API and henceforth in the 2.x Web APIs allows you to set the spatial reference of the output geometries.

For example, setting the outSpatialReference in JavaScript API
locator = new esri.tasks.Locator("http://<SERVER>/ArcGIS/rest/services/<LOCATORSERVICE>/GeocodeServer"); locator.outSpatialReference = new esri.SpatialReference(102113);

Remember:
This property is available only with ArcGIS Server 10.0 and later releases. So, make sure that in your 2.x Web API application, you are working with Locator services hosted on a 10.0 machine.

- Kripa J., Esri Support Analyst - SDK group, Esri Support Services


Outcomes