Is it possible to consume the google Elevation API with an encoded polyline through the client?
I know there is
https://maps.googleapis.com/maps/api/elevation/json?key=" + Meteor.settings.public.googleMaps + "&locations=enc:" + encodedPath
But this does not work over client side, only server side. Or am I mistaken?
I cannot seem to get this to work through the elevator object.
elevator.getElevationAlongPath({
path: L.PolylineUtil.encode(path),
samples: 256,
}, function(elevations, status) {
nor
elevator.getElevationForLocations({
locations: L.PolylineUtil.encode(batch)
},
Error message is:
in property locations: not an Array
It works with an array of LatLng's, but that would be too inefficient for my application, since I need the elevation along a path of 1000s of coordinates.
You can use the
google.maps.geometry.encoding.encodePath(path:Array<LatLng>|MVCArray<LatLng>)
method it takes an array of latLngs and encodes them into a polyline