Google Groups

Is there a maximum path size for elevationService.getElevationAlongPath ?

JKurtock Jan 16, 2011 2:18 PM
Posted in group: Google Maps JavaScript API v3
In using this call to elevation Service:

    path: elevation_path,
    samples: 256
    }, plotElevation);

plotElevation is called with status=UNKNOWN_ERROR when the
elevation_path (an array of LatLngs) has more than about 450 elements.
(and works successfully with fewer).  Also, the call to plotElevation
seems to be delayed by about 5 seconds, as if "UNKNOWN_ERROR" were
actually responding to a time-out of some sort.

getElevationAlongPath is actually computing the elevation at (here)
256 equally-spaced points along the path, so the problem might be
related to path length rather than the number of elements in the
array.  I have not tested that specifically.  (The test above has a
path length of about 30 miles.)

Has anyone else seen this?

What would be an effective work-around?  Breaking the elevation_path
into pieces wouldn't work well, as getElevationAlongPath breaks that
path into equally spaced intervals, and if I were to submit two pieces
the intervals would not be the same size.  Unless I first measured the
length of each path-segment, and adjusted the samples to fit.
Decimating the elevation_path (to get the number of elements below
~450) would introduce (potentially) a lot of error.  The decimated
points would all correctly be on the path, but when
getElevationAlongPath breaks that path into equally spaced intervals
it would be interpolating the decimated points.  In hilly terrain (the
only place one really cares about elevation) the interpolated points
could have a significantly 'wrong' elevation.


- Jeff