I am using ESRI suit 10.1 and ArcGIS JSAPI 3.4/3.5.

I want to set custom extent (for India) for this map and trying to assign the coordinate in center but its not getting proper map.

In previous version (3.0/3.1) we used dojo.toJson(map.extent.toJson()); with the help of firebug to identify the extent of the specific area(x min,y min, x max,y max) then we used that extent for base map.

What I tried :

-I checked the API reference but I did not get any information.

-Is there any Dojo problem (might be few references gets updated?)

-Tried to use lat,lon values at Center property but not getting perfect map for India

In new version I am not getting this so is there any way to identify the custom extent using previous tool and use those in center property ?

Any help will be great !!!

2 Answers 2


I'm not sure why you cannot get the extent of an existing map, but I can use console.dir(map.extent.toJson()); to get the extent, for example on this map: http://developers.arcgis.com/en/javascript/samples/widget_overviewmap/

My usual way of solving this issue, is first creating an extent from lat-long (i.e. WGS84), and then projecting it to the map's projection.

If your maps projection is in WebMercator, then you can use the following function from the geometry class: esri.geometry.geographicToWebMercator(geometry)

Once you have the extent in the map's coordinate system, you can set the extent of the map in the constructor.

The following code works:

function init() {
    var gcsExtent = new esri.geometry.Extent(65,10,100,35, new esri.SpatialReference({wkid: 4326}));  
    var WMextent= esri.geometry.geographicToWebMercator(gcsExtent);

    var map = new esri.Map("map",{
                    extent: WMextent,

I have also updated your jsfiddle: http://jsfiddle.net/cn5eV/3/

  • thanks for the reply.I am going through the fiddle and let you know soon.
    – Sunil
    Jul 31, 2013 at 10:04

Below are the link to the example to find the extent of the map frame.I have Modified your example to set extent rather then using center I have set Extent. Usually ESRI using 102100 projection than 4326.Extent Example. I have used this forum link onExtentChange. I have written the function that will write value of extent in console log for more help.

  • thanks for the reply.I am going through the example and let you know soon.
    – Sunil
    Jul 31, 2013 at 10:04

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.