1.0.0 • Published 2 years ago
@fplan/geojson-rules v1.0.0
Getting Started
import geojsonRules from "./geojson-rules.json?url";
<UI
    // ...
    geojsonRules={geojsonRules}
/>;Create
There is no need for a create rule since a properties object is already required (source).
Update
The rule updates a properties object.
Example:
- Adds/updates all objects containing the "id" property with the values of the "update" object.
// geojson-rules.json
{
    "geojsonRules": [
        {
            "filter": ["id"],
            "update": {
                "nav": "pass",
                "foo": "bar"
            }
        }
    ]
}- Updates all objects containing a "nav: block" property with the value "test"
// geojson-rules.json
{
    "geojsonRules": [
        {
            "filter": ["all", ["get", "nav"], "block"],
            "update": {
                "nav": "test"
            }
        }
    ]
}Delete
The rule makes a properties object empty.
Example:
// geojson-rules.json
{
    "geojsonRules": [
        // Clears all objects containing a "nav: test".
        {
            "delete": true,
            "filter": ["==", ["get", "nav"], "test"]
        }
    ]
}1.0.0
2 years ago