Share GeoJSON using Hypercore, using simple geospatial indexing with quadkeys via @mapbox/tilebelt
This is a prototype so will have breaking changes, unimplemented methods/functions, etc.
Install and use at your own risk of wasted time!
If you're interested in collaborating on this geospatial hypercore project, feel free to clone this repo & jump into the issues queue.
Prerequisites:
- HyperGeoJson requires a recent node.js version and lowest version tested so far is v14.19.0.
- This package is released as ESM, which may require configuration in your project
Install with npm:
npm i hypergeojson
// Import the HyperGeoJson class
import { HyperGeoJson } from 'hypergeojson'
// Create an instance of the class
const geo = new HyperGeoJson()
// Put a feature in the database
await geo.put({
'type': 'Feature',
'id': '1',
'properties': {},
'geometry': {
'type': 'Point',
'coordinates': [
-122.89993286132812,
47.04720076526227
]
}
})
// Get a feature by its id
const point = await geo.get('1')
Query features with a quadkey
const stream = geo.query({ quadkey: '02123' })
Query features with a bbox
const bbox = [-130.781250, 43.068888, -110.390625, 55.578345]
const stream = geo.query({ bbox }, {
zoomLimits: {
minZoom: 11,
maxZoom: 12
}
})
Contributions are welcome! Please read the contributing guidelines first.
It's important that this project contributes to a friendly, safe, and welcoming environment for all. Read this project's code of conduct
Read about the changes to this project in CHANGELOG.md. The format is based on Keep a Changelog and this project adheres to Semantic Versioning.