How do you get "Center" Initial Extent?

529
2
05-30-2013 10:57 AM
melissaGomez
New Contributor III
Hello,

I am trying to figure out how to get the "Center" initial extent vs the xy min and max? I have tried a couple of ways using the following sources, but still am unable to figure it out. Any help would be greating appreciated.

Sources:
http://psstl.esri.com/apps/extenthelper/

http://help.arcgis.com/en/webapps/flexviewer/extenthelper/flexviewer_extenthelper.html

(with this flexviewer/extenthelper, i've tried using the "current mouse coordinates," but not getting the extent.)

I am looking for the "center" initial extent I've attached below:

map = new esri.Map("map", {
          basemap: "streets",
          center: [-98.49946448681641, 29.4205708789947],
          zoom: 10,
          infoWindow: popup

    });

Please help. Thanks..
0 Kudos
2 Replies
ReneRubalcava
Frequent Contributor
Are you trying to find the center coordinates to use in your map constructor, similar to how the apps you link show the extent?

I've been using this to get my map centers.
http://teczno.com/squares

I could have sworn I saw someone had hosted a modified version of the extenthelper to show the center coordinates, but don't know link. The link above works fine for me.
0 Kudos
VinayBansal
Occasional Contributor II
You can try this...once the map is loaded....
// get current scale of map
var scale = esri.geometry.getScale(map);

//Based on scale get the map extent.
var extent = new esri.geometry.getExtentForScale(map, scale);
0 Kudos