UNPKG

geojson2gtfs

Version:

A tiny nodeJs cli app to transform geoJson files (describing an onDemand informal public transport routes) to its corresponding GTFS entities.

26 lines (21 loc) 669 B
const axios = require('axios'); const colorprint = require('colorprint'); module.exports = async function reverseGeoCodeClient(lat, long) { // let long = -68.14408421516418; // let lat = -16.53061043296733; let response; try { let url = `http://localhost:3001/MockGeocoder/ReverseGeocode?lat=${lat}&long=${long}`; response = await axios.get(url, {timeout: 5000}); } catch (error) { colorprint.error(`Error getting direction from coords ${lat} ${long}, using S/N instead`); response = { data: [], address: [], }; } finally { return response.data; } }