<?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: How to Query a Feature Layer with an Intersecting Point? in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-query-a-feature-layer-with-an-intersecting/m-p/875747#M4895</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry for confusion with arcpy instead Python API&lt;/P&gt;&lt;P&gt;As per Python API, we can use the parameter for geometry_filter&lt;/P&gt;&lt;P&gt;&lt;CODE class="" style="color: #000000; background: transparent; border: none; font-weight: bold;"&gt;query&lt;/CODE&gt;&lt;SPAN class="" style="color: #555555; font-weight: bold;"&gt;(&lt;/SPAN&gt;&lt;EM style="color: #555555; font-weight: bold;"&gt;layer_defs_filter=None&lt;/EM&gt;&lt;SPAN style="color: #555555; background-color: #f0f0f0; font-weight: bold;"&gt;,&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;EM style="color: #555555; font-weight: bold;"&gt;geometry_filter=None&lt;/EM&gt;&lt;SPAN style="color: #555555; background-color: #f0f0f0; font-weight: bold;"&gt;,&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;EM style="color: #555555; font-weight: bold;"&gt;time_filter=None&lt;/EM&gt;&lt;SPAN style="color: #555555; background-color: #f0f0f0; font-weight: bold;"&gt;,&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;EM style="color: #555555; font-weight: bold;"&gt;return_geometry=True&lt;/EM&gt;&lt;SPAN style="color: #555555; background-color: #f0f0f0; font-weight: bold;"&gt;,&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;EM style="color: #555555; font-weight: bold;"&gt;return_ids_only=False&lt;/EM&gt;&lt;SPAN style="color: #555555; background-color: #f0f0f0; font-weight: bold;"&gt;,&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;EM style="color: #555555; font-weight: bold;"&gt;return_count_only=False&lt;/EM&gt;&lt;SPAN style="color: #555555; background-color: #f0f0f0; font-weight: bold;"&gt;,&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;EM style="color: #555555; font-weight: bold;"&gt;return_z=False&lt;/EM&gt;&lt;SPAN style="color: #555555; background-color: #f0f0f0; font-weight: bold;"&gt;,&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;EM style="color: #555555; font-weight: bold;"&gt;return_m=False&lt;/EM&gt;&lt;SPAN style="color: #555555; background-color: #f0f0f0; font-weight: bold;"&gt;,&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;EM style="color: #555555; font-weight: bold;"&gt;out_sr=None&lt;/EM&gt;&lt;SPAN class="" style="color: #555555; font-weight: bold;"&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="" style="color: #555555; font-weight: bold;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d;"&gt;define geometry filter to use as parameter for feature_layer.query method&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="border: none windowtext 1.0pt; padding: 0in; color: black; font-size: 10.0pt;"&gt;arcgis.geometry.filters.contains&lt;/STRONG&gt;&lt;SPAN&gt;&lt;STRONG style="color: #2980b9;"&gt;(&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;EM&gt;&lt;STRONG style="color: #2980b9;"&gt;point&lt;/STRONG&gt;&lt;/EM&gt;&lt;SPAN&gt;&lt;STRONG style="color: #2980b9;"&gt;)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 02 Apr 2018 18:15:24 GMT</pubDate>
    <dc:creator>BalajiVeera</dc:creator>
    <dc:date>2018-04-02T18:15:24Z</dc:date>
    <item>
      <title>How to Query a Feature Layer with an Intersecting Point?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-query-a-feature-layer-with-an-intersecting/m-p/875744#M4892</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a point,&amp;nbsp;created with&amp;nbsp;arcgis.geometry.Point, that I wish to use in a feature layer query to only return the records that intersect that point.&amp;nbsp; I can do this via the REST API by setting the geometry parameters, but I am struggling to figure out how to do this with the Python API.&amp;nbsp; I have read the reference guide and examples, but still not sure how to do this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help would be much appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Apr 2018 15:41:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-query-a-feature-layer-with-an-intersecting/m-p/875744#M4892</guid>
      <dc:creator>MikeBrown4</dc:creator>
      <dc:date>2018-04-02T15:41:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to Query a Feature Layer with an Intersecting Point?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-query-a-feature-layer-with-an-intersecting/m-p/875745#M4893</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;To do same in Python, create the PointGeometry&amp;nbsp;first&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #595959; background-color: #f8f8f8;"&gt;point = arcpy.Point(x, y)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #595959; background-color: #f8f8f8;"&gt;pointGeometry = arcpy.PointGeometry(point)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #595959; background-color: #f8f8f8;"&gt;Apply the same PointGeometry in SelectLayerByLocation_management&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #595959; background-color: #f8f8f8;"&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;arcpy&lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;SelectLayerByLocation_management&lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #a31515;"&gt;'query_feature_layer'&lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="color: #4d4d4d; background-color: #fafafa;"&gt; &lt;/SPAN&gt;&lt;SPAN class="" style="color: #a31515;"&gt;'CONTAINS'&lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="color: #4d4d4d; background-color: #fafafa;"&gt; pointGeometry&lt;/SPAN&gt;&lt;SPAN class="" style="color: #4d4d4d;"&gt;)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Apr 2018 17:24:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-query-a-feature-layer-with-an-intersecting/m-p/875745#M4893</guid>
      <dc:creator>BalajiVeera</dc:creator>
      <dc:date>2018-04-02T17:24:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to Query a Feature Layer with an Intersecting Point?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-query-a-feature-layer-with-an-intersecting/m-p/875746#M4894</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for the response.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to do this through the Python API, not with arcpy.&amp;nbsp; Apologies if I did not make this clear in my question.&amp;nbsp; I am wondering if there is a way to query the feature layer and include the point to only return back records that intersect.&amp;nbsp; Something like:&amp;nbsp;&lt;/P&gt;&lt;PRE style="color: #4c4c4c; background-color: #f7f7f7; border: none; font-size: 17px;"&gt;&lt;SPAN class=""&gt;query_result&lt;/SPAN&gt; &lt;SPAN class="" style="color: #666666;"&gt;=&lt;/SPAN&gt; &lt;SPAN class=""&gt;feature_layer&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666666;"&gt;.&lt;/SPAN&gt;&lt;SPAN class=""&gt;query&lt;/SPAN&gt;&lt;SPAN class=""&gt;(&lt;/SPAN&gt;&lt;SPAN class=""&gt;where&lt;/SPAN&gt;&lt;SPAN class="" style="color: #666666;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="" style="color: #ba2121;"&gt;'1=1'&lt;/SPAN&gt;&lt;SPAN class=""&gt;, some geometry parameter&lt;/SPAN&gt;&lt;SPAN class=""&gt;)&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;Using the REST API, I would construct a query like this to only get back the record that intersects the point:&amp;nbsp;&lt;A class="unlinked"&gt;https://services6.arcgis.com/bxsVBCAOuftUsVxD/arcgis/rest/services/California_Cities/FeatureServer/0/query?where=1=1&amp;amp;geometryType=esriGeometryPoint&amp;amp;geometry=-104,35.6&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Apr 2018 17:43:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-query-a-feature-layer-with-an-intersecting/m-p/875746#M4894</guid>
      <dc:creator>MikeBrown4</dc:creator>
      <dc:date>2018-04-02T17:43:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to Query a Feature Layer with an Intersecting Point?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-query-a-feature-layer-with-an-intersecting/m-p/875747#M4895</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry for confusion with arcpy instead Python API&lt;/P&gt;&lt;P&gt;As per Python API, we can use the parameter for geometry_filter&lt;/P&gt;&lt;P&gt;&lt;CODE class="" style="color: #000000; background: transparent; border: none; font-weight: bold;"&gt;query&lt;/CODE&gt;&lt;SPAN class="" style="color: #555555; font-weight: bold;"&gt;(&lt;/SPAN&gt;&lt;EM style="color: #555555; font-weight: bold;"&gt;layer_defs_filter=None&lt;/EM&gt;&lt;SPAN style="color: #555555; background-color: #f0f0f0; font-weight: bold;"&gt;,&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;EM style="color: #555555; font-weight: bold;"&gt;geometry_filter=None&lt;/EM&gt;&lt;SPAN style="color: #555555; background-color: #f0f0f0; font-weight: bold;"&gt;,&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;EM style="color: #555555; font-weight: bold;"&gt;time_filter=None&lt;/EM&gt;&lt;SPAN style="color: #555555; background-color: #f0f0f0; font-weight: bold;"&gt;,&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;EM style="color: #555555; font-weight: bold;"&gt;return_geometry=True&lt;/EM&gt;&lt;SPAN style="color: #555555; background-color: #f0f0f0; font-weight: bold;"&gt;,&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;EM style="color: #555555; font-weight: bold;"&gt;return_ids_only=False&lt;/EM&gt;&lt;SPAN style="color: #555555; background-color: #f0f0f0; font-weight: bold;"&gt;,&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;EM style="color: #555555; font-weight: bold;"&gt;return_count_only=False&lt;/EM&gt;&lt;SPAN style="color: #555555; background-color: #f0f0f0; font-weight: bold;"&gt;,&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;EM style="color: #555555; font-weight: bold;"&gt;return_z=False&lt;/EM&gt;&lt;SPAN style="color: #555555; background-color: #f0f0f0; font-weight: bold;"&gt;,&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;EM style="color: #555555; font-weight: bold;"&gt;return_m=False&lt;/EM&gt;&lt;SPAN style="color: #555555; background-color: #f0f0f0; font-weight: bold;"&gt;,&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;EM style="color: #555555; font-weight: bold;"&gt;out_sr=None&lt;/EM&gt;&lt;SPAN class="" style="color: #555555; font-weight: bold;"&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="" style="color: #555555; font-weight: bold;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 11.5pt; color: #3d3d3d;"&gt;define geometry filter to use as parameter for feature_layer.query method&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="border: none windowtext 1.0pt; padding: 0in; color: black; font-size: 10.0pt;"&gt;arcgis.geometry.filters.contains&lt;/STRONG&gt;&lt;SPAN&gt;&lt;STRONG style="color: #2980b9;"&gt;(&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;EM&gt;&lt;STRONG style="color: #2980b9;"&gt;point&lt;/STRONG&gt;&lt;/EM&gt;&lt;SPAN&gt;&lt;STRONG style="color: #2980b9;"&gt;)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Apr 2018 18:15:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-query-a-feature-layer-with-an-intersecting/m-p/875747#M4895</guid>
      <dc:creator>BalajiVeera</dc:creator>
      <dc:date>2018-04-02T18:15:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to Query a Feature Layer with an Intersecting Point?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-query-a-feature-layer-with-an-intersecting/m-p/875748#M4896</link>
      <description>&lt;P&gt;Hi Mike,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's an example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;from arcgis.gis import GIS
