javascript - How do i get back (display) the elevation points on the alert pop up. -


i want elevation values code on alert pop able values of lat , lng. trying 3 values (lat, lng , elevation heights) in array can later display values using opengl stuck on part working fine. code using. thanks

  var bounds = map.getbounds();   var ne = bounds.getnortheast();   var sw = bounds.getsouthwest();   var nw = new google.maps.latlng (ne.lat(), sw.lng());   var se = new google.maps.latlng(sw.lat(), ne.lng());    for(var = 0 ; i<= (ne.lat() - sw.lat()); i+=0.01)  { for(var j =0 ; j<=(ne.lng() - sw.lng());j+=0.01)       {        var tmpele; //temp variable elevation<br/>        lt.push(sw.lat()+i);<br/>        ln.push(sw.lng()+ j);<br/>         var d = new google.maps.latlng((sw.lat()+i),(sw.lng()+ j));                loca.push(d);        el.push(pospoint(loca));       } }       alert(lt);       alert(ln);        alert(el);     }    function disp()    {    alert(el);    }    function pospoint(loca)    {      var tmp;     var positionalrequest = {                     'locations': loca                               }        elevationservice.getelevationforlocations(positionalrequest, function(results, status) {             if (status == google.maps.elevationstatus.ok) {                     tmp=results;                 //  alert('got:'+tmp);                 //  return tmp;                     }                      });     return tmp;     } 

the elevation service asynchronous. can't return it, can use data (when available) in callback function.


Comments

Popular posts from this blog

assembly - 8086 TASM: Illegal Indexing Mode -

Java, LWJGL, OpenGL 1.1, decoding BufferedImage to Bytebuffer and binding to OpenGL across classes -

javascript - addthis share facebook and google+ url -