winstonmerlo

Lat Lon points in js api v2.0

Discussion created by winstonmerlo on Jul 21, 2010
Latest reply on Jul 22, 2010 by xirias
I am upgrading an existing app that uses the JS api from v=1.4 to v=2.0. The new maps work good, when setting the extents it works great, but when I try to add a new marker, the marker appears in the west coast of Africa instead than on the specified Lat/Lon.

I am not that experienced with Geographical Information Systems so when I tried to search what I should do, I found threads related to the WKID that since this v2.0 uses 102100 I should use I different coordinate system instead of the degree based one, and that I should utilize webMercator utilities to translate the point. Unfortunately I have note been able to make sense of all this.

In a nutshell when using v1.4 I was able to create a point with like this:

    var point = new esri.geometry.Point(lon, lat);

In the API reference under the geometry -> point section, it illustrates that one way I can add a point is like this:

    new esri.geometry.Point(-118.15, 33.80, new esri.SpatialReference({ wkid: 4326 }))

So I just replaced the X and Y values with my lat and lon variables but when adding a graphics with that point, it is not placed anywhere near the desired place.

What am I doing wrong?

Outcomes