Zoom to Layer with different spatialReferences

736
1
09-29-2011 01:56 AM
ManuelVinzek
New Contributor
Hi

My problem is to make a zoomTo Button in Javascript.
I have de basemap with a  spatialreference wkid:102100 and severel Layers on an ArcGis Server 10 with different spatialreferences.

i can make the basemap and add the layer by map.addLayer(layer) and they where shown on the map.
when i try to zoom to the layer by map.setExtent(layer.fullExtent) i have problems with different wkids

how can i convert the differen wkid to zoom to the selected layer?

thx
Manuel
0 Kudos
1 Reply
derekswingley1
Frequent Contributor
What is the spatial ref. of your layers? If they're in a geographic coordinate system, you can use esri.geometry.geographicToWebMercator() to project the layer's extent then pass it to map.setExtent().

If your layers are in some other coordinate system, project the extent with a geometry service and then set the map's extent.
0 Kudos