<?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 with SPATIAL_REL_WITHIN does not return any results in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/query-with-spatial-rel-within-does-not-return-any/m-p/299144#M27467</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a map service which contains a number of polygons. I am looking to get two different sets of results:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;All polygons which are fully contained within an extent&lt;/LI&gt;&lt;LI&gt;All polygons which are intersected by an extent.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To achieve this I am using following code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;var containedProjQuery = new Query();
var containedProjQueryTask = new QueryTask(configuration.documentParams.ProjectMapService);
containedProjQuery.spatialRelationship = Query.SPATIAL_REL_WITHIN;
containedProjQuery.returnGeometry = true;
containedProjQuery.outFields = ["PROJ_NAME"];
containedProjQuery.geometry = aoiExtent;
var containedProjects = containedProjQueryTask.execute(containedProjQuery);

var intersectingProjQuery = new Query();
var intersectingProjQueryTask = new QueryTask(configuration.documentParams.ProjectMapService);
intersectingProjQuery.spatialRelationship = Query.SPATIAL_REL_INTERSECTS;
intersectingProjQuery.returnGeometry = true;
intersectingProjQuery.outFields = ["PROJ_NAME"];
intersectingProjQuery.geometry = aoiExtent;
var intersectingProjects = intersectingProjQueryTask.execute(intersectingProjQuery);

var promises = All([containedProjects, intersectingProjects]);
promises.then(returnResults);&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The issue I'm running into is that the SPATIAL_REL_WITHIN query always returns 0 results, while SPATIAL_REL_INTERSECTS appears to work correctly. Is there something I'm missing?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 14:21:49 GMT</pubDate>
    <dc:creator>VygintasCesnauskas</dc:creator>
    <dc:date>2021-12-11T14:21:49Z</dc:date>
    <item>
      <title>Query with SPATIAL_REL_WITHIN does not return any results</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/query-with-spatial-rel-within-does-not-return-any/m-p/299144#M27467</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a map service which contains a number of polygons. I am looking to get two different sets of results:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;All polygons which are fully contained within an extent&lt;/LI&gt;&lt;LI&gt;All polygons which are intersected by an extent.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To achieve this I am using following code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;var containedProjQuery = new Query();
var containedProjQueryTask = new QueryTask(configuration.documentParams.ProjectMapService);
containedProjQuery.spatialRelationship = Query.SPATIAL_REL_WITHIN;
containedProjQuery.returnGeometry = true;
containedProjQuery.outFields = ["PROJ_NAME"];
containedProjQuery.geometry = aoiExtent;
var containedProjects = containedProjQueryTask.execute(containedProjQuery);

var intersectingProjQuery = new Query();
var intersectingProjQueryTask = new QueryTask(configuration.documentParams.ProjectMapService);
intersectingProjQuery.spatialRelationship = Query.SPATIAL_REL_INTERSECTS;
intersectingProjQuery.returnGeometry = true;
intersectingProjQuery.outFields = ["PROJ_NAME"];
intersectingProjQuery.geometry = aoiExtent;
var intersectingProjects = intersectingProjQueryTask.execute(intersectingProjQuery);

var promises = All([containedProjects, intersectingProjects]);
promises.then(returnResults);&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The issue I'm running into is that the SPATIAL_REL_WITHIN query always returns 0 results, while SPATIAL_REL_INTERSECTS appears to work correctly. Is there something I'm missing?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 14:21:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/query-with-spatial-rel-within-does-not-return-any/m-p/299144#M27467</guid>
      <dc:creator>VygintasCesnauskas</dc:creator>
      <dc:date>2021-12-11T14:21:49Z</dc:date>
    </item>
    <item>
      <title>Re: Query with SPATIAL_REL_WITHIN does not return any results</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/query-with-spatial-rel-within-does-not-return-any/m-p/299145#M27468</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Are you dealing with multipart polygons?&amp;nbsp; If you have multipart polygons and one or more of the parts are not wholly within another polygon, the spatial selection will not return the multipart polygon.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Nov 2015 16:01:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/query-with-spatial-rel-within-does-not-return-any/m-p/299145#M27468</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2015-11-16T16:01:49Z</dc:date>
    </item>
    <item>
      <title>Re: Query with SPATIAL_REL_WITHIN does not return any results</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/query-with-spatial-rel-within-does-not-return-any/m-p/299146#M27469</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There are multipart polygons in this map service, however all polygons within this particular extent are singlepart.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 16 Nov 2015 16:49:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/query-with-spatial-rel-within-does-not-return-any/m-p/299146#M27469</guid>
      <dc:creator>VygintasCesnauskas</dc:creator>
      <dc:date>2015-11-16T16:49:00Z</dc:date>
    </item>
    <item>
      <title>Re: Query with SPATIAL_REL_WITHIN does not return any results</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/query-with-spatial-rel-within-does-not-return-any/m-p/299147#M27470</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just a thought...is the projection the same between the feature class you're querying and the aoiExtent variable?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Nov 2015 17:50:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/query-with-spatial-rel-within-does-not-return-any/m-p/299147#M27470</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2015-11-19T17:50:19Z</dc:date>
    </item>
    <item>
      <title>Re: Query with SPATIAL_REL_WITHIN does not return any results</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/query-with-spatial-rel-within-does-not-return-any/m-p/299148#M27471</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Correction, turns out there were &lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;multipart polygons in the extent.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Dec 2015 22:03:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/query-with-spatial-rel-within-does-not-return-any/m-p/299148#M27471</guid>
      <dc:creator>VygintasCesnauskas</dc:creator>
      <dc:date>2015-12-14T22:03:16Z</dc:date>
    </item>
  </channel>
</rss>

