<?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 Input geometry point spatial query in ArcGIS REST APIs and Services Questions</title>
    <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/input-geometry-point-spatial-query/m-p/1401173#M4709</link>
    <description>&lt;P&gt;When attempting to use point geometry as inputGeometry to query our Parcels REST service, it doesn't fail but it does return all parcels when I'm expecting only 1 parcel to be in the result.&amp;nbsp; Also, successfully doing a similar spatial query using polygon geometry so not sure why we're seeing a different result using point feature as the inputGeometry.&lt;/P&gt;&lt;P&gt;Using the "geometry" values in the example below as the input directly in the REST query interface returns the correct result.&lt;/P&gt;&lt;P&gt;Example input payload to the request:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;{
  "f": "json",
  "geometryType": "esriGeometryPoint",
  "geometry": {
    "x": 952887.1388473287,
    "y": 830228.6453575715,
    "spatialReference": {
      "wkid": 2881
    }
  },
  "spatialRel": "esriSpatialRelIntersects",
  "distance": 0,
  "units": "esriSRUnit_Foot",
  "inSR": 2881,
  "where": "1=1",
  "outFields": "PARNO",
  "returnGeometry": "false",
  "returnCountOnly": "true",
  "featureEncoding": "esriDefault",
  "token": "validtoken"
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is being run via Python 3.x using the requests library (again, successfully with other geometry types).&amp;nbsp; In this code sample below the "geom" variable is as described in the "geometry" attribute above.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;queryURL_parcels = 'https://{}/ourdevserver/rest/services/LandOwnershipAndInterests/NormalizedParcels/FeatureServer/0/query'.format(portalUrlBase)
    params = {'f': 'json',
              'geometryType': 'esriGeometryPoint',
              'geometry': geom,
              'spatialRel': 'esriSpatialRelIntersects',
              'distance': 0.0,
              'units': 'esriSRUnit_Foot',
              'inSR': 2881,
              'where': '1=1',
              'outFields': 'PARNO',
              'returnGeometry': 'false',
              'returnCountOnly': 'true',
              'token': tok}

    print(json.dumps(params))
    r = requests.post(queryURL_parcels, data = params, verify=False)
    response = json.loads(r.content)
    print(response)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Since the returnCountOnly param is true then we get back all 4million parcels in the layer, expecting only 1 feature in the count/result.&lt;/P&gt;&lt;P&gt;Hopefully someone can spot what I'm missing because I've attempted all combinations of geometry formats.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 26 Mar 2024 21:15:08 GMT</pubDate>
    <dc:creator>JamesCrandall</dc:creator>
    <dc:date>2024-03-26T21:15:08Z</dc:date>
    <item>
      <title>Input geometry point spatial query</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/input-geometry-point-spatial-query/m-p/1401173#M4709</link>
      <description>&lt;P&gt;When attempting to use point geometry as inputGeometry to query our Parcels REST service, it doesn't fail but it does return all parcels when I'm expecting only 1 parcel to be in the result.&amp;nbsp; Also, successfully doing a similar spatial query using polygon geometry so not sure why we're seeing a different result using point feature as the inputGeometry.&lt;/P&gt;&lt;P&gt;Using the "geometry" values in the example below as the input directly in the REST query interface returns the correct result.&lt;/P&gt;&lt;P&gt;Example input payload to the request:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;{
  "f": "json",
  "geometryType": "esriGeometryPoint",
  "geometry": {
    "x": 952887.1388473287,
    "y": 830228.6453575715,
    "spatialReference": {
      "wkid": 2881
    }
  },
  "spatialRel": "esriSpatialRelIntersects",
  "distance": 0,
  "units": "esriSRUnit_Foot",
  "inSR": 2881,
  "where": "1=1",
  "outFields": "PARNO",
  "returnGeometry": "false",
  "returnCountOnly": "true",
  "featureEncoding": "esriDefault",
  "token": "validtoken"
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is being run via Python 3.x using the requests library (again, successfully with other geometry types).&amp;nbsp; In this code sample below the "geom" variable is as described in the "geometry" attribute above.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;queryURL_parcels = 'https://{}/ourdevserver/rest/services/LandOwnershipAndInterests/NormalizedParcels/FeatureServer/0/query'.format(portalUrlBase)
    params = {'f': 'json',
              'geometryType': 'esriGeometryPoint',
              'geometry': geom,
              'spatialRel': 'esriSpatialRelIntersects',
              'distance': 0.0,
              'units': 'esriSRUnit_Foot',
              'inSR': 2881,
              'where': '1=1',
              'outFields': 'PARNO',
              'returnGeometry': 'false',
              'returnCountOnly': 'true',
              'token': tok}

    print(json.dumps(params))
    r = requests.post(queryURL_parcels, data = params, verify=False)
    response = json.loads(r.content)
    print(response)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Since the returnCountOnly param is true then we get back all 4million parcels in the layer, expecting only 1 feature in the count/result.&lt;/P&gt;&lt;P&gt;Hopefully someone can spot what I'm missing because I've attempted all combinations of geometry formats.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Mar 2024 21:15:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/input-geometry-point-spatial-query/m-p/1401173#M4709</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2024-03-26T21:15:08Z</dc:date>
    </item>
    <item>
      <title>Re: Input geometry point spatial query</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/input-geometry-point-spatial-query/m-p/1401403#M4711</link>
      <description>&lt;P&gt;The input geometry attribute is expecting a string of coordinate pairs.&amp;nbsp; I was simply passing in the geom object of the result from another query/response of the point layer:&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;'geometry': geom&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Simply putting this into a string solves the issue:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;'geometry': '{},{}'.format(geom['x'],geom['y'])&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 27 Mar 2024 13:12:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/input-geometry-point-spatial-query/m-p/1401403#M4711</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2024-03-27T13:12:44Z</dc:date>
    </item>
  </channel>
</rss>

