lotivis-geojson v1.0.2
lotivis-geojson
GeoJson for lotivis.js
Installing
If you use npm, npm install lotivis-geojson
. You can also download the latest realease on GitHub. For using in browsers, you can load the UMD bundle from an npm-based CDN such as jsDelivr.
<script src="https://cdn.jsdelivr.net/..."></script>
<script>
// ...
</script>
API Reference
lotivis.geojson(string)
Creates and returns a GeoJSON
from the given json string.
lotivis.geojsonFetch(path)
Fetches and parses the GeoJSON
from the specified path
.
lotivis.geojsonFetch("path/to/geojson.geojson")
.then((geojson) => {
// do something with geojson ...
})
.catch((error) => { /* */});
lotivis.geojsonGenerate(locations)
Creates and returns a generated GeoJSON
containing features for the specified location names. The specified name is set as id
and name
of the properties
object of each feature.
lotivis.geojsonFilter(json, ids, idValue)
Creates and returns a newly generated GeoJSON
containing only the features whose id is included in the specified collection of ids
.
lotivis.geojsonJoin(GeoJSON | Array\<Feature>)
Creates and returns a newly generated GeoJSON
containing only one feature merged from all features.
lotivis.geojsonRemove(json, ids, idValue)
Creates and returns a newly generated GeoJSON
containing only the features whose id is NOT included in the specified collection of ids
.
lotivis.geojsonAutoFeatureIDAccessor(feature)
Default accessors for the id of a feature. Checks for an id in the following presented order:
feature.id ||
feature.properties.id ||
feature.properties.code ||
hash(feature.properties) ||
hash(feature)
lotivis.geojsonAutoFeatureNameAccessor(feature)
Default accessors for the name of a feature. Checks for a name in the following presented order:
feature.name ||
feature.properties.name ||
geojsonAutoFeatureIDAccessor(feature)
Development
# build module
yarn build
# develop module
yarn build:watch