Center map with lat/long value

827
1
03-09-2013 09:32 AM
SanthoshKumar3
New Contributor
Can anyone explain how to center esri map instance with lat/long values?

I tried with centerAt method as map.centerAt([point.getLongitude(), point.getLatitude()]); which did nothing.
0 Kudos
1 Reply
RahulMetangale1
Occasional Contributor II
Santosh,

map.centerAt([point.getLongitude(), point.getLatitude()]) this will work only if your basemap spatial reference if 4326. If you are using ArcGIS online or bing base maps which are in 102100 spatial reference then you will have to convert lat and long values to map spatial reference and then call map.centerAt ().

method to convert coordinates from 4326 to 102100:
http://help.arcgis.com/en/webapi/javascript/arcgis/jsapi/namespace_geometry.html#namespace_geometry/...

If your base map is in spatial reference other than 102100 use geometry service project method to convert the alt/long to map spatial reference.
http://help.arcgis.com/en/webapi/javascript/arcgis/jsapi/geometryservice.html#GeometryService/projec...

I hope this helps.
0 Kudos