<?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: Filter by geometry in Open Source Mapping Libraries Ques.</title>
    <link>https://community.esri.com/t5/open-source-mapping-libraries-ques/filter-by-geometry/m-p/792647#M595</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Also forgot you could also use L.esri.get to query the endpoint directly and let the server do the spatial query for you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="javascript" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14134744945199578 jive_text_macro" jivemacro_uid="_14134744945199578"&gt;
&lt;P&gt;L.esri.get(featureLayerQueryUrl, {&lt;/P&gt;
&lt;P&gt;&amp;nbsp; spatialRel: "esriSpatialRelIntersects",&lt;/P&gt;
&lt;P&gt;&amp;nbsp; geometryType: "esriGeometryPoint",&lt;/P&gt;
&lt;P&gt;&amp;nbsp; geometry: L.esri.Utils.geojsonToArcGIS(geojsonPoint)&lt;/P&gt;
&lt;P&gt;}, function(error, response){&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var geojson = L.esri.Utils.responseToFeatureCollection(response);&lt;/P&gt;
&lt;P&gt;});&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is dropping down pretty low into the request and utilities methods. But you will save yourself from using Turf and they are all documented in the API ref &lt;A href="http://esri.github.io/esri-leaflet/api-reference/" title="http://esri.github.io/esri-leaflet/api-reference/"&gt;API Reference | Esri Leaflet&lt;/A&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 16 Oct 2014 15:49:32 GMT</pubDate>
    <dc:creator>PatrickArlt1</dc:creator>
    <dc:date>2014-10-16T15:49:32Z</dc:date>
    <item>
      <title>Filter by geometry</title>
      <link>https://community.esri.com/t5/open-source-mapping-libraries-ques/filter-by-geometry/m-p/792644#M592</link>
      <description>&lt;P&gt;So the API has a &lt;EM&gt;where&lt;/EM&gt; option and a &lt;EM&gt;setWhere&lt;/EM&gt; method with other time filter methods.&lt;/P&gt;
&lt;P&gt;&lt;A title="http://esri.github.io/esri-leaflet/api-reference/layers/feature-layer.html" href="http://esri.github.io/esri-leaflet/api-reference/layers/feature-layer.html" target="_blank"&gt;L.esri.Layers.FeatureLayer | Esri Leaflet&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Is there a way to set the geometry as well? Right now it uses the bounds of the map to limit queries, but can I override that pretty easily somewhere?&lt;/P&gt;
&lt;P&gt;Right now I can jump through some hoops using Turf to do point-in-polygon searches, but it doesn't work if I need to check points outside the bounds of the map not queried yet.&lt;/P&gt;
&lt;P&gt;&lt;A title="https://github.com/Turfjs/turf-inside" href="https://github.com/Turfjs/turf-inside" target="_blank"&gt;Turfjs/turf-inside · GitHub&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm thinking I could just query the data on my own, convert to GeoJSON and use Turf + properties filtering to search my results, but was kind of hoping there was a workflow in Esri-Leaflet already to do this. Any ideas?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Aug 2023 13:51:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/open-source-mapping-libraries-ques/filter-by-geometry/m-p/792644#M592</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2023-08-28T13:51:37Z</dc:date>
    </item>
    <item>
      <title>Re: Filter by geometry</title>
      <link>https://community.esri.com/t5/open-source-mapping-libraries-ques/filter-by-geometry/m-p/792645#M593</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you are doing it yourself, try the REST API - it will return JSON and allows you to select a geometry and a geometry type. Your URL should be &lt;/P&gt;&lt;P&gt;&lt;A href="http://dmdview/ArcGIS/rest/services/PaulTracking/FeatureServer/0/query" title="http://dmdview/ArcGIS/rest/services/PaulTracking/FeatureServer/0/query"&gt;http://YourArcServerDomainName/ArcGIS/rest/services/yourFeatureName/FeatureServer/0/query&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hit that with a formatted AJAX request and get back the JSON rep of the results&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Looks like the ESRI-Leaflet plugin only runs where on the whole data set. My money is on it just hitting your rest endpoint anyway so do it yourself.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Oct 2014 16:25:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/open-source-mapping-libraries-ques/filter-by-geometry/m-p/792645#M593</guid>
      <dc:creator>PaulCrickard1</dc:creator>
      <dc:date>2014-10-14T16:25:38Z</dc:date>
    </item>
    <item>
      <title>Re: Filter by geometry</title>
      <link>https://community.esri.com/t5/open-source-mapping-libraries-ques/filter-by-geometry/m-p/792646#M594</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I get where you are coming from Rene.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You were probably hoping for something like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="javascript" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14134740671404916 jive_text_macro" jivemacro_uid="_14134740671404916"&gt;
