overpass-route-extractor

1.0.0 • Public • Published

Overpass Extractor Client for Node.js

Install

npm install [--save] overpass-extractor

Usage

npm test.js route=road

Constant & Variables

const overpassQuery = require('./overpassQuery');
const Point = require('./Point');
const overpassExtractor = require('./overpassExtractor');
 
var Relation = require('./Relation');
var fs = require("fs");
var Way = require('./Way');

Overpass Query

overpassQuery.generalQuery(process.argv[2])
              .then((overpassTurbo) => {
 
                 /// Do something with overpassTurbo (Overpass is a GeoJson)
 
              })
              .catch((err) => {
 
                    console.log("Errore");
                    console.log(err);
              });

Overpass Extractor

overpassExtractor.relationFeatureExtractor(overpassTurbo);
overpassExtractor.wayFeatureExtractor(overpassTurbo);
overpassExtractor.pointFeatureExtractor(overpassTurbo);
overpassExtractor.setRelated(results[0],results[1]);

Query Methods

overpassQuery.generalQuery(mapFeatureString)

Executes the query, returns a Promise that, when resolved, gives the GeoJson.

  • mapFeatureString defines a pair key=value, like route=road, (you can find OSM:MapFeatures) .

overpassExtractor.relationFeatureExtractor(overpassTurbo);

Manage the GeoJson. Instantiate a new Relation feature that you can manage with its own methods. Return a promise with a Json of Javascript Class.

  • overpassTurbo is a GeoJson get by query overpass service.

overpassExtractor.wayFeatureExtractor(overpassTurbo);

Manage the GeoJson. Instantiate a new Way feature that you can manage with its own methods. Return a promise with a Json of Javascript Class.

  • overpassTurbo is a GeoJson get by query overpass service.

overpassExtractor.pointFeatureExtractor(overpassTurbo);

Manage the GeoJson. Instantiate a new Point feature that you can manage with its own methods. Return a promise with a Json of Javascript Class.

  • overpassTurbo is a GeoJson get by query overpass service.

overpassExtractor.setRelated(results[0],results[1]);

Manage two GeoJsons. Relate a OSM relation with a OSM way. Return a Json of Javascript Class.

  • results[0] is a Json managed by a feature extractor.
  • results[1] is a Json managed by a feature extractor.

Notes

Readme

Keywords

none

Package Sidebar

Install

npm i overpass-route-extractor

Weekly Downloads

0

Version

1.0.0

License

none

Last publish

Collaborators

  • albertofarci