Skip to content

Instantly share code, notes, and snippets.

@stoermerjp
Created April 14, 2012 14:44
Show Gist options
  • Save stoermerjp/2384875 to your computer and use it in GitHub Desktop.
Save stoermerjp/2384875 to your computer and use it in GitHub Desktop.
DroneMapper.com: USGS Elevation Web Service PHP Integration
<?php
/*
* Uses CURL to return the elevation of a point via USGS Elevation Web Service.
*/
$lat = 41.9816730;
$lon = -106.0949550;
function checkEle($lat, $lon) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://gisdata.usgs.gov/xmlwebservices2/elevation_service.asmx/getElevation?X_Value=" . $lon . "&Y_Value=" . $lat . "&Elevation_Units=METERS&Source_Layer=-1&Elevation_Only=true");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
$retValue = curl_exec($ch);
curl_close($ch);
return $retValue;
}
print checkEle($lat, $lon);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment