I am currently writing the "Zoom to Layer" function for my application. However, the spatial references between my imported layer and my base map are different.
Is there a way around this? Can I somehow project all of my shapes/graphics so that they are in the base map's spatial reference?
Is my only option to remove all layers, change spatial reference, and add layers back in?
It seems like ArcEngine's spatial reference had less restriction and was easier to use. Any insights?
Thanks for all your help,
Kev
Best Answer
I had this same issue. If you look at this thread you'll see that an
ArcGISTiledMapServiceLayer
does not reproject into the map's spatial reference, because each tile is specifically rendered in one certain spatial reference. Instead you should use anArcGISDynamicMapServiceLayer
with the same URL. This will remove the nice tile-by-tile loading functionality, but it will automatically reproject the layer to your map's spatial reference.I use a combined approach. I first try to load a tiled layer, and when the layer's
Initialized
event fires, I make sure that the spatial reference is the same as the map's. If it's not the same, then I remove the tiled layer and replace it with a dynamic layer.