How can I select the portion in Map in Rectangle box and zoom it?
Thanks in advance
Solved! Go to Solution.
So you want to draw a rectangle to select data and zoom to the selection or just zoom by rectangle?
Have you looked at the RubberBandZoom property of the map? Map | API Reference | ArcGIS API for JavaScript 3.18
Are you working with a Feature Service or a Dynamic Map service layer? You will first need to create an event listener on the layer to determine if the user has clicked on the layer. Depending on the layer type, you must define the function for the layer click event - for Feature Layer you can use the geometry of the graphic feature directly and for Dynamic Services you probably need to do an Query or Identify Task (IdentifyTask | API Reference | ArcGIS API for JavaScript 3.18 ) first to retrieve the feature geometry. Then only can you use the map's setExtent function (Map | API Reference | ArcGIS API for JavaScript 3.18 ) to zoom to the extent of the portion
map.setExtent(esri.graphicsExtent([clickGraphic]))
.
Iam not able to select the map via rectangle box. How can I do that?
I have done fullExtent through the below code:
map.setExtent(dynamicMapServiceLayer.fullExtent);
Now I want to make a tool through as i select the portion of map it should zoom.
Plzz reply as soon as possible.
Thanks in Advance
So you want to draw a rectangle to select data and zoom to the selection or just zoom by rectangle?
Have you looked at the RubberBandZoom property of the map? Map | API Reference | ArcGIS API for JavaScript 3.18
I got it brother.. Thanks for your time.
Thanks FC Basson bro .. I got it.