dmortenson

ESRI_ELEVATION_WORLD GetElevationAtLongLat example

Discussion created by dmortenson on Feb 28, 2014
Latest reply on Apr 4, 2014 by jgrayson-esristaff
I must be missing something easy, as there are no examples of this.

I would like to retrieve the value of the elevation for a given lat/long. Do I really need a proxy or can't I just use the ESRI_Elevation_World -> GetElevationAtLonLat service?

Here's my code:


 var requestHandle = esriRequest({
            "url": "http://sampleserver4.arcgisonline.com/ArcGIS/rest/services/Elevation/ESRI_Elevation_World/MapServer/exts/ElevationsSOE/ElevationLayers/1/GetElevationAtLonLat",
            "content": {
              "lon": longitude,
              "lat": latitude,
              "format": "json"
            },
            "handeAs": "json",
            "callbackParamName": "callback"
       });
       requestHandle.then(requestSucceeded, requestFailed);  
   }
      
   function requestSucceeded(data){
          elev = JSON.parse(data);
          arrayUtils.forEach(elev, function(e) {
              var elev_meter = e.elevation;
              elev_ft = elev_meter *  3.2808399; 
              elevation += elev_ft ;
              alert(elevation);              
          });
   }


Thank you.

Outcomes