<?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 MapView.ZoomTo unreliable when changing viewport in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/mapview-zoomto-unreliable-when-changing-viewport/m-p/814847#M2525</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've noticed the following issue with ZoomTo.&amp;nbsp;Assume you've created a new camera object with a different viewport(height and width) and location (X, Y, Z) than the current maps' camera. Then I would expect this to never throw.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;MapView view = GetMapView();&lt;/P&gt;&lt;P&gt;Camera newCamera = GetCameraWithUpdatedViewportAndLocation();&lt;/P&gt;&lt;P&gt;view.ZoomTo(newCamera);&lt;/P&gt;&lt;P&gt;Assert.Equals(view.Camera.ViewportHeight, newCamera.ViewportHeight); &lt;STRONG&gt;// this will throw sometimes&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Assert.Equals(view.&lt;/SPAN&gt;&lt;SPAN&gt;C&lt;/SPAN&gt;&lt;SPAN&gt;amera.X, newCamera.X); // this&amp;nbsp;never throws&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;This happens irregularly but seems to happen more often when my machine is under performance stress or when the debugger is attached or when I'm setting the camera for a mapframe inside a layout. It happens&amp;nbsp;with or without the duration parameter (TimeSpan) and also&amp;nbsp;when using ZoomToAsync. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;This is not a case where I just have to wait to the camera to change, because I've noticed the XYZ values update already with the new values and just the viewport value stay stale. I've even added code to wait until the viewpoer changes to what the newCamera is set to and that results in a thread waiting forever.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I use the viewport on the CameraUpdated event to perform some calculations in my add in. When I observe the camera in the map itself&amp;nbsp;it seems like the viewport is correct but the calculations are wrong and when I step into the application I can notice the viewport is not changed.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Are there any known reasons why the ZoomTo function would not set the viewport&amp;nbsp;while still&amp;nbsp;setting the XYZ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 29 Jun 2020 19:49:14 GMT</pubDate>
    <dc:creator>serbanmarin1</dc:creator>
    <dc:date>2020-06-29T19:49:14Z</dc:date>
    <item>
      <title>MapView.ZoomTo unreliable when changing viewport</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/mapview-zoomto-unreliable-when-changing-viewport/m-p/814847#M2525</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've noticed the following issue with ZoomTo.&amp;nbsp;Assume you've created a new camera object with a different viewport(height and width) and location (X, Y, Z) than the current maps' camera. Then I would expect this to never throw.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;MapView view = GetMapView();&lt;/P&gt;&lt;P&gt;Camera newCamera = GetCameraWithUpdatedViewportAndLocation();&lt;/P&gt;&lt;P&gt;view.ZoomTo(newCamera);&lt;/P&gt;&lt;P&gt;Assert.Equals(view.Camera.ViewportHeight, newCamera.ViewportHeight); &lt;STRONG&gt;// this will throw sometimes&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Assert.Equals(view.&lt;/SPAN&gt;&lt;SPAN&gt;C&lt;/SPAN&gt;&lt;SPAN&gt;amera.X, newCamera.X); // this&amp;nbsp;never throws&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;This happens irregularly but seems to happen more often when my machine is under performance stress or when the debugger is attached or when I'm setting the camera for a mapframe inside a layout. It happens&amp;nbsp;with or without the duration parameter (TimeSpan) and also&amp;nbsp;when using ZoomToAsync. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;This is not a case where I just have to wait to the camera to change, because I've noticed the XYZ values update already with the new values and just the viewport value stay stale. I've even added code to wait until the viewpoer changes to what the newCamera is set to and that results in a thread waiting forever.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I use the viewport on the CameraUpdated event to perform some calculations in my add in. When I observe the camera in the map itself&amp;nbsp;it seems like the viewport is correct but the calculations are wrong and when I step into the application I can notice the viewport is not changed.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Are there any known reasons why the ZoomTo function would not set the viewport&amp;nbsp;while still&amp;nbsp;setting the XYZ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Jun 2020 19:49:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/mapview-zoomto-unreliable-when-changing-viewport/m-p/814847#M2525</guid>
      <dc:creator>serbanmarin1</dc:creator>
      <dc:date>2020-06-29T19:49:14Z</dc:date>
    </item>
  </channel>
</rss>

