npm install directions-to-geojson --save
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)