Select to view content in your preferred language

ZoomTo layer extent

1963
2
Jump to solution
04-10-2012 10:40 AM
Labels (1)
BKuiper
Frequent Contributor
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.
0 Kudos
1 Solution

Accepted Solutions
MichaelBranscomb
Esri Frequent Contributor
Hi,

The Map control will re-project graphics layers and feature layers but for all other types of service layer the reprojection is handled on the server. The spatial reference of the service itself and the spatial reference of the full extent property remain unaffected and it is just the image rendered by the server which is re-projected. This means you will need to consider getting the envelope and using a LocalGeometryService or online GeometryServer to perform the reprojection before calling zoom to.

Cheers

Mike

View solution in original post

0 Kudos
2 Replies
MichaelBranscomb
Esri Frequent Contributor
Hi,

The Map control will re-project graphics layers and feature layers but for all other types of service layer the reprojection is handled on the server. The spatial reference of the service itself and the spatial reference of the full extent property remain unaffected and it is just the image rendered by the server which is re-projected. This means you will need to consider getting the envelope and using a LocalGeometryService or online GeometryServer to perform the reprojection before calling zoom to.

Cheers

Mike
0 Kudos
BKuiper
Frequent Contributor
Hi,

The Map control will re-project graphics layers and feature layers but for all other types of service layer the reprojection is handled on the server. The spatial reference of the service itself and the spatial reference of the full extent property remain unaffected and it is just the image rendered by the server which is re-projected. This means you will need to consider getting the envelope and using a LocalGeometryService or online GeometryServer to perform the reprojection before calling zoom to.

Cheers

Mike


Thanks for the clarification. I made an implementation that uses the LocalGeometryService.
0 Kudos