<?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: How to zoom to selected feature using ArcGIS Pro SDK in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-zoom-to-selected-feature-using-arcgis-pro/m-p/830755#M3299</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't understand what Select does but it doesn't seem to do what we both assumed it did. I ended up using the map's set selection method and then zoomed to the selection.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;DIV style="color: #c0c5ce; background-color: #2a2d37; font-weight: normal;"&gt;&lt;DIV&gt;&lt;SPAN style="color: #85b1e0;"&gt;MapView&lt;/SPAN&gt;&lt;SPAN style="color: #c0c5ce;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: #85b1e0;"&gt;Active&lt;/SPAN&gt;&lt;SPAN style="color: #c0c5ce;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: #85b1e0;"&gt;Map&lt;/SPAN&gt;&lt;SPAN style="color: #c0c5ce;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: #f5faff;"&gt;SetSelection&lt;/SPAN&gt;&lt;SPAN style="color: #c0c5ce;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #7e7edd;"&gt;new&lt;/SPAN&gt;&lt;SPAN style="color: #c0c5ce;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #7e7edd;"&gt;Dictionary&lt;/SPAN&gt;&lt;SPAN style="color: #c0c5ce;"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #7e7edd;"&gt;MapMember&lt;/SPAN&gt;&lt;SPAN style="color: #c0c5ce;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #7e7edd;"&gt;List&lt;/SPAN&gt;&lt;SPAN style="color: #c0c5ce;"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #7e7edd;"&gt;long&lt;/SPAN&gt;&lt;SPAN style="color: #c0c5ce;"&gt;&amp;gt;&amp;gt; {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #c0c5ce;"&gt; { &lt;/SPAN&gt;&lt;SPAN style="color: #85b1e0;"&gt;layer&lt;/SPAN&gt;&lt;SPAN style="color: #c0c5ce;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #85b1e0;"&gt;primaryKeys&lt;/SPAN&gt;&lt;SPAN style="color: #c0c5ce;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: #f5faff;"&gt;Select&lt;/SPAN&gt;&lt;SPAN style="color: #c0c5ce;"&gt;(x &lt;/SPAN&gt;&lt;SPAN style="color: #7e7edd;"&gt;=&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="color: #c0c5ce;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #85b1e0;"&gt;x&lt;/SPAN&gt;&lt;SPAN style="color: #c0c5ce;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: #85b1e0;"&gt;Value&lt;/SPAN&gt;&lt;SPAN style="color: #c0c5ce;"&gt;).&lt;/SPAN&gt;&lt;SPAN style="color: #f5faff;"&gt;ToList&lt;/SPAN&gt;&lt;SPAN style="color: #c0c5ce;"&gt;() }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #c0c5ce;"&gt; });&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #c0c5ce;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #85b1e0;"&gt;MapView&lt;/SPAN&gt;&lt;SPAN style="color: #c0c5ce;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: #85b1e0;"&gt;Active&lt;/SPAN&gt;&lt;SPAN style="color: #c0c5ce;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: #f5faff;"&gt;ZoomToSelectedAsync&lt;/SPAN&gt;&lt;SPAN style="color: #c0c5ce;"&gt;()&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #c0c5ce;"&gt;```&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 04 Sep 2019 17:50:42 GMT</pubDate>
    <dc:creator>stevegourley</dc:creator>
    <dc:date>2019-09-04T17:50:42Z</dc:date>
    <item>
      <title>How to zoom to selected feature using ArcGIS Pro SDK</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-zoom-to-selected-feature-using-arcgis-pro/m-p/830754#M3298</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have two layers in my map (project area and states). I was able to select the state from the states layer that intersects my project area polygon using the code below. However, I cannot figure out how to zoom the map to the selected state (the state that intersects with my project area boundary). I thought the last 2 lines of my code would do it, but that zooms the map to the entire states layer (not just the selected state). Does anyone know what I am doing wrong?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;{&lt;BR /&gt; var layout = Project.Current.GetItems&amp;lt;LayoutProjectItem&amp;gt;()?.First().GetLayout();&lt;BR /&gt; if (layout == null) return;&lt;BR /&gt; MapFrame mf = layout.FindElement("Main Map") as MapFrame;&lt;BR /&gt; Map m = mf.Map;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; FeatureLayer fl1 = m.FindLayers("ProjectArea1").First() as FeatureLayer;&lt;BR /&gt; QueryFilter queryFilter = new QueryFilter();&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; using (ArcGIS.Core.Data.RowCursor rowCursor = fl1.Search(queryFilter = null))&lt;BR /&gt; {&lt;BR /&gt; //Grab the first record (and hopefully only record)&lt;BR /&gt; while (rowCursor.MoveNext())&lt;BR /&gt; {&lt;BR /&gt; //Grab the features geometry&lt;BR /&gt; Feature feature1 = rowCursor.Current as Feature;&lt;BR /&gt; Geometry geo = feature1.GetShape();&lt;/P&gt;&lt;P&gt;//Set up a spatial query&lt;BR /&gt; var spatialQuery = new SpatialQueryFilter()&lt;BR /&gt; { FilterGeometry = geo, SpatialRelationship = SpatialRelationship.Intersects };&lt;/P&gt;&lt;P&gt;//Reference county layer and apply spatial query&lt;BR /&gt; FeatureLayer fl2 = m.FindLayers("States").First() as FeatureLayer;&lt;BR /&gt; fl2.Select(spatialQuery);&lt;/P&gt;&lt;P&gt;Geometry geo1 = fl2.QueryExtent();&lt;/P&gt;&lt;P&gt;Envelope env = geo1.Extent;&lt;BR /&gt; mf.ZoomTo(env);&lt;BR /&gt; }&lt;BR /&gt; }&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Nov 2018 20:54:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-zoom-to-selected-feature-using-arcgis-pro/m-p/830754#M3298</guid>
      <dc:creator>JoshuaO_Neil</dc:creator>
      <dc:date>2018-11-02T20:54:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to zoom to selected feature using ArcGIS Pro SDK</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-zoom-to-selected-feature-using-arcgis-pro/m-p/830755#M3299</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't understand what Select does but it doesn't seem to do what we both assumed it did. I ended up using the map's set selection method and then zoomed to the selection.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;DIV style="color: #c0c5ce; background-color: #2a2d37; font-weight: normal;"&gt;&lt;DIV&gt;&lt;SPAN style="color: #85b1e0;"&gt;MapView&lt;/SPAN&gt;&lt;SPAN style="color: #c0c5ce;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: #85b1e0;"&gt;Active&lt;/SPAN&gt;&lt;SPAN style="color: #c0c5ce;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: #85b1e0;"&gt;Map&lt;/SPAN&gt;&lt;SPAN style="color: #c0c5ce;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: #f5faff;"&gt;SetSelection&lt;/SPAN&gt;&lt;SPAN style="color: #c0c5ce;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #7e7edd;"&gt;new&lt;/SPAN&gt;&lt;SPAN style="color: #c0c5ce;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #7e7edd;"&gt;Dictionary&lt;/SPAN&gt;&lt;SPAN style="color: #c0c5ce;"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #7e7edd;"&gt;MapMember&lt;/SPAN&gt;&lt;SPAN style="color: #c0c5ce;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #7e7edd;"&gt;List&lt;/SPAN&gt;&lt;SPAN style="color: #c0c5ce;"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: #7e7edd;"&gt;long&lt;/SPAN&gt;&lt;SPAN style="color: #c0c5ce;"&gt;&amp;gt;&amp;gt; {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #c0c5ce;"&gt; { &lt;/SPAN&gt;&lt;SPAN style="color: #85b1e0;"&gt;layer&lt;/SPAN&gt;&lt;SPAN style="color: #c0c5ce;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #85b1e0;"&gt;primaryKeys&lt;/SPAN&gt;&lt;SPAN style="color: #c0c5ce;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: #f5faff;"&gt;Select&lt;/SPAN&gt;&lt;SPAN style="color: #c0c5ce;"&gt;(x &lt;/SPAN&gt;&lt;SPAN style="color: #7e7edd;"&gt;=&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="color: #c0c5ce;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #85b1e0;"&gt;x&lt;/SPAN&gt;&lt;SPAN style="color: #c0c5ce;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: #85b1e0;"&gt;Value&lt;/SPAN&gt;&lt;SPAN style="color: #c0c5ce;"&gt;).&lt;/SPAN&gt;&lt;SPAN style="color: #f5faff;"&gt;ToList&lt;/SPAN&gt;&lt;SPAN style="color: #c0c5ce;"&gt;() }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #c0c5ce;"&gt; });&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #c0c5ce;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #85b1e0;"&gt;MapView&lt;/SPAN&gt;&lt;SPAN style="color: #c0c5ce;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: #85b1e0;"&gt;Active&lt;/SPAN&gt;&lt;SPAN style="color: #c0c5ce;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: #f5faff;"&gt;ZoomToSelectedAsync&lt;/SPAN&gt;&lt;SPAN style="color: #c0c5ce;"&gt;()&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #c0c5ce;"&gt;```&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Sep 2019 17:50:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-zoom-to-selected-feature-using-arcgis-pro/m-p/830755#M3299</guid>
      <dc:creator>stevegourley</dc:creator>
      <dc:date>2019-09-04T17:50:42Z</dc:date>
    </item>
  </channel>
</rss>

