How can I select the portion in Map in Rectangle box and zoom it?
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.
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
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<SPAN class="punctuation token">.</SPAN><SPAN class="token function">setExtent</SPAN><SPAN class="punctuation token">(</SPAN>esri<SPAN class="punctuation token">.</SPAN><SPAN class="token function">graphicsExtent</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">[</SPAN>clickGraphic<SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN></SPAN>
.
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.