Welcome to the wonderful world of OpenStreetMap and, as marto said, Open Elevation.
Thx, man. You are honestly one of the people who makes the internet fun as well as manageable and informative.
Try this at OpenStreetMap query at the sandbox at: https://turbo.overpass.kumi.systems/ :
Just effin wow. What does this line in particular represent? [!foot], etc...
way["highway"="path"][!foot][!bicycle][!segregated](area.searchArea);
How might a person capture the data from the right?
Are node id's unique natural numbers that can be ordered into a graph?
Here is a query to get you started with the latter: https://api.open-elevation.com/api/v1/lookup?locations=41.161758,-8.583933 (not sure lat/lon or lon/lat).
I'm stretching my game but can't quite get there:
$ ./6.am.pl
Subroutine get_logger redefined at ./6.am.pl line 134.
INFO: ./6.am.pl
INFO: pi is 3.14159265358979
INFO: Bonneville max altitude in feet: 5200
Error fetching: 500 Server closed connection without sending any data
+back at ./6.am.pl line 298.
$
The problem will be here:
sub get_open_elevation {
my ( $lat, $lon, $debug ) = @_;
use LWP::UserAgent;
use HTTP::Request;
use Data::Roundtrip;
$debug //= 0;
#my $ua = LWP::UserAgent->new( 'send_te' => '0' );
my $ua = LWP::UserAgent->new( agent =>
'Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox
+/78.0', );
my $r = HTTP::Request->new(
'GET' =>
'https://api.open-elevation.com/api/v1/lookup?locations=$lat%2C$lon',
[
'Accept' => '*/*',
'User-Agent' => 'curl/7.55.1'
],
);
my $response = $ua->request( $r, );
if ( $debug > 0 ) {
$logger->debug("$0 : verbose");
}
die "Error fetching: " . $response->status_line
unless $response->is_success;
my $content = $response->decoded_content;
my $data = Data::Roundtrip::json2perl($content);
warn "failed to parse received data:\n$content\n"
unless exists $data->{'elevation'};
return 5000;
}
I may have worn out my welcome with the server because it didn't always not want to talk to me at all. Full script here for dedicated parties (80 lines less without dialing up google; I don't want to post it on gitlab until it looks and behaves better.):
Snagged on Σκύλλα ,
|