Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: approximating geological problems with highway data

by bliako (Monsignor)
on Jan 25, 2023 at 10:03 UTC ( [id://11149865]=note: print w/replies, xml ) Need Help??


in reply to approximating geological problems with highway data

Welcome to the wonderful world of OpenStreetMap and, as marto said, Open Elevation. 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).

Try this at OpenStreetMap query at the sandbox at: https://turbo.overpass.kumi.systems/ :

{{geocodeArea:Spokane}}->.searchArea; way["highway"="path"][!foot][!bicycle][!segregated](area.searchArea); (._;>;); out;

make sure you click on the "Data" tab

bw, bliako

Replies are listed 'Best First'.
Re^2: approximating geological problems with highway data
by Aldebaran (Curate) on Feb 03, 2023 at 02:48 UTC
    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

    Σκύλλα
    ,

      I may have worn out my welcome with the server because it didn't always not want to talk to me at all

      When I quote properly to allow interpolation, I get:

      $ ./6.am.pl ... Error fetching: 504 Gateway Time-out at ./6.am.pl line 298. $

      , having changed the GET line to:

      'GET' => "https://api.open-elevation.com/api/v1/lookup?locations=$lat%2C$lon",

      Progress? Maybe.....

        Host your own instance and avoid such problems, or at least be in a position to fix them yourself.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11149865]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (6)
As of 2024-03-29 09:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found