Skip to content

ianrose/directions-to-geojson

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Google Map Directions to Geojson

Install

npm install directions-to-geojson --save

Example

1. Google Directions

Google Directions

2. JS

const directionsToGeoJson = require('directions-to-geojson')

const opts = {
  apiKey: GOOGLE_MAP_API_KEY, // Google Maps API key
  stroke: '#ff1800', // Color of line
  fileName: './test/datafile.geojson', // The output
  origin: 'New Orleans, Louisiana', // Starting location of the directions
  destination: 'Manhattan, New York, NY', // The destination of the directions
  waypoints: [ // The locations between the beginning and destination
    'Oak Ridge, Tennessee',
    'Philadelphia, Pennsylvania'
  ]
}

directionsToGeoJson(opts)

3. Output

Geojson output

About

Convert Google Map direction polyline to geojson

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published