<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Zoom to point or extent in .NET Maps SDK Questions</title>
    <link>https://community.esri.com/t5/net-maps-sdk-questions/zoom-to-point-or-extent/m-p/1547147#M13063</link>
    <description>&lt;P&gt;Note that you can't zoom to a point - you can pan to it, but to zoom, you'll need the overload of Viewpoint that takes a scale as well. This is because the point has an infinitely small size, so we wouldn't know how far to zoom in. It really depends on what the point represents (building, address, city, etc).&lt;BR /&gt;&lt;BR /&gt;Wrt Already Owned exception: A map can only be active with one MapView at a time. Are you using the map with multiple mapviews? Also note that if the garbage collector hasn't had a chance to clear out the old mapview yet, the map might still be associated with the mapview. A good way around this is when a mapview closes, to unhook the map immediately from the mapview, so it's ready for use on the next one.&lt;/P&gt;</description>
    <pubDate>Wed, 09 Oct 2024 16:08:15 GMT</pubDate>
    <dc:creator>dotMorten_esri</dc:creator>
    <dc:date>2024-10-09T16:08:15Z</dc:date>
    <item>
      <title>Zoom to point or extent</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/zoom-to-point-or-extent/m-p/1546959#M13061</link>
      <description>&lt;P&gt;Hi, I my code, I want to be able to zoom to a point or extent on the map. How can I do that?&lt;/P&gt;&lt;P&gt;The user can enter an address, and an API call returns the coordinats, which I am using to create a Graphic on the map:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;MapPoint houseNumberToDisplay = new MapPoint(HouseNumberToMap.geometri.coordinates[0][0], HouseNumberToMap.geometri.coordinates[0][1], sr);

CreateGraphics(houseNumberToDisplay);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I got a Map property thats binding to the xmal:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;esri:MapView x:Name="MainMapView"
      Map="{Binding Map}" 
      Grid.ColumnSpan="2" 
      Background="White"
      GraphicsOverlays = "{Binding GraphicsOverlays}"
           /&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;I am trying to create a mapView object and set the Map object to the mapView object, so i can use the 'SetViewpointAsync' method. But I get this error message:&lt;/P&gt;&lt;P&gt;System.Windows.Markup.XamlParseException: ''Set property 'Esri.ArcGISRuntime.UI.Controls.MapView.Map' threw an exception.' Line number '79' and line position '23'.'&lt;/P&gt;&lt;P&gt;ArcGISRuntimeException: Object is already owned: Already owned.&lt;/P&gt;&lt;P&gt;What am I missing?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Oct 2024 13:37:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/zoom-to-point-or-extent/m-p/1546959#M13061</guid>
      <dc:creator>Daniel4</dc:creator>
      <dc:date>2024-10-09T13:37:12Z</dc:date>
    </item>
    <item>
      <title>Re: Zoom to point or extent</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/zoom-to-point-or-extent/m-p/1547044#M13062</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/576915"&gt;@Daniel4&lt;/a&gt;, you should be able to update the viewpoint by simply using your `MainMapView` object:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;LI-CODE lang="c"&gt;await MainMapView.SetViewpointAsync(new Viewpoint(geometry));&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;In your case you can use the `MapPoint` you have called "houseNumberToDisplay" as the geometry.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;You can find more examples of this in our&amp;nbsp;&lt;A href="https://github.com/Esri/arcgis-maps-sdk-dotnet-samples/tree/main/src/WPF/WPF.Viewer/Samples/MapView/ChangeViewpoint" target="_self"&gt;Change viewpoint&lt;/A&gt;&amp;nbsp;sample.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I hope this helps!&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Oct 2024 15:15:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/zoom-to-point-or-extent/m-p/1547044#M13062</guid>
      <dc:creator>HamishDuff</dc:creator>
      <dc:date>2024-10-09T15:15:19Z</dc:date>
    </item>
    <item>
      <title>Re: Zoom to point or extent</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/zoom-to-point-or-extent/m-p/1547147#M13063</link>
      <description>&lt;P&gt;Note that you can't zoom to a point - you can pan to it, but to zoom, you'll need the overload of Viewpoint that takes a scale as well. This is because the point has an infinitely small size, so we wouldn't know how far to zoom in. It really depends on what the point represents (building, address, city, etc).&lt;BR /&gt;&lt;BR /&gt;Wrt Already Owned exception: A map can only be active with one MapView at a time. Are you using the map with multiple mapviews? Also note that if the garbage collector hasn't had a chance to clear out the old mapview yet, the map might still be associated with the mapview. A good way around this is when a mapview closes, to unhook the map immediately from the mapview, so it's ready for use on the next one.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Oct 2024 16:08:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/zoom-to-point-or-extent/m-p/1547147#M13063</guid>
      <dc:creator>dotMorten_esri</dc:creator>
      <dc:date>2024-10-09T16:08:15Z</dc:date>
    </item>
    <item>
      <title>Re: Zoom to point or extent</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/zoom-to-point-or-extent/m-p/1547255#M13064</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/755586"&gt;@HamishDuff&lt;/a&gt; thanks for your answer.&lt;/P&gt;&lt;P&gt;It seems like I can't access the 'MainMapView' object from my ViewModel. I got this red squiggles line&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Daniel4_0-1728497707467.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/116903i4C33D67533CA89F7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Daniel4_0-1728497707467.png" alt="Daniel4_0-1728497707467.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;In the code-behinde of the xaml, I can access the MainMapView object, and zoom to a location like this&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;    private void SearchAddressButton_Click(object sender, RoutedEventArgs e)
    {
        var sr = SpatialReference.Create(25832);
        MapPoint mapCenterPoint = new MapPoint(725301.71, 6171291.95, sr);
        MainMapView.SetViewpoint(new Viewpoint(mapCenterPoint, 200));
    }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But all my logic is in the ViewModel.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Oct 2024 18:24:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/zoom-to-point-or-extent/m-p/1547255#M13064</guid>
      <dc:creator>Daniel4</dc:creator>
      <dc:date>2024-10-09T18:24:35Z</dc:date>
    </item>
    <item>
      <title>Re: Zoom to point or extent</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/zoom-to-point-or-extent/m-p/1547258#M13065</link>
      <description>&lt;P&gt;That is correct. Setting view points are view operations that require view-code. However the toolkit introduces a GeoViewController that gives you the ability to declare a view controller in your view model, and then bind that on to the mapview:&amp;nbsp;&lt;A href="https://github.com/Esri/arcgis-maps-sdk-dotnet-toolkit/blob/main/docs/geoviewcontroller.md" target="_blank" rel="noopener"&gt;https://github.com/Esri/arcgis-maps-sdk-dotnet-toolkit/blob/main/docs/geoviewcontroller.md&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Example:&amp;nbsp;&lt;A href="https://github.com/Esri/arcgis-maps-sdk-dotnet-toolkit/blob/0d12057c95e3be6b2d693715fd2b1c1fd13e8b98/src/Samples/Toolkit.SampleApp.WPF/Samples/GeoViewController/GeoViewControllerSampleVM.cs#L31" target="_blank"&gt;https://github.com/Esri/arcgis-maps-sdk-dotnet-toolkit/blob/0d12057c95e3be6b2d693715fd2b1c1fd13e8b98/src/Samples/Toolkit.SampleApp.WPF/Samples/GeoViewController/GeoViewControllerSampleVM.cs#L31&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Oct 2024 18:29:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/zoom-to-point-or-extent/m-p/1547258#M13065</guid>
      <dc:creator>dotMorten_esri</dc:creator>
      <dc:date>2024-10-09T18:29:43Z</dc:date>
    </item>
  </channel>
</rss>

