How to zoom to layer using ArcGIS Javascript API

المشرف العام

Administrator
طاقم الإدارة
I tried to get the function "Zoom to Layer" done using the following code snippet. But it does not change anything. The layer is a feature service layer, and I can see the full extent object of the layer which is not null. Any idea? Thanks.

tree.on("dblClick", function (item, node, event) { var layerId=item.id[0]; var layer = map.getLayer(layerId); if (!layer) { return; } else { var lyrExt=layer.fullExtent; var gsvc= esriConfig.defaults.geometryService; var outSR = new esri.SpatialReference({ wkid: 102100 }); gsvc.project([lyrExt], outSR, function(newExt) { map.setExtent(newExt[0],true); } });

أكثر...
 
أعلى