@fplan/geojson-rules
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

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"]
        }
    ]
}

Dependencies (4)

Dev Dependencies (5)

Package Sidebar

Install

npm i @fplan/geojson-rules

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

94.8 kB

Total Files

15

Last publish

Collaborators

  • 1evgenyt