http://qs321.pair.com?node_id=11149877


in reply to approximating geological problems with highway data

I can't see your code because Gitlab says "You need to sign in or sign up before continuing." and "By signing in you accept the Terms of Use and acknowledge the Privacy Policy and Cookie Policy." Gitlab also rejects the use of what they consider outdated browsers, which is ridiculous, and not their decision to make.

Replies are listed 'Best First'.
Re^2: approximating geological problems with highway data
by hippo (Bishop) on Jan 25, 2023 at 23:36 UTC
      If that's in reference to https://gitlab.com/perlmonks/betelgeuse/-/blob/main/2.millcreek.pl then don't worry about it. I have signed in to gitlab and that script is a 404 anyway. In fact it seems that even the perlmonks user is 404.

      I thought I was riding off into the sunset as a successful gitlab user. Not so fast...

      All of my visibility is private. I find myself unable to select anything other than private. I wondered whether I am the owner, and I am. I see this but do not understand it:

      Change Project visibility to either Private, Internal, or Public. The visibility setting for a project must be at least as restrictive as the visibility of its parent group.

      I also have to wonder out loud if this is when the hosting must not be gratis, but I don't find evidence for needing to find some bursar now, so I'm kind of just stuck. (?)

        If you have gone private, that would explain things (except for why you have posted a public link in this thread to a private repo, of course).

        All of my visibility is private. I find myself unable to select anything other than private.

        The fact that the "perlmonks" user/group/whatever is itself private means that everything underneath it must also be private. Start at the top and work your way down, making everything public as you go.


        🦛

Re^2: approximating geological problems with highway data
by Aldebaran (Curate) on Jan 26, 2023 at 03:37 UTC
    I can't see your code because Gitlab...

    Nuts. I apologize for the dry link. I don't mean to be coy about posting source, but rather more mindful of the initial S in SSCCE. It's not punitively long:

    Source:

    Cheers,

      In sub init_event { ... }
      { "name" => "snowville", "date" => $date_str, "time" => $time_str, "location" => { lon => -112.7105234, lat => 41.9655701 }, 42.152429, -112.9842191 },

      Is the 42.152429, -112.9842191 key/value pair from the posted code perhaps a tyop? It's syntactically correct, but looks semantically fishy. Looks like it escaped from the following event record anonymous hash. (Update: OTOH, it looks quite harmless since you're unlikely to ever encounter a "42.152429" key in your code. :)

      Also, if init_event() isn't just stub code for the SSCCE, a more succinct way to write it would be

      c:\@Work\Perl\monks>perl use strict; use warnings; use Data::Dump qw(dd); sub init_event { # define unique event records as anonymous hash refs. my $ar_events = [ { "name" => "Boise", "location" => { lon => -116.2, lat => 43.61 }, }, { "name" => "near sublett", "location" => { lon => -113.2104084, lat => 42.3278114 }, }, { "name" => "snowville", "location" => { lon => -112.7105234, lat => 41.9655701 }, }, { "name" => "juniper", "location" => { lon => -112.9842191, lat => 42.152429 }, }, # and so on... ]; # add standard date/time to each event record. my $date_str = "2021-10-14"; my $time_str = "03:22:31"; @{$_}{ qw(date time) } = ($date_str, $time_str) for @$ar_events; return $ar_events; } my $ar_ev = init_event(); dd $ar_ev; ^Z [ { date => "2021-10-14", location => { lat => "43.61", lon => "-116.2" }, name => "Boise", "time" => "03:22:31", }, { date => "2021-10-14", location => { lat => "42.3278114", lon => "-113.2104084" }, name => "near sublett", "time" => "03:22:31", }, { date => "2021-10-14", location => { lat => "41.9655701", lon => "-112.7105234" }, name => "snowville", "time" => "03:22:31", }, { date => "2021-10-14", location => { lat => "42.152429", lon => "-112.9842191" }, name => "juniper", "time" => "03:22:31", }, ]


      Give a man a fish:  <%-{-{-{-<

        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,

      use Math::Trig qw[:pi deg2rad rad2deg];