<?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: Performance issue iterating FeatureQueryResult in .NET Maps SDK Questions</title>
    <link>https://community.esri.com/t5/net-maps-sdk-questions/performance-issue-iterating-featurequeryresult/m-p/1100610#M10458</link>
    <description>&lt;P&gt;1. Shapefile is on local harddrive.&lt;/P&gt;&lt;P&gt;2. Spatial query (returning geometry). Elapsed time is only 1-2 sec, which seems reasonable.&lt;/P&gt;&lt;P&gt;3. Features are "complicated". All polygons between 1 and 40 of them.&lt;/P&gt;&lt;P&gt;I was unaware of QueryExtentAsync. Using that, rather than iterating through the geometry, reduces the time from 10s to 3s. Still a little more than I would expect, and longer than it takes to retrieve the geometry.&lt;/P&gt;&lt;P&gt;By exploiting QueryExtentAsync it has reduced my total processing time from 9 hours to 3 hours, so thank you for that.&lt;/P&gt;&lt;P&gt;I am using the Shapefile that can be found at&amp;nbsp;&lt;A href="http://www.environment.gov.au/fed/catalog/search/resource/downloadData.page?uuid=%7B4448CACD-9DA8-43D1-A48F-48149FD5FCFD%7D" target="_blank"&gt;http://www.environment.gov.au/fed/catalog/search/resource/downloadData.page?uuid=%7B4448CACD-9DA8-43D1-A48F-48149FD5FCFD%7D&lt;/A&gt;. It is the ArcView Shapefile with terrestrial in the name. They also publish a GeoDatabase, but I have no experience with these. Would they be quicker?&lt;/P&gt;&lt;P&gt;Just to explain my application. I run programs for Radio Amateurs (HAMs) where they can operate from either a park, or within 1km of a silo. There are 3000 parks, and they are many polygons in shape. They can also operate from within 1km of a silo, which is just a point. Being a greedy lot, they wish to know where they can operate from both at once. To find the intersection of all parks with all silos, is the typical N squared problem, so I have had to optimise the search strategy a bit. The current algorithm is:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;for each park (3000 of them)
  get park extent (QueryExtentAsync)
  add a buffer of 1km to park extent
  SQL fetch all silos within that extent
  for each candidate silo (usually 2-10)
    Get park geometry for park if don't have it (QueryFeaturesAsync) already
    Test for overlap with park (unbuffered) and silo with 1km buffer applied
  next
