<?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: Excluding Intersected Area/Points in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/excluding-intersected-area-points/m-p/533750#M49761</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migrated-users/3101"&gt;Robert Scheitlin, GISP&lt;/A&gt; One&amp;nbsp;promising way to do this, although I haven't tested fully, is to use the underlying database SDE spatial functions as the where-clause. We are using Oracle SDE ST_Geometry type, so in the database I can run plain SQL statement to find intersected points and an input polygon, like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;SELECT POINT_ID&lt;BR /&gt;FROM MY_POINTS &lt;BR /&gt;WHERE SDE.ST_INTERSECTS(SHAPE, SDE.ST_GEOMETRY('POLYGON ((9689836.255 4420129.191, 9690576.399 4420184.417 , 9690295.144 4419703.323, 9689836.255 4420129.191))', 3308)) = 1 AND SHAPE IS NOT NULL&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here, I am using the SDE functions to do the intersect, with the input polygon given as a plain WKT string (spatial reference is 3308).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now, I am able to use the above where clause on the map service to do the same. First I need to convert the input polygon into WKT string, then basically run the above query with a "not in" to find points outside of the intersected polygon:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P style="border: 0px;"&gt;var queryParams = new Query();&lt;BR /&gt;queryParams.where = 'POINT_ID NOT IN (SELECT POINT_ID FROM MY_POINTS WHERE SDE.ST_INTERSECTS(SHAPE, SDE.ST_GEOMETRY('POLYGON ((9689836.255 4420129.191, 9690576.399 4420184.417 , 9690295.144 4419703.323, 9689836.255 4420129.191))', 3308)) = 1 AND SHAPE IS NOT NULL)';&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P style="border: 0px;"&gt;&lt;/P&gt;&lt;P style="border: 0px;"&gt;Still need to test for performance, write the actual JavaScript code, test what if the WKT string is too long... etc, but looks promising so far (e.g. I can dump that where-clause into the map service query REST end-point and it works).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 08 Aug 2019 01:50:27 GMT</pubDate>
    <dc:creator>HenryKo2</dc:creator>
    <dc:date>2019-08-08T01:50:27Z</dc:date>
    <item>
      <title>Excluding Intersected Area/Points</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/excluding-intersected-area-points/m-p/533748#M49759</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a map service which are points. I have a polygon shape which intersects with the points. How do I find the points that are &lt;EM&gt;&lt;STRONG&gt;outside&lt;/STRONG&gt;&lt;/EM&gt; (i.e. excluded / differentiated ) the polygon shape? So this is essentially the opposite of "intersect", kind of like cutting a whole in the points with the polygon.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I know with intersect, I can do the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;var queryParams = new Query();&lt;BR /&gt; queryParams.geometry = geometry; // This is the polygon shape.&lt;BR /&gt; queryParams.spatialRelationship = Query.SPATIAL_REL_INTERSECTS; // Optional as it is the default.&lt;/P&gt;&lt;P&gt;// ... QueryTask will execute with the above QueryParams to find intersected points on a layer. //&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;var queryParams = new Query();&lt;BR /&gt;queryParams.geometry = geometry; // This is the polygon shape.&lt;BR /&gt;queryParams.spatialRelationship = Query.SPATIAL_REL_DIFFERENCE; // Or something like that.&lt;/P&gt;&lt;P&gt;// QueryTask will execute with the QueryParams to find the difference between the points and polygon. //&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have tried to use "SPATIAL_REL_RELATION" but no luck:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;var queryParams = new Query();&lt;BR /&gt; queryParams.geometry = geometry;&amp;nbsp;&lt;SPAN style="background-color: #f6f6f6;"&gt;// This is the polygon shape.&lt;/SPAN&gt;&lt;BR /&gt; queryParams.spatialRelationship = Query.SPATIAL_REL_RELATION;&lt;BR /&gt; queryParams.relationParam = "G1 NOT INTERSECT G2";&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a huge number of points to deal with, so it is not practical to get all points, then find the intersected points, then subtract.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am using ArcGIS API for JavaScript version 3.22.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Aug 2019 04:22:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/excluding-intersected-area-points/m-p/533748#M49759</guid>
      <dc:creator>HenryKo2</dc:creator>
      <dc:date>2019-08-07T04:22:51Z</dc:date>
    </item>
    <item>
      <title>Re: Excluding Intersected Area/Points</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/excluding-intersected-area-points/m-p/533749#M49760</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P class=""&gt;Henry,&lt;/P&gt;&lt;P class=""&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp; The way that I would do this is to query for ids of the point that intersect and then use those ids in the returned array to formulate your query.where = “NOT OBJECTID IN (“ + oidarray.join(“,”) +”)”;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Aug 2019 05:00:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/excluding-intersected-area-points/m-p/533749#M49760</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2019-08-07T05:00:26Z</dc:date>
    </item>
    <item>
      <title>Re: Excluding Intersected Area/Points</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/excluding-intersected-area-points/m-p/533750#M49761</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migrated-users/3101"&gt;Robert Scheitlin, GISP&lt;/A&gt; One&amp;nbsp;promising way to do this, although I haven't tested fully, is to use the underlying database SDE spatial functions as the where-clause. We are using Oracle SDE ST_Geometry type, so in the database I can run plain SQL statement to find intersected points and an input polygon, like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;SELECT POINT_ID&lt;BR /&gt;FROM MY_POINTS &lt;BR /&gt;WHERE SDE.ST_INTERSECTS(SHAPE, SDE.ST_GEOMETRY('POLYGON ((9689836.255 4420129.191, 9690576.399 4420184.417 , 9690295.144 4419703.323, 9689836.255 4420129.191))', 3308)) = 1 AND SHAPE IS NOT NULL&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here, I am using the SDE functions to do the intersect, with the input polygon given as a plain WKT string (spatial reference is 3308).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now, I am able to use the above where clause on the map service to do the same. First I need to convert the input polygon into WKT string, then basically run the above query with a "not in" to find points outside of the intersected polygon:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P style="border: 0px;"&gt;var queryParams = new Query();&lt;BR /&gt;queryParams.where = 'POINT_ID NOT IN (SELECT POINT_ID FROM MY_POINTS WHERE SDE.ST_INTERSECTS(SHAPE, SDE.ST_GEOMETRY('POLYGON ((9689836.255 4420129.191, 9690576.399 4420184.417 , 9690295.144 4419703.323, 9689836.255 4420129.191))', 3308)) = 1 AND SHAPE IS NOT NULL)';&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P style="border: 0px;"&gt;&lt;/P&gt;&lt;P style="border: 0px;"&gt;Still need to test for performance, write the actual JavaScript code, test what if the WKT string is too long... etc, but looks promising so far (e.g. I can dump that where-clause into the map service query REST end-point and it works).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Aug 2019 01:50:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/excluding-intersected-area-points/m-p/533750#M49761</guid>
      <dc:creator>HenryKo2</dc:creator>
      <dc:date>2019-08-08T01:50:27Z</dc:date>
    </item>
  </channel>
</rss>

