My organization would prefer to use its own basemaps rather than those provided by ArcGIS Online due to the accuracy of information that is represented in them. The area we service is rapidly developing, and as such, there is no way for Esri to keep up with the data as well as we can.

As such, the basemaps are all created with a spatial reference based on a State Plane projection and hosted on our server this way. This causes problems whenever I attempt to use the HTML5 Geolocation feature in my code, as it returns a latitude/longitude value.

I have toyed with several methods for using these values in my code, primarily: using a Geometry Service to project them into my desired spatial reference or overlaying Esri's basemaps with our data in order to have our data converted to the spatial reference of their maps. However, the former method requires thorough error handling and the latter creates a significant loss of accuracy as well as some graphical issues due to labels overlapping.

Is there a better way to handle this issue?

1 Answer 1


I think your first solution, to project the Lat/Long coordinates to your preferred state plane is the right way to go. However, I'm not sure what you mean by "a Geometry Service". Do you mean you're using a 3rd-party web method to perform the coordinate transformation? If so, I would discourage that, as there's not a good reason to have such a dependency in your app, also because it is cleaner and faster to perform the coordinate conversion directly in your client.

With that said, have you tried using something like Proj4js to perform the Lat/Long --> state plane conversion directly in your client code?

I typically have the opposite problem, where our chosen web mapping API wants Lat/Long coordinates, and some functions feed it data from a legacy webservice that outputs sate plane coordinates. So I have to go from state plane --> Lat/Long. To do that, using Proj4js, looks like this:

Utils.ToProj4jsLonLat = function(x, y)
    // Append South Carolina State Plane Ft Proj4 expression to Proj4js projection candidates.
    // http://www.spatialreference.org/ref/esri/102733/proj4js/
    Proj4js.defs["ESRI:102733"] = "+title=NAD83SouthCarolinaStatePlaneFt +proj=lcc +lat_1=32.5 +lat_2=34.83333333333334 +lat_0=31.83333333333333 +lon_0=-81 +x_0=609600.0000000001 +y_0=0 +ellps=GRS80 +datum=NAD83 +to_meter=0.3048006096012192 +no_defs";

    var esri102733 = new Proj4js.Proj('ESRI:102733');
    var epsg4326 = new Proj4js.Proj('EPSG:4326');

    // Note that x = LONGITUDE and y = LATITUDE
    var point = new Proj4js.Point(x, y);

    Proj4js.transform(esri102733, epsg4326, point);
    return point;

So to make that work for you, you'd first need to look up your state plane projection definition as a Proj4 expression on SpatialReference.org. On the left side, look for the "Proj4js format" link, follow it, and copy the provided text.

enter image description here

Back in the code, prepend a title value (+title=WhatEverYouWantHere) to the start of the Proj4 expression, then flipflop the esriXXXXXX and epsg4326 parameters, and you'll have a function that uses Proj4js to perform a Lat/Long-->state plane coordinate conversion.

  • 2
    Geometry Services are built into ArcGIS and are used "to perform various operations on geometries such as project, simplify, buffer, and relationships." However, I had never seen Proj4js, and it looks much more intuitive than using a Geometry Service. Thanks for your help! Sep 24, 2014 at 15:28
  • Ahhh. Gotcha! Ok then, yes if the Geometry Service is opening a connection and making a REST request for every point conversion, I recommend Proj4js instead, which will be much cleaner and faster. For example, Proj4js can even do point coordinate conversions inside a mouse move event handler.
    – elrobis
    Sep 24, 2014 at 15:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.