Package Exports
- fastify-osm
- fastify-osm/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (fastify-osm) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
fastify-osm
Supports Fastify versions 4.x
Plugin for Fastify to perform OverPass queries on OpenStreetMap
Install
npm i fastify-osm
Usage
Require fastify-osm
and register.
const fastify = require('fastify')()
fastify.register(require('fastify-osm'))
/** bbox coordinates to run query overpass */
const bbox = [
'7.265396118164062',
'45.687715074360916',
'7.414398193359375',
'45.697715074360916'
]
/**
* array's node to run query overpass
*
* Example:
* military=airfield -> Military airports
* highway -> all roads
* landuse=industrial
* */
const params = {
queries: ['military=airfield', 'highway', 'landuse=industrial'],
buffer: 0.5, // Calculates a buffer for input features for a given radius.
units: 'kilometers', // Units supported are miles, kilometers (default), and degrees.
endpoint: 'https://overpass-api.de/api/interpreter' // DEFAULT: https://overpass-api.de/api/interpreter
}
/** GeoJSON results */
const response = fastify.osm(params)
console.log(JSON.stringify(response));
fastify.listen(3000)
Acknowledgements
License
Licensed under MIT