GPS perl.

Discussion in 'General GPS Discussion' started by lecandotnet, Oct 12, 2014.

  1. lecandotnet

    lecandotnet

    Joined:
    Oct 4, 2014
    Messages:
    5
    Likes Received:
    0
    Hi

    Please give a link or advice for writing codes in Perl to show GPS coordinates from a device with built-in gps chipset such as Samsung tablet 4 7" sm-t230.

    Thank you.
     
    Last edited: Oct 12, 2014
    lecandotnet, Oct 12, 2014
    #1
  2. lecandotnet

    lecandotnet

    Joined:
    Oct 4, 2014
    Messages:
    5
    Likes Received:
    0
    Example: How to get these codes work on cgi:


    #!/usr/bin/perl
    use GPS::NMEA;

    my $gps = GPS::NMEA->new(Port => '/dev/cuaa0',
    # or COM5: or /dev/ttyS0
    Baud => 4800);
    while(1) {
    my($ns,$lat,$ew,$lon) = $gps->get_position;
    print "($ns,$lat,$ew,$lon)\n";
    }
     
    Last edited: Oct 16, 2014
    lecandotnet, Oct 14, 2014
    #2
  3. lecandotnet

    lecandotnet

    Joined:
    Oct 4, 2014
    Messages:
    5
    Likes Received:
    0
    Another example:

    use strict;
    use LWP::Simple; # from CPAN
    use JSON qw( decode_json ); # from CPAN
    sub getLatLong($){ my ($address) = @_;
    my $format = "json"; #can also to 'xml'
    my $geocodeapi = "https://maps.googleapis.com/maps/api/geocode/";
    my $url = $genocideapi.$format."?sensor=false&address=. $address;
    my $json = get($url);
    my $d_json = decode_json( $json );
    my $lat = $d_json->{results}->[0]->{geometry}->{location}->{lat}; my $lng = $d_json->{results}->[0]->{geometry}->{location}->{lng};
    return ($lat, $lng); }
     
    lecandotnet, Oct 16, 2014
    #3
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Similar Threads
There are no similar threads yet.
Loading...