Select to view content in your preferred language

Extent- how is the extent of a map determined.

568
2
06-07-2010 01:29 AM
xariaD
by
Occasional Contributor
How to determine the extent of map.
When myMap is loaded it's full extent is not defined or is null.

The map was created in ArcMap, do we have to set the extent of map during creation?
0 Kudos
2 Replies
DominiqueBroux
Esri Frequent Contributor
map.Layers has a method GetFullExtent which is giving the full extent of the map.
This method is only valid after the layer collection has been initialized.
So you have to subscribe to the 'LayersInitialized' event.

Something like:
private void MyMap_Initialized(object sender, System.EventArgs e)
{
 Map map = sender as Map;
 map.Layers.LayersInitialized += new LayerCollection.LayersInitializedHandler(Layers_LayersInitialized);
}

void Layers_LayersInitialized(object sender, System.EventArgs args)
{
 LayerCollection col = sender as LayerCollection;
 Envelope env = col.GetFullExtent();
}
0 Kudos
xariaD
by
Occasional Contributor
thank you.
0 Kudos