next&lt;/LI-CODE&gt;&lt;P&gt;Your tip about QueryExtentAsync has made a significant difference to the performance, however, iterating through a FeatureQueryResult still remains excruciatingly slow. Returning the geometry only takes 1-2 sec, so it's hard to understand why iterating this collection to detect overlap takes so long.&lt;/P&gt;</description>
    <pubDate>Wed, 22 Sep 2021 01:11:14 GMT</pubDate>
    <dc:creator>MarcHillman</dc:creator>
    <dc:date>2021-09-22T01:11:14Z</dc:date>
    <item>
      <title>Performance issue iterating FeatureQueryResult</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/performance-issue-iterating-featurequeryresult/m-p/1100194#M10451</link>
      <description>&lt;P&gt;I have a VB.net application that is using&amp;nbsp;QueryFeaturesAsync to retrieve a FeatureQueryResult&amp;nbsp; from a shapefile. It typically returns between 2 and 12 features. When I iterate through the result (for each fragment in FeatureQueryResult ) it takes forever - about 7-20 seconds.&lt;/P&gt;&lt;P&gt;What I'm trying to achieve is to calculate the Extent of the&amp;nbsp;FeatureQueryResult . I do this by iterating though the&amp;nbsp;FeatureQueryResult&amp;nbsp; and doing a CombineExtents for each individual result. Is there a way to do this without iterating? Why is it so slow?&lt;/P&gt;</description>
      <pubDate>Tue, 21 Sep 2021 07:15:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/performance-issue-iterating-featurequeryresult/m-p/1100194#M10451</guid>
      <dc:creator>MarcHillman</dc:creator>
      <dc:date>2021-09-21T07:15:24Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue iterating FeatureQueryResult</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/performance-issue-iterating-featurequeryresult/m-p/1100311#M10452</link>
      <description>&lt;P&gt;Hi Marc,&lt;/P&gt;&lt;P&gt;7-20 seconds for a handful of features surprises me. Some thoughts:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;I assume the shapefile is &lt;U&gt;not&lt;/U&gt; on a network share. Is that correct?&lt;/LI&gt;&lt;LI&gt;Is this a spatial query, or just an attribute query?&lt;/LI&gt;&lt;LI&gt;Are the features in the shapefile complicated polygons or polylines?&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;You could try calling &lt;A href="https://developers.arcgis.com/net/api-reference/api/netwin/Esri.ArcGISRuntime/Esri.ArcGISRuntime.Data.FeatureTable.QueryExtentAsync.html#Esri_ArcGISRuntime_Data_FeatureTable_QueryExtentAsync_Esri_ArcGISRuntime_Data_QueryParameters_" target="_blank"&gt;QueryExtentAsync&lt;/A&gt; and see if that improves things. If you also need attributes from the features, you could &lt;A href="https://developers.arcgis.com/net/api-reference/api/netwin/Esri.ArcGISRuntime/Esri.ArcGISRuntime.Data.FeatureTable.QueryFeaturesAsync.html" target="_blank"&gt;make a separate query&lt;/A&gt; and &lt;A href="https://developers.arcgis.com/net/api-reference/api/netwin/Esri.ArcGISRuntime/Esri.ArcGISRuntime.Data.QueryParameters.ReturnGeometry.html#Esri_ArcGISRuntime_Data_QueryParameters_ReturnGeometry" target="_blank"&gt;specify not to return geometries&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;Let us know if any of those things help.&lt;/P&gt;&lt;P&gt;Are you able to share the shapefile? You can DM me to share that if you are able to.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Sep 2021 14:47:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/performance-issue-iterating-featurequeryresult/m-p/1100311#M10452</guid>
      <dc:creator>Nicholas-Furness</dc:creator>
      <dc:date>2021-09-21T14:47:49Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue iterating FeatureQueryResult</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/performance-issue-iterating-featurequeryresult/m-p/1100610#M10458</link>
      <description>&lt;P&gt;1. Shapefile is on local harddrive.&lt;/P&gt;&lt;P&gt;2. Spatial query (returning geometry). Elapsed time is only 1-2 sec, which seems reasonable.&lt;/P&gt;&lt;P&gt;3. Features are "complicated". All polygons between 1 and 40 of them.&lt;/P&gt;&lt;P&gt;I was unaware of QueryExtentAsync. Using that, rather than iterating through the geometry, reduces the time from 10s to 3s. Still a little more than I would expect, and longer than it takes to retrieve the geometry.&lt;/P&gt;&lt;P&gt;By exploiting QueryExtentAsync it has reduced my total processing time from 9 hours to 3 hours, so thank you for that.&lt;/P&gt;&lt;P&gt;I am using the Shapefile that can be found at&amp;nbsp;&lt;A href="http://www.environment.gov.au/fed/catalog/search/resource/downloadData.page?uuid=%7B4448CACD-9DA8-43D1-A48F-48149FD5FCFD%7D" target="_blank"&gt;http://www.environment.gov.au/fed/catalog/search/resource/downloadData.page?uuid=%7B4448CACD-9DA8-43D1-A48F-48149FD5FCFD%7D&lt;/A&gt;. It is the ArcView Shapefile with terrestrial in the name. They also publish a GeoDatabase, but I have no experience with these. Would they be quicker?&lt;/P&gt;&lt;P&gt;Just to explain my application. I run programs for Radio Amateurs (HAMs) where they can operate from either a park, or within 1km of a silo. There are 3000 parks, and they are many polygons in shape. They can also operate from within 1km of a silo, which is just a point. Being a greedy lot, they wish to know where they can operate from both at once. To find the intersection of all parks with all silos, is the typical N squared problem, so I have had to optimise the search strategy a bit. The current algorithm is:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;for each park (3000 of them)
  get park extent (QueryExtentAsync)
  add a buffer of 1km to park extent
  SQL fetch all silos within that extent
  for each candidate silo (usually 2-10)
    Get park geometry for park if don't have it (QueryFeaturesAsync) already
    Test for overlap with park (unbuffered) and silo with 1km buffer applied
  next
