I am trying to implement a google maps distance matrix api request using, node JS google Client library. specifically
@googlemaps/google-maps-services-js
The problem am facing, I can only finds source code example for elevation in the documentation.
const client = new Client({});
client
.elevation({
params: {
locations: [{ lat: 45, lng: -110 }],
key: "asdf",
},
timeout: 1000, // milliseconds
})
.then((r) => {
console.log(r.data.results[0].elevation);
})
.catch((e) => {
console.log(e.response.data.error_message);
});
I need source code example for Distance Matrix so I can implement point to point distance calculation within node JS, using the client library.
const client = new Client({});
client
.distanceMatrixrequest()