Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^4: approximating geological problems with highway data

by Aldebaran (Curate)
on Jan 29, 2023 at 06:19 UTC ( [id://11150008]=note: print w/replies, xml ) Need Help??


in reply to Re^3: approximating geological problems with highway data
in thread approximating geological problems with highway data

Thanks all for helpful source comments. I can now compare numbers from different sources. This link should contain the newest source: 4.am.pl

Output:

$ ./4.am.pl Subroutine get_logger redefined at ./4.am.pl line 146. INFO: ./4.am.pl INFO: pi is 3.14159265358979 INFO: Bonneville max altitude in feet: 5200 INFO: Boise 43.61 -116.2 INFO: return from the google is 821 meters INFO: Altitude in feet is 2693.56964 INFO: Difference from max Bonneville elevation is 2506.43036 ft INFO: USGS elevation is 2697.37 ft INFO: Percent difference is 0.140990634426756 INFO: distance is 7794.07491881811 miles INFO: distance is 4656.32531168763 miles INFO: Percent difference is 50.4039958401085 INFO: ============== INFO: near sublett 42.3278114 -113.2104084 INFO: return from the google is 1455 meters INFO: Altitude in feet is 4773.6222 INFO: Difference from max Bonneville elevation is 426.3778 ft INFO: USGS elevation is 4780.72 ft INFO: Percent difference is 0.148577470880213 INFO: distance is 175.16979925839 miles INFO: distance is 175.486511142723 miles INFO: Percent difference is 0.180639489402675 INFO: ============== INFO: snowville 41.9655701 -112.7105234 INFO: return from the google is 1384 meters INFO: Altitude in feet is 4540.68256 INFO: Difference from max Bonneville elevation is 659.31744 ft INFO: USGS elevation is 4545.24 ft INFO: Percent difference is 0.100318706656456 INFO: distance is 35.8058824322112 miles INFO: distance is 35.837188345951 miles INFO: Percent difference is 0.0873941147406608 INFO: ============== INFO: juniper 42.152429 -112.9842191 INFO: return from the google is 1577 meters INFO: Altitude in feet is 5173.88468 INFO: Difference from max Bonneville elevation is 26.1153199999999 ft INFO: USGS elevation is 5169.2 ft INFO: Percent difference is 0.0905857419703596 INFO: distance is 19.0729839145012 miles INFO: distance is 19.0916186594743 miles INFO: Percent difference is 0.097654599897474 INFO: ============== $

The first distance is kludged with garbage values, so not too surprised to see 50% error there, but look at how close the values tended to be! I think I might have 3 sig figs. The modified script is approximately:

### Elevation with USGS use Geo::WebService::Elevation::USGS; my $eq = Geo::WebService::Elevation::USGS->new(); my $alt = $eq->elevation( $event->{location}->{lat}, $event->{location}->{lo +n} ) ->{Elevation}; $logger->info("USGS elevation is $alt ft"); ### compare values my $percent = percent_error( $feet, $alt ); $logger->info("Percent difference is $percent"); ### home cooked distance my $d = distance( $prev_lat, $prev_long, $event->{location}->{lat}, $event->{location}->{lon}, "M" ); $logger->info("distance is $d miles"); ### distance with GPS::Point use GPS::Point; my $gps = GPS::Point->new( lat => $prev_lat, lon => $prev_long ); my $dist = $gps->distance( $event->{location}->{lat}, $event->{location}->{lo +n} ); my $feet2 = 3.28084 * $dist; my $miles = $feet2 / 5280; #$logger->info("distance is $feet2 feet"); $logger->info("distance is $miles miles"); ### compare values my $percent2 = percent_error( $d, $miles ); $logger->info("Percent difference is $percent2");

Really happy to work up a different source for elevations, and look, I ran into Tom Wyant's software again:

Running Build test for WYANT/Geo-WebService-Elevation-USGS-0.120.tar.g +z t/basic.t .. ok t/elev.t ... # Accessing https://nationalmap.gov/epqs/pqs.php

Cheers,

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (4)
As of 2024-04-23 02:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found