1.0.3 • Published 2 years ago

fastify-osm v1.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

fastify-osm

js-standard-style CI workflow

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