&lt;P&gt;L.esri.featureLayer(featureLayer, {&lt;/P&gt;
&lt;P&gt;&amp;nbsp; spatialMethod: 'intersects',&lt;/P&gt;
&lt;P&gt;&amp;nbsp; geometry: latlng&lt;/P&gt;
&lt;P&gt;}).addTo(map);&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Implementing this would be VERY difficult since the assumption that features are only loaded inside the current viewport is baked into Esri Leaflet all the way down to the core.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That said this did remind me of a feature I wanted to add &lt;A href="https://github.com/Esri/esri-leaflet/issues/374" title="https://github.com/Esri/esri-leaflet/issues/374"&gt;Add additional spatial query types to L.esri.Tasks.Query · Issue #374 · Esri/esri-leaflet · GitHub&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Once this is implemented you could do something like the following to render all polygons that intersect a point.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="javascript" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14134740603984509 jive_text_macro" jivemacro_uid="_14134740603984509" modifiedtitle="true"&gt;
&lt;P&gt;L.esri.Tasks.query(featureLayer).intersects(latlng).run(function(error, geojson){&lt;/P&gt;
&lt;P&gt;&amp;nbsp; // use L.GeoJSON to add features to map&lt;/P&gt;
&lt;P&gt;});&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For right now you can just use the raw L.esri.Tasks.query to query as many features as possible and use Turf on the client side for your point in polygon.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="javascript" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14134742243809266" jivemacro_uid="_14134742243809266"&gt;
&lt;P&gt;// queries all features up to the transfer limit (usually 1000-2000)&lt;/P&gt;
&lt;P&gt;L.esri.Tasks.query(featureLayer).run(function(error, geojson){&lt;/P&gt;
&lt;P&gt;&amp;nbsp; // now use Turf over all the geojson&lt;/P&gt;
&lt;P&gt;});&lt;/P&gt;
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Oct 2014 15:44:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/open-source-mapping-libraries-ques/filter-by-geometry/m-p/792646#M594</guid>
      <dc:creator>PatrickArlt1</dc:creator>
      <dc:date>2014-10-16T15:44:19Z</dc:date>
    </item>
    <item>
      <title>Re: Filter by geometry</title>
      <link>https://community.esri.com/t5/open-source-mapping-libraries-ques/filter-by-geometry/m-p/792647#M595</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Also forgot you could also use L.esri.get to query the endpoint directly and let the server do the spatial query for you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="javascript" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14134744945199578 jive_text_macro" jivemacro_uid="_14134744945199578"&gt;
&lt;P&gt;L.esri.get(featureLayerQueryUrl, {&lt;/P&gt;
&lt;P&gt;&amp;nbsp; spatialRel: "esriSpatialRelIntersects",&lt;/P&gt;
&lt;P&gt;&amp;nbsp; geometryType: "esriGeometryPoint",&lt;/P&gt;
&lt;P&gt;&amp;nbsp; geometry: L.esri.Utils.geojsonToArcGIS(geojsonPoint)&lt;/P&gt;
&lt;P&gt;}, function(error, response){&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var geojson = L.esri.Utils.responseToFeatureCollection(response);&lt;/P&gt;
&lt;P&gt;});&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is dropping down pretty low into the request and utilities methods. But you will save yourself from using Turf and they are all documented in the API ref &lt;A href="http://esri.github.io/esri-leaflet/api-reference/" title="http://esri.github.io/esri-leaflet/api-reference/"&gt;API Reference | Esri Leaflet&lt;/A&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Oct 2014 15:49:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/open-source-mapping-libraries-ques/filter-by-geometry/m-p/792647#M595</guid>
      <dc:creator>PatrickArlt1</dc:creator>
      <dc:date>2014-10-16T15:49:32Z</dc:date>
    </item>
    <item>
      <title>Re: Filter by geometry</title>
      <link>https://community.esri.com/t5/open-source-mapping-libraries-ques/filter-by-geometry/m-p/792648#M596</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Patrick!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think this will work, because ultimately what I end up doing is an attribute and spatial query of the data.&lt;/P&gt;&lt;P&gt;I keep forgetting about L.esri.get, ha.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Oct 2014 16:38:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/open-source-mapping-libraries-ques/filter-by-geometry/m-p/792648#M596</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2014-10-16T16:38:24Z</dc:date>
    </item>
  </channel>
</rss>

