Nodemill Addins


Install Fields, APIs and pages (coming soon) using the public repository.

Search:
Within:

Nodemill API: directions

Nodemill Version Nodemill Downloads

Install

nodemill install api directions

Details

  • Author: Mike Murray
  • Short desc: Google Directions API
  • Keywords: google, directions

Full Description

Uses the Google Directions API Web Service to retrieve directions between a given origin and destination.

Parameters:

  • origin (required)
  • destination (required)
  • mode (optional)
  • language (optional)

Further information available at https://developers.google.com/maps/documentation/directions/intro#RequestParameters

Version history

  • 1.0.0 Created

Examples

http://localhost:3000/api/directions?origin=g332ra&destination=g332rq

Response

{
    headers: {
        code: 200
    },
    data: {
        geocoded_waypoints: [
            {
                geocoder_status: "OK",
                place_id: "ChIJ11Wm_t5DiEgRlFLROKJIrZ4",
                types: [
                    "postal_code"
                ]
            },
            {
                geocoder_status: "OK",
                place_id: "ChIJq8BQ795DiEgRmGmigsu9VnQ",
                types: [
                    "postal_code"
                ]
            }
        ],
        routes: [
            {
                bounds: {
                    northeast: {
                        lat: 55.8682693,
                        lng: -4.1886743
                    },
                    southwest: {
                        lat: 55.8678255,
                        lng: -4.189291799999999
                    }
                },
                copyrights: "Map data ©2016 Google",
                legs: [
                    {
                        distance: {
                            text: "70 m",
                            value: 70
                        },
                        duration: {
                            text: "1 min",
                            value: 20
                        },
                        end_address: "Smithycroft Rd, Glasgow G33 2RQ, UK",
                        end_location: {
                            lat: 55.8682693,
                            lng: -4.1886743
                        },
                        start_address: "Glasgow G33 2RA, UK",
                        start_location: {
                            lat: 55.8678255,
                            lng: -4.189149599999999
                        },
                        steps: [
                            {
                                distance: {
                                    text: "19 m",
                                    value: 19
                                },
                                duration: {
                                    text: "1 min",
                                    value: 2
                                },
                                end_location: {
                                    lat: 55.86797319999999,
                                    lng: -4.189291799999999
                                },
                                html_instructions: "Head <b>northwest</b> on <b>Smithycroft Ct</b> toward <b>Smithycroft Rd</b><div style="font-size:0.9em">Restricted usage road</div>",
                                polyline: {
                                    points: "}t~sIdeqX[Z"
                                },
                                start_location: {
                                    lat: 55.8678255,
                                    lng: -4.189149599999999
                                },
                                travel_mode: "DRIVING"
                            },
                            {
                                distance: {
                                    text: "51 m",
                                    value: 51
                                },
                                duration: {
                                    text: "1 min",
                                    value: 18
                                },
                                end_location: {
                                    lat: 55.8682693,
                                    lng: -4.1886743
                                },
                                html_instructions: "Turn <b>right</b> onto <b>Smithycroft Rd</b><div style="font-size:0.9em">Destination will be on the right</div>",
                                maneuver: "turn-right",
                                polyline: {
                                    points: "yu~sI`fqXIUSo@Yo@CE"
                                },
                                start_location: {
                                    lat: 55.86797319999999,
                                    lng: -4.189291799999999
                                },
                                travel_mode: "DRIVING"
                            }
                        ],
                        traffic_speed_entry: [ ],
                        via_waypoint: [ ]
                    }
                ],
                overview_polyline: {
                    points: "}t~sIdeqX[ZIUm@_BCE"
                },
                summary: "Smithycroft Ct and Smithycroft Rd",
                warnings: [ ],
                waypoint_order: [ ]
            }
        ],
        status: "OK"
    },
    md5: "1bbbe7"
}