next&lt;/LI-CODE&gt;&lt;P&gt;Your tip about QueryExtentAsync has made a significant difference to the performance, however, iterating through a FeatureQueryResult still remains excruciatingly slow. Returning the geometry only takes 1-2 sec, so it's hard to understand why iterating this collection to detect overlap takes so long.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Sep 2021 01:11:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/performance-issue-iterating-featurequeryresult/m-p/1100610#M10458</guid>
      <dc:creator>MarcHillman</dc:creator>
      <dc:date>2021-09-22T01:11:14Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue iterating FeatureQueryResult</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/performance-issue-iterating-featurequeryresult/m-p/1100624#M10459</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Curious observation.&lt;/STRONG&gt; For QueryExtentAsync to work, .ReturnGeometry must be true, which is the default. The subsequent QueryFeaturesAsync call is now much faster, presumably because the geometry is already cached (which is pretty clever of it).&lt;/P&gt;&lt;P&gt;Timings are now&lt;/P&gt;&lt;P&gt;QueryExtentAsync = 2.5s, (OK I guess)&lt;/P&gt;&lt;P&gt;QueryFeaturesAsync = ~0.5s (obviously some caching going on)&lt;/P&gt;&lt;P&gt;Iterate the resulting FeatureQueryResult = 5s&lt;/P&gt;&lt;P&gt;The use of a preceding&amp;nbsp;QueryExtentAsync seems to have sped things up significantly, but iteration is still much slower than expected.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Sep 2021 03:01:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/performance-issue-iterating-featurequeryresult/m-p/1100624#M10459</guid>
      <dc:creator>MarcHillman</dc:creator>
      <dc:date>2021-09-22T03:01:41Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue iterating FeatureQueryResult</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/performance-issue-iterating-featurequeryresult/m-p/1101151#M10467</link>
      <description>&lt;P&gt;I suspect the FeatureQueryResult object is seriously broken. Not only is iterating it very slow, but the simple reference to the .Any property of the object takes 3 seconds, even if empty.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Sep 2021 09:11:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/performance-issue-iterating-featurequeryresult/m-p/1101151#M10467</guid>
      <dc:creator>MarcHillman</dc:creator>
      <dc:date>2021-09-23T09:11:53Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue iterating FeatureQueryResult</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/performance-issue-iterating-featurequeryresult/m-p/1101708#M10469</link>
      <description>&lt;P&gt;If performance is critical, I wouldn't recommend using shapefiles. Instead I'd suggest you download the .gdb file from that source, open it in Pro and export that dataset to a runtime geodatabase, then use that instead.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/2.7/help/data/geodatabases/manage-mobile-gdb/mobile-geodatabases.htm" target="_blank"&gt;https://pro.arcgis.com/en/pro-app/2.7/help/data/geodatabases/manage-mobile-gdb/mobile-geodatabases.htm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Sep 2021 16:57:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/performance-issue-iterating-featurequeryresult/m-p/1101708#M10469</guid>
      <dc:creator>dotMorten_esri</dc:creator>
      <dc:date>2021-09-24T16:57:31Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue iterating FeatureQueryResult</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/performance-issue-iterating-featurequeryresult/m-p/1101882#M10473</link>
      <description>&lt;P&gt;Thank you for the suggestion. I am skeptical the performance issue is shapefile related for 2 reasons.&lt;BR /&gt;&lt;BR /&gt;1. Under esriarcgisruntime 10.x there was no performance issue. Problem seems to be since 100.x&lt;BR /&gt;2. Querying seems to provide adequate performance. It is iterating the query result that is the issue. Even if the query result is no more than a series of pointers to the shapefile, the .Any property should not take 3 seconds, particularly when the result is empty - there is no shapefile access involved.&lt;/P&gt;</description>
      <pubDate>Sat, 25 Sep 2021 01:04:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/performance-issue-iterating-featurequeryresult/m-p/1101882#M10473</guid>
      <dc:creator>MarcHillman</dc:creator>
      <dc:date>2021-09-25T01:04:26Z</dc:date>
    </item>
  </channel>
</rss>

