⚠️

This package has been deprecated

Author message:

This module is now under the @rapideditor scope: install @rapideditor/location-conflation instead

@ideditor/location-conflation

1.1.0 • Public • Published

build npm version

location-conflation

🧩 Define complex geographic regions (geofences) by including and excluding country codes and GeoJSON shapes.

What is it?

Location-conflation is a tool for generating GeoJSON features by including and excluding other locations and shapes.

It is useful for generating geofences in a declarative way, so your application doesn't need to bundle or fetch so much geodata.

⚡️ Try it now!: https://ideditor.github.io/location-conflation/

You can define a locationSet as an Object with include and exclude properties:

const locationSet = {
  include: [ Array of locations ],
  exclude: [ Array of locations ]
};

The "locations" can be any of the following:

  • Strings recognized by the country-coder library.
    These include ISO 3166-1 2 or 3 letter country codes, UN M.49 numeric codes, and supported Wikidata QIDs.
    Examples: "de", "001", "conus", "gb-sct", "Q620634"
    👉 A current list of supported codes can be found at https://ideditor.codes

  • Filenames for custom .geojson features. If you want to use your own features, pass them to the LocationConflation constructor in a FeatureCollection
    Each Feature must have an id that ends in .geojson.
    Examples: "de-hamburg.geojson", "new_jersey.geojson"

  • Circular areas defined as [longitude, latitude, radius?] Array.
    Radius is specified in kilometers and is optional. If not specified, it will default to a 25km radius.
    Examples: [8.67039, 49.41882], [-88.3726, 39.4818, 32]

Installing

Use in Node

npm install @ideditor/location-conflation

location-conflation is distributed in CJS and ESM module formats for maxmimum compatibility. (Read more about Javascript module formats)

const LocationConflation = require('@ideditor/location-conflation').default;  // require CJS
// or
import LocationConflation from '@ideditor/location-conflation';   // import ESM

Use in Browsers

You can also use location-conflation directly in a web browser. A good way to do this is to fetch the "iife" bundle from the jsDelivr CDN, which can even deliver minified versions.

When you load this file in a