convert point geometry to 102100 to 4269 or even 4326 to 4269

5779
3
01-21-2014 02:53 AM
ManojrajTeli
Occasional Contributor II
Is there inbuilt functionality to convert point geometry with x and y coordinates from 102100 to 4269 or may even to convert 4326 to 4269 can do that job.I Have seen some equivalent example in http://help.arcgis.com/en/webapi/flex/samples../index.html#//01nq0000004w000000 something similar to this. There is method to convert using geometry service but that will not suffice my requirement.Thank you in advance even if there is algorithm to convert coordinates from 102100 to 4269 will help.

Thanks,
Manojraj Teli
0 Kudos
3 Replies
JonathanUihlein
Esri Regular Contributor
Hi Manojraj!

As you said, you will need to use a geometry service to project your points if they are in a spatial reference different from 4326 or 102100.

There are methods to convert from 4326 to 102100 and vice versa.

You may find this sample helpful:
https://developers.arcgis.com/en/javascript/jssamples/util_coordinate_converter.html
0 Kudos
ManojrajTeli
Occasional Contributor II
Hi Jon,

Thanks for the prompt reply. I have implemented this example for coordinate conversion but I want algorithm to be implemented in sql server or the javascript. There are inbuilt function to convert the coordinates from 102100 to 4326 by using WebmercatorToGeographic conversion in javascript api.Service based conversion is slower as compared to the sql or javascript function and this conversion I need to convert for even millions of points.

Thanks
Manojraj Teli
0 Kudos
AndrewTurner
Esri Contributor

Providing a full answer to this question.

You can use Terraformer (http://terraformer.io/) to do these conversions in Javascript.

Console: 
$ npm install terraformer
$ node

Node:
> var t = require('terraformer')
> extent = { "type": "extent", "xmin": -8591193.02145689, "ymin": 4686637.938322207, "xmax": -8560023.564034801, "ymax": 4726686.262984599, "spatialReference": { "wkid": 102100 } }
{ type: 'extent',
  xmin: -8591193.02145689,
  ymin: 4686637.938322207,
  xmax: -8560023.564034801,
  ymax: 4726686.262984599,
  spatialReference: { wkid: 102100 } }
> [t.Tools.positionToGeographic([extent.xmin, extent.ymin]), t.Tools.positionToGeographic([extent.xmax, extent.ymax])]
[ [ -77.17599999995697, 38.754999999978295 ],
  [ -76.89599999995721, 39.03499999997806 ] ]