On Aug 13, 7:22 am, Fraser <[email protected]> wrote: > Hi im trying to use the google maps elevation serivce but i am having > a bit of problem with this code > > var points = [ > new GLatLng(56.24541998247197,-4.71928424268135), > new GLatLng(56.24450039424443,-4.750696693390307), > new GLatLng(56.24992694330562,-4.779339666064709), > new GLatLng(56.23760100186224,-4.817585153626567), > new GLatLng(56.221557373440696,-4.791803718794269), > new GLatLng(56.23305852196548,-4.759961955464021), > new GLatLng(56.24128776317772,-4.753694399591468), > new GLatLng(56.24541998247197,-4.71928424268135) > ]; > > and this is the function that will use them > > function updateElevation() { > > if (points.length > 1) { > var latlngs = []; > for (var i in points) { > latlngs.push(points[i]) *********** > } > elevationService.getElevationAlongPath({ > path: latlngs, > samples: SAMPLES > }, plotElevation); > } > > } > > the line mentioned ********* is where i am getting errors is this the > correct way to access my array of lat lons ?
http://groups.google.com/group/Google-Maps-API/web/suggested-posting-guidelines This might also be useful reading - (what kind of a title is "Help with code"?): http://www.catb.org/~esr/faqs/smart-questions.html#bespecific I think that your problem is that the Elevation Service is asynchronous, but you certainly haven't included enough context to even try to replicate the problem. -- Larry -- You received this message because you are subscribed to the Google Groups "Google Maps API" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-maps-api?hl=en.
