AnsweredAssumed Answered

ZoomTo layer extent

Question asked by kuiperfoliage on Apr 10, 2012
Latest reply on Apr 11, 2012 by kuiperfoliage
I have two different layers that I add to my Map control, one with a spatial reference of 102100 and another with spatial reference of 26910.

I thought the Map Control would automatically reproject additional layers to the first added layer (102100 in this case) but when i try to call the following code the ZoomTo fails because the second layer still has the original spatial reference (26910).

Note that the ZoomTo functionality is based upon the code in the ZoomToLayerAction of the Esri library.

            if (layer != null && layer.FullExtent != null)             {                 if ((layer.FullExtent.Width > 0.0) || (layer.FullExtent.Height > 0.0))                 {                     this.maplegend.Map.ZoomTo(layer.FullExtent);                 }                 else                 {                     this.maplegend.Map.PanTo(layer.FullExtent.GetCenter());                 }             }

Do I need to use GeometryService to convert the extent to that of the original layer ?

Thanks for clarifying this.