On the following page ProConcepts Map Authoring · Esri/arcgis-pro-sdk Wiki · GitHub is stated that the Map object has a map scale property, but I cannot find this property. MapView.Active doesn't have a map scale property neither.
So how can I get and set the map scale?
Hello Matthew,
thank you for your reply! For the map view, setting the map scale works as follows:
MapView mapView <SPAN class="operator token">=</SPAN> MapView<SPAN class="punctuation token">.</SPAN>Active<SPAN class="punctuation token">;</SPAN> Camera camera <SPAN class="operator token">=</SPAN> mapView<SPAN class="punctuation token">.</SPAN>Camera<SPAN class="punctuation token">;</SPAN> camera<SPAN class="punctuation token">.</SPAN>Scale <SPAN class="operator token">=</SPAN> <SPAN class="number token">5000</SPAN><SPAN class="punctuation token">;</SPAN> mapView<SPAN class="punctuation token">.</SPAN><SPAN class="token function">ZoomToAsync</SPAN><SPAN class="punctuation token">(</SPAN>camera<SPAN class="punctuation token">,</SPAN> TimeSpan<SPAN class="punctuation token">.</SPAN>Zero<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
Barbara
This is exactly what I am looking for, kudos to @BarbaraSchneider2
Camera camera <SPAN class="operator token">=</SPAN> newMapframe<SPAN class="punctuation token">.</SPAN>Camera<SPAN class="punctuation token">;</SPAN> camera<SPAN class="punctuation token">.</SPAN>X <SPAN class="operator token">=</SPAN> <SPAN class="operator token">-</SPAN><SPAN class="number token">118.465</SPAN><SPAN class="punctuation token">;</SPAN> camera<SPAN class="punctuation token">.</SPAN>Y <SPAN class="operator token">=</SPAN> <SPAN class="number token">33.988</SPAN><SPAN class="punctuation token">;</SPAN> camera<SPAN class="punctuation token">.</SPAN>Scale <SPAN class="operator token">=</SPAN> <SPAN class="number token">30000</SPAN><SPAN class="punctuation token">;</SPAN> newMapframe<SPAN class="punctuation token">.</SPAN><SPAN class="token function">SetCamera</SPAN><SPAN class="punctuation token">(</SPAN>camera<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>
Use the camera of the map frame. xy to center it, then scale it how you want. I should note this is for layouts. I don't know off the top of my head how it is done in the map view. Let me know if that is what you need and I can try and figure it out.
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.