<?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: Spatial Query For Points Within Polygon in ArcGIS REST APIs and Services Questions</title>
    <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/spatial-query-for-points-within-polygon/m-p/293136#M1444</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;[SOLVED]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Robert,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The clockwise direction was key to making this work, I missed that important factor! I also realized my query was not correctly formatted for the polygon. I had found an example that told me to format it as I have shown in the images, but that was wrong. I needed to format it in the same way as the JSON response format.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WHAT I HAD:&lt;/P&gt;&lt;P&gt;[[-84.501150208,42.6413587068],[-84.5007299597,42.6418125078],[-84.5011948403,42.6421347441],[-84.5009356319,42.6424767877],[-84.4989507973,42.6423978669],[-84.4980388462,42.6429174009],[-84.4977169811,42.6425425286],[-84.5010250027,42.640878621],[-84.501150208,42.6413587068]]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WHAT IS CORRECT:&lt;/P&gt;&lt;P&gt;{"rings":[[[-84.501150208,42.6413587068],[-84.5007299597,42.6418125078],[-84.5011948403,42.6421347441],[-84.5009356319,42.6424767877],[-84.4989507973,42.6423978669],[-84.4980388462,42.6429174009],[-84.4977169811,42.6425425286],[-84.5010250027,42.640878621],[-84.501150208,42.6413587068]]],"spatialReference":{"wkid":4326}}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My final query string was as follows:&lt;/P&gt;&lt;P&gt;&lt;A class="unlinked" href="https://xxxxxxxxx.arcgis.com/xxxxxxxxxxxxxxx/arcgis/rest/services/FeatureName/FeatureServer/0/query?where=1%3D1&amp;amp;objectIds=&amp;amp;time=&amp;amp;geometry={&amp;quot;rings&amp;quot;:[[[-84.501150208,42.6413587068],[-84.5007299597,42.6418125078],[-84.5011948403,42.6421347441],[-84.5009356319,42.6424767877],[-84.4989507973,42.6423978669],[-84.4980388462,42.6429174009],[-84.4977169811,42.6425425286],[-84.5010250027,42.640878621],[-84.501150208,42.6413587068]]],&amp;quot;spatialReference&amp;quot;:{&amp;quot;wkid&amp;quot;:4326}}&amp;amp;geometryType=esriGeometryPolygon&amp;amp;inSR=4326&amp;amp;spatialRel=esriSpatialRelIntersects&amp;amp;resultType=none&amp;amp;distance=0.0&amp;amp;units=esriSRUnit_Meter&amp;amp;returnGeodetic=true&amp;amp;outFields=*&amp;amp;returnGeometry=true&amp;amp;multipatchOption=xyFootprint&amp;amp;maxAllowableOffset=&amp;amp;geometryPrecision=&amp;amp;outSR=4326&amp;amp;datumTransformation=&amp;amp;applyVCSProjection=false&amp;amp;returnIdsOnly=false&amp;amp;returnUniqueIdsOnly=false&amp;amp;returnCountOnly=false&amp;amp;returnExtentOnly=false&amp;amp;returnDistinctValues=false&amp;amp;orderByFields=&amp;amp;groupByFieldsForStatistics=&amp;amp;outStatistics=&amp;amp;having=&amp;amp;resultOffset=&amp;amp;resultRecordCount=&amp;amp;returnZ=false&amp;amp;returnM=false&amp;amp;returnExceededLimitFeatures=true&amp;amp;quantizationParameters=&amp;amp;sqlFormat=none&amp;amp;f=pjson&amp;amp;token=0kjcZj3j9rezZOr_narGYQqSlOQpWkTR_GjtcqFjG4pdBIVtiOhyMy2aMQO0LU4Xbu6C7T6s9W409CpqndiPzshe27STH-mmRyGNbHdDQKmwWyWG1kNVG0WtpuztX64E20uiMOSrmFRBeCNAts7gThY5UqwAu5-"&gt;https://xxxxxxxxx.arcgis.com/xxxxxxxxxxxxxxx/arcgis/rest/services/FeatureName/FeatureServer/0/query?where=1%3D1&amp;amp;objectIds=&amp;amp;time=&amp;amp;geometry={"rings":[[[-84.501150208,42.6413587068],[-84.5007299597,42.6418125078],[-84.5011948403,42.6421347441],[-84.5009356319,42.6424767877],[-84.4989507973,42.6423978669],[-84.4980388462,42.6429174009],[-84.4977169811,42.6425425286],[-84.5010250027,42.640878621],[-84.501150208,42.6413587068]]],"spatialReference":{"wkid":4326}}&amp;amp;geometryType=esriGeometryPolygon&amp;amp;inSR=4326&amp;amp;spatialRel=esriSpatialRelIntersects&amp;amp;resultType=none&amp;amp;distance=0.0&amp;amp;units=esriSRUnit_Meter&amp;amp;returnGeodetic=true&amp;amp;outFields=*&amp;amp;returnGeometry=true&amp;amp;multipatchOption=xyFootprint&amp;amp;maxAllowableOffset=&amp;amp;geometryPrecision=&amp;amp;outSR=4326&amp;amp;datumTransformation=&amp;amp;applyVCSProjection=false&amp;amp;returnIdsOnly=false&amp;amp;returnUniqueIdsOnly=false&amp;amp;returnCountOnly=false&amp;amp;returnExtentOnly=false&amp;amp;returnDistinctValues=false&amp;amp;orderByFields=&amp;amp;groupByFieldsForStatistics=&amp;amp;outStatistics=&amp;amp;having=&amp;amp;resultOffset=&amp;amp;resultRecordCount=&amp;amp;returnZ=false&amp;amp;returnM=false&amp;amp;returnExceededLimitFeatures=true&amp;amp;quantizationParameters=&amp;amp;sqlFormat=none&amp;amp;f=pjson&amp;amp;token=&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 02 Oct 2018 17:24:16 GMT</pubDate>
    <dc:creator>JosephEastman</dc:creator>
    <dc:date>2018-10-02T17:24:16Z</dc:date>
    <item>
      <title>Spatial Query For Points Within Polygon</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/spatial-query-for-points-within-polygon/m-p/293134#M1442</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm having a lot of trouble running a spatial query to find all&amp;nbsp;features that intersect with a polygon.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've got a hosted feature service made up of polylines that represent water mains in a distribution system. What I'm trying to do is a spatial query that takes a polygon, made up&amp;nbsp;of a series of latitudes and longitudes, and finds all features of the hosted feature&amp;nbsp;service that intersect (or fall within)&amp;nbsp;that polygon. I've been using the query tool on the service url to help troubleshoot and this is what I'm doing right now:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/423489_Capture1.JPG" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="image-2 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/423490_Capture2.JPG" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The beginning point and ending point are the same as required,&amp;nbsp;I know you can't see it in the screenshot. One interesting thing is that this requires a WHERE clause to run. To work around this I've place "1=1" in the where clause so that I get all of the results. The problem here is that I literally get every single feature, not just what intersects the polygon.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there any way to achieve what I'm after? I have searched stackoverflow, geoNet and google for many hours and tried many iterations and cannot for the life of me get this to work. Any help is appreciated!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Oct 2018 16:21:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/spatial-query-for-points-within-polygon/m-p/293134#M1442</guid>
      <dc:creator>JosephEastman</dc:creator>
      <dc:date>2018-10-02T16:21:09Z</dc:date>
    </item>
    <item>
      <title>Re: Spatial Query For Points Within Polygon</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/spatial-query-for-points-within-polygon/m-p/293135#M1443</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Joseph,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;Using a where clause of 1=1 will return all the feature period. When doing a spatial query you should not use 1=1 in the where. Also you need to ensure that your points make the polygon are listed in a clockwise direction or the query will fail.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Oct 2018 16:48:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/spatial-query-for-points-within-polygon/m-p/293135#M1443</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2018-10-02T16:48:54Z</dc:date>
    </item>
    <item>
      <title>Re: Spatial Query For Points Within Polygon</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/spatial-query-for-points-within-polygon/m-p/293136#M1444</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;[SOLVED]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Robert,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The clockwise direction was key to making this work, I missed that important factor! I also realized my query was not correctly formatted for the polygon. I had found an example that told me to format it as I have shown in the images, but that was wrong. I needed to format it in the same way as the JSON response format.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WHAT I HAD:&lt;/P&gt;&lt;P&gt;[[-84.501150208,42.6413587068],[-84.5007299597,42.6418125078],[-84.5011948403,42.6421347441],[-84.5009356319,42.6424767877],[-84.4989507973,42.6423978669],[-84.4980388462,42.6429174009],[-84.4977169811,42.6425425286],[-84.5010250027,42.640878621],[-84.501150208,42.6413587068]]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WHAT IS CORRECT:&lt;/P&gt;&lt;P&gt;{"rings":[[[-84.501150208,42.6413587068],[-84.5007299597,42.6418125078],[-84.5011948403,42.6421347441],[-84.5009356319,42.6424767877],[-84.4989507973,42.6423978669],[-84.4980388462,42.6429174009],[-84.4977169811,42.6425425286],[-84.5010250027,42.640878621],[-84.501150208,42.6413587068]]],"spatialReference":{"wkid":4326}}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My final query string was as follows:&lt;/P&gt;&lt;P&gt;&lt;A class="unlinked" href="https://xxxxxxxxx.arcgis.com/xxxxxxxxxxxxxxx/arcgis/rest/services/FeatureName/FeatureServer/0/query?where=1%3D1&amp;amp;objectIds=&amp;amp;time=&amp;amp;geometry={&amp;quot;rings&amp;quot;:[[[-84.501150208,42.6413587068],[-84.5007299597,42.6418125078],[-84.5011948403,42.6421347441],[-84.5009356319,42.6424767877],[-84.4989507973,42.6423978669],[-84.4980388462,42.6429174009],[-84.4977169811,42.6425425286],[-84.5010250027,42.640878621],[-84.501150208,42.6413587068]]],&amp;quot;spatialReference&amp;quot;:{&amp;quot;wkid&amp;quot;:4326}}&amp;amp;geometryType=esriGeometryPolygon&amp;amp;inSR=4326&amp;amp;spatialRel=esriSpatialRelIntersects&amp;amp;resultType=none&amp;amp;distance=0.0&amp;amp;units=esriSRUnit_Meter&amp;amp;returnGeodetic=true&amp;amp;outFields=*&amp;amp;returnGeometry=true&amp;amp;multipatchOption=xyFootprint&amp;amp;maxAllowableOffset=&amp;amp;geometryPrecision=&amp;amp;outSR=4326&amp;amp;datumTransformation=&amp;amp;applyVCSProjection=false&amp;amp;returnIdsOnly=false&amp;amp;returnUniqueIdsOnly=false&amp;amp;returnCountOnly=false&amp;amp;returnExtentOnly=false&amp;amp;returnDistinctValues=false&amp;amp;orderByFields=&amp;amp;groupByFieldsForStatistics=&amp;amp;outStatistics=&amp;amp;having=&amp;amp;resultOffset=&amp;amp;resultRecordCount=&amp;amp;returnZ=false&amp;amp;returnM=false&amp;amp;returnExceededLimitFeatures=true&amp;amp;quantizationParameters=&amp;amp;sqlFormat=none&amp;amp;f=pjson&amp;amp;token=0kjcZj3j9rezZOr_narGYQqSlOQpWkTR_GjtcqFjG4pdBIVtiOhyMy2aMQO0LU4Xbu6C7T6s9W409CpqndiPzshe27STH-mmRyGNbHdDQKmwWyWG1kNVG0WtpuztX64E20uiMOSrmFRBeCNAts7gThY5UqwAu5-"&gt;https://xxxxxxxxx.arcgis.com/xxxxxxxxxxxxxxx/arcgis/rest/services/FeatureName/FeatureServer/0/query?where=1%3D1&amp;amp;objectIds=&amp;amp;time=&amp;amp;geometry={"rings":[[[-84.501150208,42.6413587068],[-84.5007299597,42.6418125078],[-84.5011948403,42.6421347441],[-84.5009356319,42.6424767877],[-84.4989507973,42.6423978669],[-84.4980388462,42.6429174009],[-84.4977169811,42.6425425286],[-84.5010250027,42.640878621],[-84.501150208,42.6413587068]]],"spatialReference":{"wkid":4326}}&amp;amp;geometryType=esriGeometryPolygon&amp;amp;inSR=4326&amp;amp;spatialRel=esriSpatialRelIntersects&amp;amp;resultType=none&amp;amp;distance=0.0&amp;amp;units=esriSRUnit_Meter&amp;amp;returnGeodetic=true&amp;amp;outFields=*&amp;amp;returnGeometry=true&amp;amp;multipatchOption=xyFootprint&amp;amp;maxAllowableOffset=&amp;amp;geometryPrecision=&amp;amp;outSR=4326&amp;amp;datumTransformation=&amp;amp;applyVCSProjection=false&amp;amp;returnIdsOnly=false&amp;amp;returnUniqueIdsOnly=false&amp;amp;returnCountOnly=false&amp;amp;returnExtentOnly=false&amp;amp;returnDistinctValues=false&amp;amp;orderByFields=&amp;amp;groupByFieldsForStatistics=&amp;amp;outStatistics=&amp;amp;having=&amp;amp;resultOffset=&amp;amp;resultRecordCount=&amp;amp;returnZ=false&amp;amp;returnM=false&amp;amp;returnExceededLimitFeatures=true&amp;amp;quantizationParameters=&amp;amp;sqlFormat=none&amp;amp;f=pjson&amp;amp;token=&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Oct 2018 17:24:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/spatial-query-for-points-within-polygon/m-p/293136#M1444</guid>
      <dc:creator>JosephEastman</dc:creator>
      <dc:date>2018-10-02T17:24:16Z</dc:date>
    </item>
    <item>
      <title>Re: Spatial Query For Points Within Polygon</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/spatial-query-for-points-within-polygon/m-p/293137#M1445</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Don't forget to mark this question as answered by clicking on the "Mark Correct" link on the reply that answered your question.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Oct 2018 18:19:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/spatial-query-for-points-within-polygon/m-p/293137#M1445</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2018-10-02T18:19:24Z</dc:date>
    </item>
  </channel>
</rss>

