Skip to content

Geocoding

Get Address

Returns one or more addresses nearest to the given geographical coordinates. The latitude and lomgitude are given as path parameters.

GET /geocode/:lat/:lon/

Response:

  {
    "success": true,
    "dts": "Wed Oct 27 2021 16:52:52 GMT-0400", //current time
    "address": { //the nearest address
      "addressLine1": "123 Main str",
      "addressLine2": "Apt 1",
      "city": "Harrisburg",
      "state": "PA",
      "country": "US",
      "postalCode": "12345"
    }, 
    "addresses": [ {} ] // a few more alternatives if any
  }

Get Coordinates

Returns the coordinates for a given address

POST /geocode

Request body:

  {
    "address": "123 Main Str, Harrisburg, PA 12345"
  }

Response:

  {
    "success": true,
    "points":  [ {"lat": 40.7403809, "lon": -73.9897337} ] //may return a few coordinates if the address is ambiguous.
  }

Get Distance and Travel Time

POST geo/distance

Returns the distance between the given locations. Also returns the travel time if possible.

Request body:

  {
    "sources": ["123 Main Str, Harrisburg, PA 12345"], //array with addresses or coordinates
    "destinations": ["175 5th Ave, New York, NY 10010", "40.7403809 -73.9897337"], //array with addresses or coordinates
    "arriveBy": "Wed Oct 27 2021 16:52:52 GMT-0400" //optional 
  }

Response:

  {
    "success": true,
    "matrix":  [  //an array of travel times from each of the sources and to each of the destinations.
      {
        "originalSource": "123 Main Str, Harrisburg, PA 12345",
        "originalDestination": "175 5th Ave, New York, NY 10010",
        "source": {}, //normalized address
        "destination": {}, //normalized address
        "distance": 100, //distance in km
        "duration": 125 //travel time in minutes
      }
    ]
  }

Nearest ATMs

GET /pois/:lat/:lon/:distance/:maxnum

TODO