How can i zoomin to a map , by drawing a rectangle on the map and zoom that particular area?? Please Help Michael BranscombAntti KajanusMorten Nielsen
Thanks in advance,
Vijit
Thankyou Sir.
By default, you can hold "Shift" key and then draw a rectangle on the MapView to use similar navigation. If you want to zoom out, you can do "Shift+ Ctrl" combo instead.
If you want to implement your own, then you can do something like this:
<SPAN class="keyword token">private</SPAN> <SPAN class="keyword token">async</SPAN> <SPAN class="keyword token">void</SPAN> <SPAN class="token function">Button_Click</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">object</SPAN> sender<SPAN class="punctuation token">,</SPAN> RoutedEventArgs e<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN> <SPAN class="keyword token">try</SPAN> <SPAN class="punctuation token">{</SPAN> <SPAN class="comment token">// use the MapView's Editor to request geometry (Envelope) from the user and await the result</SPAN> <SPAN class="keyword token">var</SPAN> newExtent <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">await</SPAN> myMapView<SPAN class="punctuation token">.</SPAN>SketchEditor<SPAN class="punctuation token">.</SPAN><SPAN class="token function">StartAsync</SPAN><SPAN class="punctuation token">(</SPAN>Esri<SPAN class="punctuation token">.</SPAN>ArcGISRuntime<SPAN class="punctuation token">.</SPAN>UI<SPAN class="punctuation token">.</SPAN>SketchCreationMode<SPAN class="punctuation token">.</SPAN>Rectangle<SPAN class="punctuation token">,</SPAN> <SPAN class="keyword token">false</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="comment token">// set the map view extent with the Envelope</SPAN> <SPAN class="keyword token">await</SPAN> myMapView<SPAN class="punctuation token">.</SPAN><SPAN class="token function">SetViewpointGeometryAsync</SPAN><SPAN class="punctuation token">(</SPAN>newExtent<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="keyword token">catch</SPAN> <SPAN class="punctuation token">(</SPAN><SPAN class="token class-name">TaskCanceledException</SPAN> tce<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN> <SPAN class="comment token">// sketching cancelled </SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="keyword token">catch</SPAN> <SPAN class="punctuation token">(</SPAN><SPAN class="token class-name">Exception</SPAN> ex<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN> <SPAN class="punctuation token">}</SPAN> <SPAN class="punctuation token">}</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.