<?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 Do You Filter on a Property in a GEO JSON Layer? in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-you-filter-on-a-property-in-a-geo-json/m-p/1023684#M71649</link>
    <description>&lt;P&gt;So, while you can have different geometries, the GeoJSONLayer documentation states this limitation:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Each GeoJSONLayer will only accept one geometry type. If there are multiple types of geometries, only the type specified in&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-GeoJSONLayer.html#geometryType" target="_blank"&gt;geometryType&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;will be loaded. If&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-GeoJSONLayer.html#geometryType" target="_blank"&gt;geometryType&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;is not specified, it will default to the geometry type of the first geometry.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;It is true that many different objects could have different properties.&lt;BR /&gt;&lt;BR /&gt;However, the reason I raise this question is due to the excerpt at the bottom of the Core Concepts in the documentation:&lt;BR /&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/query-filter/" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/query-filter/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;--------------------------&lt;BR /&gt;&lt;BR /&gt;Just happened to find this in the documentation: &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-GeoJSONLayerView.html" target="_self"&gt;GeoJSONLayerView&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 04 Feb 2021 22:20:39 GMT</pubDate>
    <dc:creator>developerarce</dc:creator>
    <dc:date>2021-02-04T22:20:39Z</dc:date>
    <item>
      <title>How Do You Filter on a Property in a GEO JSON Layer?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-you-filter-on-a-property-in-a-geo-json/m-p/1023646#M71647</link>
      <description>&lt;P&gt;I have a property within my GEO JSON that I would like to add a feature widget to the map in order to filter on those values. I see examples for FeatureLayers, but none for GeoJson Layers.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Feb 2021 21:00:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-you-filter-on-a-property-in-a-geo-json/m-p/1023646#M71647</guid>
      <dc:creator>developerarce</dc:creator>
      <dc:date>2021-02-04T21:00:17Z</dc:date>
    </item>
    <item>
      <title>Re: How Do You Filter on a Property in a GEO JSON Layer?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-you-filter-on-a-property-in-a-geo-json/m-p/1023661#M71648</link>
      <description>&lt;P&gt;I suspect that is because a GeoJSON will not behave in a consistent way like tabular datasets do.&lt;/P&gt;&lt;P&gt;You can read &lt;A href="https://tools.ietf.org/html/rfc7946" target="_self"&gt;the GeoJSON docs&lt;/A&gt; for all the nitty-gritty, but the short version is that it's not as structured a data format. In your FeatureLayers, you can only have a single geometry type, and every feature has the same fields, whether they have values entered or not.&lt;/P&gt;&lt;P&gt;In GeoJSON, however, it's perfectly acceptable to violate those norms. Here's a slightly modified example GeoJSON &lt;A href="https://en.wikipedia.org/wiki/GeoJSON" target="_self"&gt;from Wikipedia&lt;/A&gt;:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "geometry": {
        "type": "Point",
        "coordinates": [102.0, 0.5]
      },
      "properties": {
        "name": "my_house"
      }
    },
    {
      "type": "Feature",
      "geometry": {
        "type": "LineString",
        "coordinates": [
          [102.0, 0.0], [103.0, 1.0], [104.0, 0.0], [105.0, 1.0]
        ]
      },
      "properties": {
        "ref": "Main Street",
        "speed_limit": 35
      }
    },
    {
      "type": "Feature",
      "geometry": {
        "type": "Polygon",
        "coordinates": [
          [
            [100.0, 0.0], [101.0, 0.0], [101.0, 1.0],
            [100.0, 1.0], [100.0, 0.0]
          ]
        ]
      },
      "properties": {
        "kind": "barrier",
        "prop": { "this": "that" }
      }
    }
  ]
}&lt;/LI-CODE&gt;&lt;P&gt;Even though the objects have entirely different schema and geometry types, this is a &lt;STRONG&gt;valid &lt;/STRONG&gt;GeoJSON.&lt;/P&gt;&lt;P&gt;It's probably pretty straightforward to make a custom widget that looks first for the existence of a key in &lt;EM&gt;properties&lt;/EM&gt;, then for a certain value based on that key, but it's going to look pretty different from the built-in filter widget, and will depend a lot on your particular data, I would think.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Feb 2021 21:22:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-you-filter-on-a-property-in-a-geo-json/m-p/1023661#M71648</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2021-02-04T21:22:58Z</dc:date>
    </item>
    <item>
      <title>Re: How Do You Filter on a Property in a GEO JSON Layer?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-you-filter-on-a-property-in-a-geo-json/m-p/1023684#M71649</link>
      <description>&lt;P&gt;So, while you can have different geometries, the GeoJSONLayer documentation states this limitation:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Each GeoJSONLayer will only accept one geometry type. If there are multiple types of geometries, only the type specified in&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-GeoJSONLayer.html#geometryType" target="_blank"&gt;geometryType&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;will be loaded. If&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-GeoJSONLayer.html#geometryType" target="_blank"&gt;geometryType&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;is not specified, it will default to the geometry type of the first geometry.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;It is true that many different objects could have different properties.&lt;BR /&gt;&lt;BR /&gt;However, the reason I raise this question is due to the excerpt at the bottom of the Core Concepts in the documentation:&lt;BR /&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/query-filter/" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/query-filter/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;--------------------------&lt;BR /&gt;&lt;BR /&gt;Just happened to find this in the documentation: &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-views-layers-GeoJSONLayerView.html" target="_self"&gt;GeoJSONLayerView&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Feb 2021 22:20:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-you-filter-on-a-property-in-a-geo-json/m-p/1023684#M71649</guid>
      <dc:creator>developerarce</dc:creator>
      <dc:date>2021-02-04T22:20:39Z</dc:date>
    </item>
    <item>
      <title>Re: How Do You Filter on a Property in a GEO JSON Layer?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-you-filter-on-a-property-in-a-geo-json/m-p/1023746#M71650</link>
      <description>&lt;P&gt;I will post a solution after I solve this last issue. How do I clear a filter? I cannot set the filter to null.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Feb 2021 00:23:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-you-filter-on-a-property-in-a-geo-json/m-p/1023746#M71650</guid>
      <dc:creator>developerarce</dc:creator>
      <dc:date>2021-02-05T00:23:19Z</dc:date>
    </item>
    <item>
      <title>Re: How Do You Filter on a Property in a GEO JSON Layer?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-you-filter-on-a-property-in-a-geo-json/m-p/1023773#M71652</link>
      <description>&lt;P&gt;I think you could reassign the variable to the original dataset source?&amp;nbsp; Kind of hard to tell what you mean without seeing your code though.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Feb 2021 03:24:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-you-filter-on-a-property-in-a-geo-json/m-p/1023773#M71652</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-02-05T03:24:19Z</dc:date>
    </item>
    <item>
      <title>Re: How Do You Filter on a Property in a GEO JSON Layer?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-you-filter-on-a-property-in-a-geo-json/m-p/1023784#M71653</link>
      <description>&lt;P&gt;I was able to fortunately set it back to `null` which is the original value. Had to do something different due to Typescript.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Feb 2021 04:21:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-you-filter-on-a-property-in-a-geo-json/m-p/1023784#M71653</guid>
      <dc:creator>developerarce</dc:creator>
      <dc:date>2021-02-05T04:21:40Z</dc:date>
    </item>
    <item>
      <title>Re: How Do You Filter on a Property in a GEO JSON Layer?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-you-filter-on-a-property-in-a-geo-json/m-p/1023786#M71654</link>
      <description>&lt;P&gt;Solution:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;    view.whenLayerView(geoJSONLayer).then(function(layerView: any) {
        // set up UI items
        if (filterElement) {
          filterElement.addEventListener("click", function(event) {
            filterLayer(event.target, layerView);
          });
          filterElement.style.visibility = "visible";
          const filterExpand = new Expand({
            view: view,
            content: filterElement,
            expandIconClass: "esri-icon-filter",
            group: "top-left"
          });
          //clear the filters when user closes the expand widget
          filterExpand.watch("expanded", function () {
            if (!filterExpand.expanded) {
              layerView.filter = null;
            }
          });
          view.ui.add(filterExpand, "top-left");
        }
      });

...

const filterLayer = (layer:any, view:any) =&amp;gt; {
    const data = layer.getAttribute("data-layer");
    view.filter = new FeatureFilter({
      where: `layer='${data}'`
    })
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Feb 2021 04:25:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-you-filter-on-a-property-in-a-geo-json/m-p/1023786#M71654</guid>
      <dc:creator>developerarce</dc:creator>
      <dc:date>2021-02-05T04:25:26Z</dc:date>
    </item>
  </channel>
</rss>

