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/osmUsage
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 queries = ['military=airfield', 'highway', 'landuse=industrial']
/** Calculates a buffer for input features for a given radius. */
const buffer = 0.5
/** Units supported are miles, kilometers (default), and degrees. */
const units = 'kilometers'
/** GeoJSON results */
const response = app.osm(bbox, queries, buffer, units)
console.log(JSON.stringify(response));
fastify.osm()
fastify.listen(3000)Acknowledgements
License
Licensed under MIT