<?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 How to query MapServer service by polygon? in ArcGIS Enterprise Questions</title>
    <link>https://community.esri.com/t5/arcgis-enterprise-questions/how-to-query-mapserver-service-by-polygon/m-p/1110416#M31374</link>
    <description>&lt;P&gt;I'm attempting to pull a json response of Point records that fall within an arbitrarily defined polygon from an ArcGIS REST endpoint (MapServer).&amp;nbsp; The endpoint supports JSON response and querying.&amp;nbsp; Everything is in EPSG 4326, nothing weird.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to query it by esriGeometryPolygon.&lt;/P&gt;&lt;P&gt;It is a simple 4-sided polygon built clockwise.&amp;nbsp; Coords are in Y,X format.&lt;/P&gt;&lt;P&gt;My ring looks like this:&lt;/P&gt;&lt;P&gt;{"rings":[[[10,20],[10,40],[30,40],[30,20],[10,20]]]}&lt;/P&gt;&lt;P&gt;I figure the "spatialReference" element defaults to 4326 for json though couldn't find that explicitly stated in documentation.&amp;nbsp; However, adding the spatialReference property makes no difference.&lt;/P&gt;&lt;P&gt;I am wrapping this all in a GET call that looks like this (the server is not internet accessible so I'm making it generic):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://server/arcgis/rest/services/PARENT/SERVICENAME/MapServer/0/query?geometry=" target="_blank" rel="noopener"&gt;https://server/arcgis/rest/services/PARENT/SERVICENAME/MapServer/0/query?geometry=&lt;/A&gt;{"rings":[[[10,20],[10,40],[30,40],[30,20],[10,20]]]}&amp;amp;geometryType=esriGeometryPolygon&amp;amp;spatialRel=esriSpatialRelIntersects&amp;amp;outFields=FIELDNAME&amp;amp;returnGeometry=false&amp;amp;returnTrueCurves=false&amp;amp;returnIdsOnly=false&amp;amp;returnCountOnly=false&amp;amp;returnZ=false&amp;amp;returnDistinctValues=false&amp;amp;returnExtentsOnly=false&amp;amp;f=pjson&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I go to this area on the service, there are definitely features within the polygon.&amp;nbsp; However, they will not return via this query.&amp;nbsp; So I figure I'm doing something wrong in structuring my request.&amp;nbsp; Even on the REST querying documentation there are no examples showing how to clearly return record properties from a MapServer service based on a Polygon object.&lt;/P&gt;</description>
    <pubDate>Fri, 22 Oct 2021 20:49:10 GMT</pubDate>
    <dc:creator>EricEagle</dc:creator>
    <dc:date>2021-10-22T20:49:10Z</dc:date>
    <item>
      <title>How to query MapServer service by polygon?</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/how-to-query-mapserver-service-by-polygon/m-p/1110416#M31374</link>
      <description>&lt;P&gt;I'm attempting to pull a json response of Point records that fall within an arbitrarily defined polygon from an ArcGIS REST endpoint (MapServer).&amp;nbsp; The endpoint supports JSON response and querying.&amp;nbsp; Everything is in EPSG 4326, nothing weird.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to query it by esriGeometryPolygon.&lt;/P&gt;&lt;P&gt;It is a simple 4-sided polygon built clockwise.&amp;nbsp; Coords are in Y,X format.&lt;/P&gt;&lt;P&gt;My ring looks like this:&lt;/P&gt;&lt;P&gt;{"rings":[[[10,20],[10,40],[30,40],[30,20],[10,20]]]}&lt;/P&gt;&lt;P&gt;I figure the "spatialReference" element defaults to 4326 for json though couldn't find that explicitly stated in documentation.&amp;nbsp; However, adding the spatialReference property makes no difference.&lt;/P&gt;&lt;P&gt;I am wrapping this all in a GET call that looks like this (the server is not internet accessible so I'm making it generic):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://server/arcgis/rest/services/PARENT/SERVICENAME/MapServer/0/query?geometry=" target="_blank" rel="noopener"&gt;https://server/arcgis/rest/services/PARENT/SERVICENAME/MapServer/0/query?geometry=&lt;/A&gt;{"rings":[[[10,20],[10,40],[30,40],[30,20],[10,20]]]}&amp;amp;geometryType=esriGeometryPolygon&amp;amp;spatialRel=esriSpatialRelIntersects&amp;amp;outFields=FIELDNAME&amp;amp;returnGeometry=false&amp;amp;returnTrueCurves=false&amp;amp;returnIdsOnly=false&amp;amp;returnCountOnly=false&amp;amp;returnZ=false&amp;amp;returnDistinctValues=false&amp;amp;returnExtentsOnly=false&amp;amp;f=pjson&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I go to this area on the service, there are definitely features within the polygon.&amp;nbsp; However, they will not return via this query.&amp;nbsp; So I figure I'm doing something wrong in structuring my request.&amp;nbsp; Even on the REST querying documentation there are no examples showing how to clearly return record properties from a MapServer service based on a Polygon object.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Oct 2021 20:49:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/how-to-query-mapserver-service-by-polygon/m-p/1110416#M31374</guid>
      <dc:creator>EricEagle</dc:creator>
      <dc:date>2021-10-22T20:49:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to query MapServer service by polygon?</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/how-to-query-mapserver-service-by-polygon/m-p/1110417#M31375</link>
      <description>&lt;P&gt;Do you have a corresponding feature service? I don't know that spatial queries work on Map Image services. Or at least, I've not been able to do so.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Oct 2021 20:55:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/how-to-query-mapserver-service-by-polygon/m-p/1110417#M31375</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2021-10-22T20:55:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to query MapServer service by polygon?</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/how-to-query-mapserver-service-by-polygon/m-p/1110422#M31376</link>
      <description>&lt;P&gt;I'd recommend going to the query? endpoint of the service when dealing with these.&amp;nbsp; Then looking at the query being set when you press the query button, either in dev tools or the url formed.&lt;/P&gt;&lt;LI-CODE lang="c"&gt;geometry={"rings":[[[10,20],[10,40],[30,40],[30,20],[10,20]]],"spatialReference":{"wkid":4326,"latestWkid":4326}}}&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 22 Oct 2021 21:13:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/how-to-query-mapserver-service-by-polygon/m-p/1110422#M31376</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2021-10-22T21:13:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to query MapServer service by polygon?</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/how-to-query-mapserver-service-by-polygon/m-p/1110428#M31377</link>
      <description>&lt;P&gt;So, I had taken coordinate pairs I was using with the esriGeometryEnvelope object (YX) and followed the same YX order with the esriGeometryPolygon.&lt;/P&gt;&lt;P&gt;When flipping the pairs to XY, it worked.&lt;/P&gt;&lt;P&gt;Not sure why that should be the case, but if different pair order for different geometry objects in the same API is a thing, I feel like someone on the QA side of the house might've missed something...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/363906"&gt;@jcarlson&lt;/a&gt;&amp;nbsp; - yes it does definitely work&lt;/P&gt;&lt;P&gt;And thank you&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/167692"&gt;@DavidPike&lt;/a&gt;&amp;nbsp;yes that is where I started on this before moving to python&lt;/P&gt;</description>
      <pubDate>Fri, 22 Oct 2021 21:29:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/how-to-query-mapserver-service-by-polygon/m-p/1110428#M31377</guid>
      <dc:creator>EricEagle</dc:creator>
      <dc:date>2021-10-22T21:29:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to query MapServer service by polygon?</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/how-to-query-mapserver-service-by-polygon/m-p/1110429#M31378</link>
      <description>&lt;P&gt;Ah, good! I know that spatial filters don't work in Dashboards for whatever reason. I hardly ever use them, but good to know that spatial query parameters will still work.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Oct 2021 21:30:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/how-to-query-mapserver-service-by-polygon/m-p/1110429#M31378</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2021-10-22T21:30:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to query MapServer service by polygon?</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/how-to-query-mapserver-service-by-polygon/m-p/1110930#M31390</link>
      <description>&lt;P&gt;Just as FYI: both map service (aka map image layer) and feature service query operations follow the same specs. That is why you can add a feature layer in your web map off a map service or a feature service. When you add a feature layer off a map service, Editing is the only capability you won't have.&lt;/P&gt;&lt;P&gt;here is an example of a map service query request with polygon spatial filter:&lt;/P&gt;&lt;P&gt;&lt;A href="https://sampleserver6.arcgisonline.com/arcgis/rest/services/SampleWorldCities/MapServer/0/query?geometry=%7B++%22rings%22+%3A+%5B%5B%5B-50%2C10%5D%2C%5B-50%2C50%5D%2C%5B10%2C50%5D%2C%5B10%2C-50%5D%2C++++++++++++++%5B-50%2C10%5D%5D%5D%2C++%22spatialReference%22+%3A+%7B%22wkid%22+%3A+4326%7D%7D&amp;amp;geometryType=esriGeometryPolygon&amp;amp;spatialRel=esriSpatialRelIntersects&amp;amp;returnGeometry=true&amp;amp;f=html" target="_blank"&gt;https://sampleserver6.arcgisonline.com/arcgis/rest/services/SampleWorldCities/MapServer/0/query?geometry=%7B++%22rings%22+%3A+%5B%5B%5B-50%2C10%5D%2C%5B-50%2C50%5D%2C%5B10%2C50%5D%2C%5B10%2C-50%5D%2C++++++++++++++%5B-50%2C10%5D%5D%5D%2C++%22spatialReference%22+%3A+%7B%22wkid%22+%3A+4326%7D%7D&amp;amp;geometryType=esriGeometryPolygon&amp;amp;spatialRel=esriSpatialRelIntersects&amp;amp;returnGeometry=true&amp;amp;f=html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Oct 2021 17:01:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/how-to-query-mapserver-service-by-polygon/m-p/1110930#M31390</guid>
      <dc:creator>TanuHoque</dc:creator>
      <dc:date>2021-10-25T17:01:04Z</dc:date>
    </item>
  </channel>
</rss>

