I am trying to zoom to a layer I just added to my map and I am having a heck of a time this this simple task. I am using ArcGIS WPF API 10.2.5.0 and arcGisLocalDynamicMapServiceLayer to add layers to a map. The application always adds 2 defaults layers at startup and allows the user to add layers at run time. I need to zoom to that last layer added after the user added it.
I started out trying to use map.Layers.GetFullExtent to determine the zoom but the extent coordinates for XMax, XMin, YMax, YMin end up covering the entire map. I believe that is the case because one of the default layers added at startup is the map it self. So using GetFullExtent doesn't work for me, because I have a graphic layer that is a world map.
So I started looking at the shape files themselves, trying to find the Min and Max X-Y coordinates for the added shape, so I could use that to zoom to the shape. But for some reason the extent coordinates for the shapes I am using, zoom to some place in Nigeria in West Afrika, although my shape is a line located in Atlanta, GA!
Since I am new to GIS and shape files, I suspect I am missing something crucial and I am hoping some one here can help me out.
The extent for my shape shows this max and min values:
xMin,yMin 340458.64,1314058.62
xMax,yMax 348079.77,1327565.27
I use the values to create an envelope, which I pass to map.zoomTo(). For now the values are hard coded and the code looks like this:
ESRI.ArcGIS.Client.Geometry.Envelope myEnvelope = new ESRI.ArcGIS.Client.Geometry.Envelope( 340458.64361572266, 1314058.6218261719, 348079.77261572267, 1327565.2654261719 );
esriMap.ZoomTo( myEnvelope );
So why do these coordinates zoom to Afrika when the shape is in Atlanta, GA?
What am I doing wrong?
Thanks for any help you can give me!
URW