<?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 Query to get all features from route geometry in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/query-to-get-all-features-from-route-geometry/m-p/1034986#M71997</link>
    <description>&lt;P&gt;I am trying to choose the correct spatial relationship for getting all of the features that lie at least partially within a given polyline geometry.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've referenced this ESRI documentation on spatial relationships, but I am still confused how to achieve what I need:&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-Query.html#spatialRelationship" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-Query.html#spatialRelationship&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I would like to query the Feature Layer and get back the 3 polyline segments which make up the route seen below (the blue highlighted line). The route is created from the Directions widget:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Route w/ 3 segments (features)" style="width: 151px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/8079iCD52A156BA4C9803/image-size/large?v=v2&amp;amp;px=999" role="button" title="2021-03-10_10-11-47.png" alt="Route w/ 3 segments (features)" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Route w/ 3 segments (features)&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;#1 and #2 are full segments.&amp;nbsp; #3 is a partial segment; that is, only part of the feature is contained in the route.&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;When I use the spatial relationship "Contains", the query returns 2 features.&amp;nbsp; These are the two that are wholly contained in the route geometry.&amp;nbsp; So, it doesn't pick up segment #3.&amp;nbsp; UPDATE: I had to add returnGeometry=false to the query so it would return results when using Contains.&lt;/LI&gt;&lt;LI&gt;Using "Intersects" returns all 3 features, but it also picks up the route segments which intersect the route, which are unwanted.&amp;nbsp; This means, it returns features on adjacent routes.&amp;nbsp; I'm only after the features which are part of the route.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Here's my query:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const query = new Query();
query.geometry = routeGeometry; // this is the route geometry
query.spatialRelationship = Query.SPATIAL_REL_INTERSECTS;
query.outFields = ["*"];
query.distance = 10;
query.units = "feet";
query.returnGeometry = false;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;What spatial relationship do I use to get &lt;I&gt;all&amp;nbsp;&lt;/I&gt;segments that are part of the route geometry?&lt;/STRONG&gt;&amp;nbsp; This includes both full and partial segments.&amp;nbsp; Perhaps this could be accomplished in multiple queries?&amp;nbsp; One "Contains" query and another ____ query?&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
    <pubDate>Wed, 10 Mar 2021 19:44:14 GMT</pubDate>
    <dc:creator>AndyWhitaker1</dc:creator>
    <dc:date>2021-03-10T19:44:14Z</dc:date>
    <item>
      <title>Query to get all features from route geometry</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/query-to-get-all-features-from-route-geometry/m-p/1034986#M71997</link>
      <description>&lt;P&gt;I am trying to choose the correct spatial relationship for getting all of the features that lie at least partially within a given polyline geometry.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've referenced this ESRI documentation on spatial relationships, but I am still confused how to achieve what I need:&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-Query.html#spatialRelationship" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-Query.html#spatialRelationship&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I would like to query the Feature Layer and get back the 3 polyline segments which make up the route seen below (the blue highlighted line). The route is created from the Directions widget:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Route w/ 3 segments (features)" style="width: 151px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/8079iCD52A156BA4C9803/image-size/large?v=v2&amp;amp;px=999" role="button" title="2021-03-10_10-11-47.png" alt="Route w/ 3 segments (features)" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Route w/ 3 segments (features)&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;#1 and #2 are full segments.&amp;nbsp; #3 is a partial segment; that is, only part of the feature is contained in the route.&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;When I use the spatial relationship "Contains", the query returns 2 features.&amp;nbsp; These are the two that are wholly contained in the route geometry.&amp;nbsp; So, it doesn't pick up segment #3.&amp;nbsp; UPDATE: I had to add returnGeometry=false to the query so it would return results when using Contains.&lt;/LI&gt;&lt;LI&gt;Using "Intersects" returns all 3 features, but it also picks up the route segments which intersect the route, which are unwanted.&amp;nbsp; This means, it returns features on adjacent routes.&amp;nbsp; I'm only after the features which are part of the route.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Here's my query:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const query = new Query();
query.geometry = routeGeometry; // this is the route geometry
query.spatialRelationship = Query.SPATIAL_REL_INTERSECTS;
query.outFields = ["*"];
query.distance = 10;
query.units = "feet";
query.returnGeometry = false;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;What spatial relationship do I use to get &lt;I&gt;all&amp;nbsp;&lt;/I&gt;segments that are part of the route geometry?&lt;/STRONG&gt;&amp;nbsp; This includes both full and partial segments.&amp;nbsp; Perhaps this could be accomplished in multiple queries?&amp;nbsp; One "Contains" query and another ____ query?&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Mar 2021 19:44:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/query-to-get-all-features-from-route-geometry/m-p/1034986#M71997</guid>
      <dc:creator>AndyWhitaker1</dc:creator>
      <dc:date>2021-03-10T19:44:14Z</dc:date>
    </item>
  </channel>
</rss>