from arcgis.geometry import filters
gis = GIS('https://www.arcgis.com', 'agol', 'gis123')

ptFeatureLayer = gis.content.get('11ed3710e5a54d988d9e4f9d4068ca6f')
polygonFeatureLayer = gis.content.get('48f9af87daa241c4b267c5931ad3b226')

ptFeatures = ptFeatureLayer.layers[0]
queryResult = ptFeatures.query(where='OBJECTID=10')
ptFeat = queryResult.features[0].geometry

polygonFeatures = polygonFeatureLayer.layers[0]
queryResult = polygonFeatures.query(where='1=1', return_ids_only=True, geometry_filter=filters.intersects(ptFeat))
print(queryResult)‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 04 Aug 2021 17:17:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-query-a-feature-layer-with-an-intersecting/m-p/875748#M4896</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2021-08-04T17:17:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to Query a Feature Layer with an Intersecting Point?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-query-a-feature-layer-with-an-intersecting/m-p/875749#M4897</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you, this worked great.&amp;nbsp; I used intersect to get the results I needed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;point = arcgis.geometry.Point({"x" : x, "y" : y, "spatialReference" : {"wkid" : 4326}})&lt;BR /&gt;gf = arcgis.geometry.filters.intersects(point)&lt;BR /&gt;test = cities_layer.query(where='1=1',geometry_filter=gf)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Apr 2018 20:18:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-query-a-feature-layer-with-an-intersecting/m-p/875749#M4897</guid>
      <dc:creator>MikeBrown4</dc:creator>
      <dc:date>2018-04-02T20:18:28Z</dc:date>
    </item>
  </channel>
</rss>

