SlideShare a Scribd company logo
1 of 23
Geographic Computation in Perl



                      Presented by Ian Kluft
                        Silicon Valley Perl
                         March 3, 2011
                      Santa Clara, California



Presented at SVPerl       Geographic Computation in Perl   Slide 1 of 23
March 3, 2011                     By Ian Kluft
Safety warning
              If you think the world is flat,
    this presentation will make your head explode.




Presented at SVPerl     Geographic Computation in Perl   Slide 2 of 23
March 3, 2011                   By Ian Kluft
Geography is BIG Today
 ●   Maps on paper go back to ancient times
 ●   Electronic age: natural move to web and mobile
 ●   Geography is a deeper subject than just maps
 ●   Any data pertaining to Earth's surface
       ●   Processing GPS data
       ●   Computing Great Circle routes
       ●   Geographic Information Systems (GIS)
       ●   Location Based Services (LBS)

Presented at SVPerl         Geographic Computation in Perl   Slide 3 of 23
March 3, 2011                       By Ian Kluft
Geospatial location data
 ●   Locations on Earth can be specified by
       ●   Latitude – angle north/south from equator to poles
       ●   Longitude – angle east/west from Prime Meridian
       ●   Altitude – height above/below mean sea level
 ●   Altitude is omitted when using surface elevation
 ●   Latitude and longitude are angles measured
     from the center of the Earth
 ●   Geographic data is more correctly called
     geospatial data when broken down in this form
Presented at SVPerl          Geographic Computation in Perl   Slide 4 of 23
March 3, 2011                        By Ian Kluft
Earth is not a perfect sphere
 ●   Earth is an ellipsoid: bulges out at equator
       ●   Centrifugal force from rotation causes this
 ●   Geoid: mathematical models for Earth ellipsoid
       ●   Good models come from satellite measurement
 ●   Coordinates must use the same geographic
     reference system
       ●   Otherwise comparing apples and oranges
       ●   WGS84 most widely used coordinate system today

Presented at SVPerl        Geographic Computation in Perl   Slide 5 of 23
March 3, 2011                      By Ian Kluft
Sources of Geospatial Data
 ●   Data can be gathered by many sources
 ●   Measured by professional surveyors
 ●   Measured by satellite (remote sensing)
 ●   Measured by professionals or amateurs by
     GPS
 ●   Read from maps
 ●   Geocoded from street addresses
 ●   Computations relative to other data
Presented at SVPerl   Geographic Computation in Perl   Slide 6 of 23
March 3, 2011                 By Ian Kluft
Lots of angles in Geospatial Data
 ●   This may come as bad news
       ●   There really was a use for that Trigonometry stuff
           some of you hated in school
 ●   Many computations involve angles
       ●   Latitude and longitude are angles
 ●   Manipulations use trigonometric functions
       ●   Useful to brush up on Trig to know what it's doing
 ●   Trig functions use radians
       ●   So numbers in degrees must be converted first
Presented at SVPerl        Geographic Computation in Perl   Slide 7 of 23
March 3, 2011                      By Ian Kluft
Get Math::Trig Module from CPAN
 ●   CPAN has many Perl modules to help with
     Trigonometry and Geospatial calculations
 ●   Math::Trig has the basic foundation
       ●   deg2rad() - convert degrees to radians
       ●   rad2deg() - convert radians to degrees
       ●   All the basic Trig functions
       ●   A bonus: basic Great Circle calculations too
 ●   http://search.cpan.org/search?query=Math%3A%3ATrig


Presented at SVPerl         Geographic Computation in Perl   Slide 8 of 23
March 3, 2011                       By Ian Kluft
Great Circle Routes
 ●   Great Circle: direct route over Earth's surface
       ●   Along a line that would go around the sphere
       ●   i.e. from San Jose to London crosses Greenland




                  Map generated by the Great Circle Mapper - copyright © Karl L. Swartz. http://www.gcmap.com/


Presented at SVPerl                                Geographic Computation in Perl                                Slide 9 of 23
March 3, 2011                                              By Ian Kluft
Great Circle Computations
 ●   Useful for mapping and navigation
       ●   Distance between any two points on Earth
       ●   Initial course from one point to another
       ●   Points along the path between two points
       ●   Intersection of courses/lines/radials
       ●   Projecting a point at distance/bearing from a point
 ●   Even over small distances, they can still be
     computed as angles from center of the Earth

Presented at SVPerl        Geographic Computation in Perl   Slide 10 of 23
March 3, 2011                      By Ian Kluft
Great Circle Tools and Info
 ●   Many formulas at Aviation Formulary site
       ●   by Ed Williams
       ●   http://williams.best.vwh.net/avform.htm
 ●   Great Circle online mapping tool
       ●   by Karl Swartz
       ●   http://gcmap.com/
 ●   O'Reilly's “Mapping Hacks” book
       ●   by Erle, Gibson and Walsh

Presented at SVPerl         Geographic Computation in Perl   Slide 11 of 23
March 3, 2011                       By Ian Kluft
Geospatial-related Perl Modules
 ●   Perl modules with Great Circle functions
       ●   Geo::Calc
       ●   Geo::Track::Log
       ●   GIS::Distance
 ●   Perl module front-ends to mapping sites
       ●   Geo::Google::StaticMaps – Google Maps
       ●   Geo::OSM::StaticMaps – OpenStreetMap
 ●   Many more – use search.cpan.org to search

Presented at SVPerl        Geographic Computation in Perl   Slide 12 of 23
March 3, 2011                      By Ian Kluft
Examples
Two examples follow with Perl code that was
actually used for geographic computation to solve
real problems.
 ●   CanSat Search at Black Rock Desert
     Perl script generated search area coordinates
     for a missing payload from a rocket launch
 ●   Balloon and tracking teams live APRS map
     Perl script makes live tracking map of teams
     chasing a high-altitude balloon

Presented at SVPerl   Geographic Computation in Perl   Slide 13 of 23
March 3, 2011                 By Ian Kluft
Example 1
     CanSat Search at Black Rock Desert
Location: Black Rock Desert, Nevada
Problem: Rocket launched, payload missing
 ●   Soka University (Japan) students needed data
 ●   AeroPac club knew rocket landing coordinates
 ●   Turned to Stratofox Aerospace Tracking Team
 ●   Transmitter batteries died before their contact
 ●   I wrote a Perl script to generate a grid search

Presented at SVPerl   Geographic Computation in Perl   Slide 14 of 23
March 3, 2011                 By Ian Kluft
Perl Script to Plot Search Grid
 ●   Search area was 3x3 mile parallelogram
 ●   Each side divided into 10 sections, 1584' long
 ●   10x10 loop projects each computed waypoint
 ●   Command-line controls output to text or GPX
 ●   “gpsbabel” turns GPX into many formats
       ●   Raw Garmin waypoint data for upload to GPS
       ●   KML for display on Google Earth


Presented at SVPerl       Geographic Computation in Perl   Slide 15 of 23
March 3, 2011                     By Ian Kluft
Projecting Search Grid Waypoints
 ●   Nested loop: i = 0-10 over, j = 0-10 up
 ●   Over = 270° heading, up = 330° heading
 ●   Convert lat/lon from degrees to radians
 ●   Use Great Circle projection formula
       ●   Compute intermediate point from i “over”
       ●   Compute final point from j “up”
 ●   Convert new lat/lon from radians to degrees
 ●   Code available at svperl.org with slides
Presented at SVPerl        Geographic Computation in Perl   Slide 16 of 23
March 3, 2011                      By Ian Kluft
Search Area Grid Map
Result of the script shown on Google Earth




Presented at SVPerl        Geographic Computation in Perl   Slide 17 of 23
March 3, 2011                      By Ian Kluft
Result: Success!!!
Expected to be worse than needle in a haystack
Payload found 2500' west of rocket landing site




Presented at SVPerl       Geographic Computation in Perl   Slide 18 of 23
March 3, 2011                     By Ian Kluft
Example 2
     Live APRS Balloon Tracking Map
Problem: Display APRS tracking data for a
balloon and our team who are tracking it
 ●   APRS = Automatic Packet Reporting System,
     Ham Radio data protocol for transmitting your
     position
 ●   The balloon and the tracking team all transmit
     their positions via APRS every minute or so
 ●   Sites to display APRS data on a map don't do
     what we want
Presented at SVPerl   Geographic Computation in Perl   Slide 19 of 23
March 3, 2011                 By Ian Kluft
APRS.FI posted their Perl code
 ●   Popular APRS mapping site APRS.FI uses Perl
 ●   They posted Ham::APRS::FAP (“fabulous
     APRS parser”) on CPAN for all Perl developers
 ●   You need Ham Radio license to transmit APRS
 ●   You do not need Ham Radio license to receive
     APRS data
 ●   Many volunteers forward APRS packets to
     APRS-IS servers on the Internet
 ●   Everyone can subscribe to data streams there
Presented at SVPerl   Geographic Computation in Perl   Slide 20 of 23
March 3, 2011                 By Ian Kluft
Custom APRS Mapping Script
 ●   Command-line parameter sets callsigns to log
 ●   Subscribe to APRS-IS via Ham::APRS::FAP
 ●   For each incoming line:
       ●   Parse line w/ Ham::APRS::FAP
       ●   Save data in a per-callsign list
       ●   Update output file in GeoRSS format
 ●   Output file URL can be used in near real-time
     as an input to Google Maps
 ●   Code available at svperl.org with slides
Presented at SVPerl         Geographic Computation in Perl   Slide 21 of 23
March 3, 2011                       By Ian Kluft
Balloon Chase on Google Maps
 ●   A balloon on Feb 5, 2011 was lost in the ocean
 ●   Teams chased it until Carmel – others watched




Presented at SVPerl   Geographic Computation in Perl   Slide 22 of 23
March 3, 2011                 By Ian Kluft
What else can you do?
 ●   Your imagination may be your only limit
 ●   Get a Google Maps API key and you can
     embed Google Maps into your web pages
 ●   Calculate air-mile distance of a trip you took
 ●   Process satellite data downloaded from NASA
 ●   What do you want to do?
 ●   Post your new modules on CPAN!


Presented at SVPerl         Geographic Computation in Perl   Slide 23 of 23
March 3, 2011                       By Ian Kluft

More Related Content

What's hot

Geocap seismic oil and gas for ArcGIS- Oil and Gas seminar October 10th
Geocap seismic oil and gas for ArcGIS- Oil and Gas seminar October 10thGeocap seismic oil and gas for ArcGIS- Oil and Gas seminar October 10th
Geocap seismic oil and gas for ArcGIS- Oil and Gas seminar October 10thGeodata AS
 
Software and hardware tracking sattelite
Software and hardware tracking satteliteSoftware and hardware tracking sattelite
Software and hardware tracking satteliteM Manggala
 
Extraction of Ephemeris file from Matlab SDR
Extraction of Ephemeris file from Matlab SDRExtraction of Ephemeris file from Matlab SDR
Extraction of Ephemeris file from Matlab SDRAsimKhan367
 
Gps surveying in Engineering
Gps surveying in EngineeringGps surveying in Engineering
Gps surveying in EngineeringGaneshRaj44
 
GPS processing techniques & some applications
GPS processing techniques & some applicationsGPS processing techniques & some applications
GPS processing techniques & some applicationsVrince Vimal
 
MEASUREMENT OF SURFACE TEMPERATURE OF A GLACIER USING AN UNMANNED AERIAL VEHI...
MEASUREMENT OF SURFACE TEMPERATURE OF A GLACIER USING AN UNMANNED AERIAL VEHI...MEASUREMENT OF SURFACE TEMPERATURE OF A GLACIER USING AN UNMANNED AERIAL VEHI...
MEASUREMENT OF SURFACE TEMPERATURE OF A GLACIER USING AN UNMANNED AERIAL VEHI...Nepal Flying Labs
 
(Emap) E Book Understanding The Gps
(Emap) E Book   Understanding The Gps(Emap) E Book   Understanding The Gps
(Emap) E Book Understanding The Gpsrickymohanty
 
Spaceflight Now | Delta Launch Report
Spaceflight Now | Delta Launch ReportSpaceflight Now | Delta Launch Report
Spaceflight Now | Delta Launch Reporttenderboyfriend96
 
2005-01-08 MANE-VU Status Report on CATT and FASTNET
2005-01-08 MANE-VU Status Report on CATT and FASTNET2005-01-08 MANE-VU Status Report on CATT and FASTNET
2005-01-08 MANE-VU Status Report on CATT and FASTNETRudolf Husar
 
Introduction to gps and gnss
Introduction to gps and gnssIntroduction to gps and gnss
Introduction to gps and gnssVivek Srivastava
 
F and G Taylor Series Solutions to the Circular Restricted Three-Body Problem
F and G Taylor Series Solutions to the Circular Restricted Three-Body ProblemF and G Taylor Series Solutions to the Circular Restricted Three-Body Problem
F and G Taylor Series Solutions to the Circular Restricted Three-Body ProblemEtienne Pellegrini
 
Modeling Geometry and Reference Systems on the Web of Data - LGD 2014
Modeling Geometry and Reference Systems on the Web of Data - LGD 2014Modeling Geometry and Reference Systems on the Web of Data - LGD 2014
Modeling Geometry and Reference Systems on the Web of Data - LGD 2014Raphael Troncy
 
Geo meetup
Geo meetupGeo meetup
Geo meetupmszaller
 
Delineation and Comparison of Urban Heat Islands in Tamilnadu
Delineation and Comparison of Urban Heat Islands in TamilnaduDelineation and Comparison of Urban Heat Islands in Tamilnadu
Delineation and Comparison of Urban Heat Islands in TamilnaduVignesh Sekar
 

What's hot (20)

Geocap seismic oil and gas for ArcGIS- Oil and Gas seminar October 10th
Geocap seismic oil and gas for ArcGIS- Oil and Gas seminar October 10thGeocap seismic oil and gas for ArcGIS- Oil and Gas seminar October 10th
Geocap seismic oil and gas for ArcGIS- Oil and Gas seminar October 10th
 
Glonass
GlonassGlonass
Glonass
 
Software and hardware tracking sattelite
Software and hardware tracking satteliteSoftware and hardware tracking sattelite
Software and hardware tracking sattelite
 
The gps dictionary
The gps dictionaryThe gps dictionary
The gps dictionary
 
Extraction of Ephemeris file from Matlab SDR
Extraction of Ephemeris file from Matlab SDRExtraction of Ephemeris file from Matlab SDR
Extraction of Ephemeris file from Matlab SDR
 
Gps surveying in Engineering
Gps surveying in EngineeringGps surveying in Engineering
Gps surveying in Engineering
 
GPS processing techniques & some applications
GPS processing techniques & some applicationsGPS processing techniques & some applications
GPS processing techniques & some applications
 
Archer trac module_1_-_intro_v1
Archer trac module_1_-_intro_v1Archer trac module_1_-_intro_v1
Archer trac module_1_-_intro_v1
 
CanSat 2008: ITESM Mexico City Final Presentation
CanSat 2008: ITESM Mexico City Final PresentationCanSat 2008: ITESM Mexico City Final Presentation
CanSat 2008: ITESM Mexico City Final Presentation
 
MEASUREMENT OF SURFACE TEMPERATURE OF A GLACIER USING AN UNMANNED AERIAL VEHI...
MEASUREMENT OF SURFACE TEMPERATURE OF A GLACIER USING AN UNMANNED AERIAL VEHI...MEASUREMENT OF SURFACE TEMPERATURE OF A GLACIER USING AN UNMANNED AERIAL VEHI...
MEASUREMENT OF SURFACE TEMPERATURE OF A GLACIER USING AN UNMANNED AERIAL VEHI...
 
Sanny omar esa_presentation_no_video
Sanny omar esa_presentation_no_videoSanny omar esa_presentation_no_video
Sanny omar esa_presentation_no_video
 
(Emap) E Book Understanding The Gps
(Emap) E Book   Understanding The Gps(Emap) E Book   Understanding The Gps
(Emap) E Book Understanding The Gps
 
Spaceflight Now | Delta Launch Report
Spaceflight Now | Delta Launch ReportSpaceflight Now | Delta Launch Report
Spaceflight Now | Delta Launch Report
 
2005-01-08 MANE-VU Status Report on CATT and FASTNET
2005-01-08 MANE-VU Status Report on CATT and FASTNET2005-01-08 MANE-VU Status Report on CATT and FASTNET
2005-01-08 MANE-VU Status Report on CATT and FASTNET
 
Fast Cat Mv3
Fast Cat Mv3Fast Cat Mv3
Fast Cat Mv3
 
Introduction to gps and gnss
Introduction to gps and gnssIntroduction to gps and gnss
Introduction to gps and gnss
 
F and G Taylor Series Solutions to the Circular Restricted Three-Body Problem
F and G Taylor Series Solutions to the Circular Restricted Three-Body ProblemF and G Taylor Series Solutions to the Circular Restricted Three-Body Problem
F and G Taylor Series Solutions to the Circular Restricted Three-Body Problem
 
Modeling Geometry and Reference Systems on the Web of Data - LGD 2014
Modeling Geometry and Reference Systems on the Web of Data - LGD 2014Modeling Geometry and Reference Systems on the Web of Data - LGD 2014
Modeling Geometry and Reference Systems on the Web of Data - LGD 2014
 
Geo meetup
Geo meetupGeo meetup
Geo meetup
 
Delineation and Comparison of Urban Heat Islands in Tamilnadu
Delineation and Comparison of Urban Heat Islands in TamilnaduDelineation and Comparison of Urban Heat Islands in Tamilnadu
Delineation and Comparison of Urban Heat Islands in Tamilnadu
 

Similar to Geographic Computation in Perl

GIS & History of Mapping in Malaya (lecture notes circa 2009)
GIS & History of Mapping in Malaya (lecture notes circa 2009)GIS & History of Mapping in Malaya (lecture notes circa 2009)
GIS & History of Mapping in Malaya (lecture notes circa 2009)Azmi Mohd Tamil
 
Global positioning system (gps)
Global positioning system (gps)Global positioning system (gps)
Global positioning system (gps)aditya singh
 
Introduction to Geomatics _2014
Introduction to Geomatics _2014Introduction to Geomatics _2014
Introduction to Geomatics _2014Atiqa khan
 
Morocco2022_LocationProblem_Bondar.pptx
Morocco2022_LocationProblem_Bondar.pptxMorocco2022_LocationProblem_Bondar.pptx
Morocco2022_LocationProblem_Bondar.pptxouchenibrahim1
 
CI_SIModule_QGIS.pptx .
CI_SIModule_QGIS.pptx                         .CI_SIModule_QGIS.pptx                         .
CI_SIModule_QGIS.pptx .Athar739197
 
NDGISUC2017 - New Lidar Technologies for 3DEP
NDGISUC2017 - New Lidar Technologies for 3DEPNDGISUC2017 - New Lidar Technologies for 3DEP
NDGISUC2017 - New Lidar Technologies for 3DEPNorth Dakota GIS Hub
 
Role of Sensors-Applications.pdf
Role of Sensors-Applications.pdfRole of Sensors-Applications.pdf
Role of Sensors-Applications.pdfGOWTHAMMS6
 
7 srtm paleochannels_aeromagnetics data
7 srtm paleochannels_aeromagnetics data7 srtm paleochannels_aeromagnetics data
7 srtm paleochannels_aeromagnetics dataIUMA MARTINEZ
 
Remote sensing ang GIS
Remote sensing ang GISRemote sensing ang GIS
Remote sensing ang GISVijayarani31
 
Final ppt group ASHISH.pdf
Final ppt group ASHISH.pdfFinal ppt group ASHISH.pdf
Final ppt group ASHISH.pdfLakshmiPolaka1
 
Presentation on progress report of final year project(gps
Presentation on progress report of final year project(gpsPresentation on progress report of final year project(gps
Presentation on progress report of final year project(gpsWasim Akram
 
Lecture 1 introdcution to engineering surveying
Lecture 1 introdcution to engineering surveyingLecture 1 introdcution to engineering surveying
Lecture 1 introdcution to engineering surveyingSarhat Adam
 
Digital Soil Mapping/ Pedomterics
Digital Soil Mapping/ Pedomterics Digital Soil Mapping/ Pedomterics
Digital Soil Mapping/ Pedomterics Soils FAO-GSP
 

Similar to Geographic Computation in Perl (20)

GIS & History of Mapping in Malaya (lecture notes circa 2009)
GIS & History of Mapping in Malaya (lecture notes circa 2009)GIS & History of Mapping in Malaya (lecture notes circa 2009)
GIS & History of Mapping in Malaya (lecture notes circa 2009)
 
Gps and planimeter
Gps and planimeterGps and planimeter
Gps and planimeter
 
G0343052058
G0343052058G0343052058
G0343052058
 
Global positioning system (gps)
Global positioning system (gps)Global positioning system (gps)
Global positioning system (gps)
 
Introduction to Geomatics _2014
Introduction to Geomatics _2014Introduction to Geomatics _2014
Introduction to Geomatics _2014
 
Projecteceb
ProjectecebProjecteceb
Projecteceb
 
Morocco2022_LocationProblem_Bondar.pptx
Morocco2022_LocationProblem_Bondar.pptxMorocco2022_LocationProblem_Bondar.pptx
Morocco2022_LocationProblem_Bondar.pptx
 
CI_SIModule_QGIS.pptx .
CI_SIModule_QGIS.pptx                         .CI_SIModule_QGIS.pptx                         .
CI_SIModule_QGIS.pptx .
 
GIS_FDP_Final.pdf
GIS_FDP_Final.pdfGIS_FDP_Final.pdf
GIS_FDP_Final.pdf
 
NDGISUC2017 - New Lidar Technologies for 3DEP
NDGISUC2017 - New Lidar Technologies for 3DEPNDGISUC2017 - New Lidar Technologies for 3DEP
NDGISUC2017 - New Lidar Technologies for 3DEP
 
Role of Sensors-Applications.pdf
Role of Sensors-Applications.pdfRole of Sensors-Applications.pdf
Role of Sensors-Applications.pdf
 
7 srtm paleochannels_aeromagnetics data
7 srtm paleochannels_aeromagnetics data7 srtm paleochannels_aeromagnetics data
7 srtm paleochannels_aeromagnetics data
 
Remote sensing ang GIS
Remote sensing ang GISRemote sensing ang GIS
Remote sensing ang GIS
 
Final ppt group ASHISH.pdf
Final ppt group ASHISH.pdfFinal ppt group ASHISH.pdf
Final ppt group ASHISH.pdf
 
GIS Research at UCL
GIS Research at UCLGIS Research at UCL
GIS Research at UCL
 
Presentation on progress report of final year project(gps
Presentation on progress report of final year project(gpsPresentation on progress report of final year project(gps
Presentation on progress report of final year project(gps
 
GPS.pdf
GPS.pdfGPS.pdf
GPS.pdf
 
intro_gps.ppt
intro_gps.pptintro_gps.ppt
intro_gps.ppt
 
Lecture 1 introdcution to engineering surveying
Lecture 1 introdcution to engineering surveyingLecture 1 introdcution to engineering surveying
Lecture 1 introdcution to engineering surveying
 
Digital Soil Mapping/ Pedomterics
Digital Soil Mapping/ Pedomterics Digital Soil Mapping/ Pedomterics
Digital Soil Mapping/ Pedomterics
 

More from Ian Kluft

"#AprilFools Hijinks" at SVPerl April 2021 meeting
"#AprilFools Hijinks" at SVPerl April 2021 meeting"#AprilFools Hijinks" at SVPerl April 2021 meeting
"#AprilFools Hijinks" at SVPerl April 2021 meetingIan Kluft
 
Secure Coding in Perl
Secure Coding in PerlSecure Coding in Perl
Secure Coding in PerlIan Kluft
 
New Perl module Container::Buildah - SVPerl presentation
New Perl module Container::Buildah - SVPerl presentationNew Perl module Container::Buildah - SVPerl presentation
New Perl module Container::Buildah - SVPerl presentationIan Kluft
 
Securing a Raspberry Pi and other DIY IoT devices
Securing a Raspberry Pi and other DIY IoT devicesSecuring a Raspberry Pi and other DIY IoT devices
Securing a Raspberry Pi and other DIY IoT devicesIan Kluft
 
Best Practices for Recovering Rocket & Balloon Payloads
Best Practices for Recovering Rocket & Balloon PayloadsBest Practices for Recovering Rocket & Balloon Payloads
Best Practices for Recovering Rocket & Balloon PayloadsIan Kluft
 
PiFlash: Linux utility to flash SD cards for Raspberry Pi computers
PiFlash: Linux utility to flash SD cards for Raspberry Pi computersPiFlash: Linux utility to flash SD cards for Raspberry Pi computers
PiFlash: Linux utility to flash SD cards for Raspberry Pi computersIan Kluft
 
Code Generation in Perl
Code Generation in PerlCode Generation in Perl
Code Generation in PerlIan Kluft
 
Command Line Arguments with Getopt::Long
Command Line Arguments with Getopt::LongCommand Line Arguments with Getopt::Long
Command Line Arguments with Getopt::LongIan Kluft
 
Black Rock Desert Impact Theory
Black Rock Desert Impact TheoryBlack Rock Desert Impact Theory
Black Rock Desert Impact TheoryIan Kluft
 
Exception Handling in Perl
Exception Handling in PerlException Handling in Perl
Exception Handling in PerlIan Kluft
 
Stratofox Aerospace Tracking Team presentation at Space Access 2013
Stratofox Aerospace Tracking Team presentation at Space Access 2013Stratofox Aerospace Tracking Team presentation at Space Access 2013
Stratofox Aerospace Tracking Team presentation at Space Access 2013Ian Kluft
 
Pacificon 200905
Pacificon 200905Pacificon 200905
Pacificon 200905Ian Kluft
 

More from Ian Kluft (12)

"#AprilFools Hijinks" at SVPerl April 2021 meeting
"#AprilFools Hijinks" at SVPerl April 2021 meeting"#AprilFools Hijinks" at SVPerl April 2021 meeting
"#AprilFools Hijinks" at SVPerl April 2021 meeting
 
Secure Coding in Perl
Secure Coding in PerlSecure Coding in Perl
Secure Coding in Perl
 
New Perl module Container::Buildah - SVPerl presentation
New Perl module Container::Buildah - SVPerl presentationNew Perl module Container::Buildah - SVPerl presentation
New Perl module Container::Buildah - SVPerl presentation
 
Securing a Raspberry Pi and other DIY IoT devices
Securing a Raspberry Pi and other DIY IoT devicesSecuring a Raspberry Pi and other DIY IoT devices
Securing a Raspberry Pi and other DIY IoT devices
 
Best Practices for Recovering Rocket & Balloon Payloads
Best Practices for Recovering Rocket & Balloon PayloadsBest Practices for Recovering Rocket & Balloon Payloads
Best Practices for Recovering Rocket & Balloon Payloads
 
PiFlash: Linux utility to flash SD cards for Raspberry Pi computers
PiFlash: Linux utility to flash SD cards for Raspberry Pi computersPiFlash: Linux utility to flash SD cards for Raspberry Pi computers
PiFlash: Linux utility to flash SD cards for Raspberry Pi computers
 
Code Generation in Perl
Code Generation in PerlCode Generation in Perl
Code Generation in Perl
 
Command Line Arguments with Getopt::Long
Command Line Arguments with Getopt::LongCommand Line Arguments with Getopt::Long
Command Line Arguments with Getopt::Long
 
Black Rock Desert Impact Theory
Black Rock Desert Impact TheoryBlack Rock Desert Impact Theory
Black Rock Desert Impact Theory
 
Exception Handling in Perl
Exception Handling in PerlException Handling in Perl
Exception Handling in Perl
 
Stratofox Aerospace Tracking Team presentation at Space Access 2013
Stratofox Aerospace Tracking Team presentation at Space Access 2013Stratofox Aerospace Tracking Team presentation at Space Access 2013
Stratofox Aerospace Tracking Team presentation at Space Access 2013
 
Pacificon 200905
Pacificon 200905Pacificon 200905
Pacificon 200905
 

Recently uploaded

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 

Recently uploaded (20)

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 

Geographic Computation in Perl

  • 1. Geographic Computation in Perl Presented by Ian Kluft Silicon Valley Perl March 3, 2011 Santa Clara, California Presented at SVPerl Geographic Computation in Perl Slide 1 of 23 March 3, 2011 By Ian Kluft
  • 2. Safety warning If you think the world is flat, this presentation will make your head explode. Presented at SVPerl Geographic Computation in Perl Slide 2 of 23 March 3, 2011 By Ian Kluft
  • 3. Geography is BIG Today ● Maps on paper go back to ancient times ● Electronic age: natural move to web and mobile ● Geography is a deeper subject than just maps ● Any data pertaining to Earth's surface ● Processing GPS data ● Computing Great Circle routes ● Geographic Information Systems (GIS) ● Location Based Services (LBS) Presented at SVPerl Geographic Computation in Perl Slide 3 of 23 March 3, 2011 By Ian Kluft
  • 4. Geospatial location data ● Locations on Earth can be specified by ● Latitude – angle north/south from equator to poles ● Longitude – angle east/west from Prime Meridian ● Altitude – height above/below mean sea level ● Altitude is omitted when using surface elevation ● Latitude and longitude are angles measured from the center of the Earth ● Geographic data is more correctly called geospatial data when broken down in this form Presented at SVPerl Geographic Computation in Perl Slide 4 of 23 March 3, 2011 By Ian Kluft
  • 5. Earth is not a perfect sphere ● Earth is an ellipsoid: bulges out at equator ● Centrifugal force from rotation causes this ● Geoid: mathematical models for Earth ellipsoid ● Good models come from satellite measurement ● Coordinates must use the same geographic reference system ● Otherwise comparing apples and oranges ● WGS84 most widely used coordinate system today Presented at SVPerl Geographic Computation in Perl Slide 5 of 23 March 3, 2011 By Ian Kluft
  • 6. Sources of Geospatial Data ● Data can be gathered by many sources ● Measured by professional surveyors ● Measured by satellite (remote sensing) ● Measured by professionals or amateurs by GPS ● Read from maps ● Geocoded from street addresses ● Computations relative to other data Presented at SVPerl Geographic Computation in Perl Slide 6 of 23 March 3, 2011 By Ian Kluft
  • 7. Lots of angles in Geospatial Data ● This may come as bad news ● There really was a use for that Trigonometry stuff some of you hated in school ● Many computations involve angles ● Latitude and longitude are angles ● Manipulations use trigonometric functions ● Useful to brush up on Trig to know what it's doing ● Trig functions use radians ● So numbers in degrees must be converted first Presented at SVPerl Geographic Computation in Perl Slide 7 of 23 March 3, 2011 By Ian Kluft
  • 8. Get Math::Trig Module from CPAN ● CPAN has many Perl modules to help with Trigonometry and Geospatial calculations ● Math::Trig has the basic foundation ● deg2rad() - convert degrees to radians ● rad2deg() - convert radians to degrees ● All the basic Trig functions ● A bonus: basic Great Circle calculations too ● http://search.cpan.org/search?query=Math%3A%3ATrig Presented at SVPerl Geographic Computation in Perl Slide 8 of 23 March 3, 2011 By Ian Kluft
  • 9. Great Circle Routes ● Great Circle: direct route over Earth's surface ● Along a line that would go around the sphere ● i.e. from San Jose to London crosses Greenland Map generated by the Great Circle Mapper - copyright © Karl L. Swartz. http://www.gcmap.com/ Presented at SVPerl Geographic Computation in Perl Slide 9 of 23 March 3, 2011 By Ian Kluft
  • 10. Great Circle Computations ● Useful for mapping and navigation ● Distance between any two points on Earth ● Initial course from one point to another ● Points along the path between two points ● Intersection of courses/lines/radials ● Projecting a point at distance/bearing from a point ● Even over small distances, they can still be computed as angles from center of the Earth Presented at SVPerl Geographic Computation in Perl Slide 10 of 23 March 3, 2011 By Ian Kluft
  • 11. Great Circle Tools and Info ● Many formulas at Aviation Formulary site ● by Ed Williams ● http://williams.best.vwh.net/avform.htm ● Great Circle online mapping tool ● by Karl Swartz ● http://gcmap.com/ ● O'Reilly's “Mapping Hacks” book ● by Erle, Gibson and Walsh Presented at SVPerl Geographic Computation in Perl Slide 11 of 23 March 3, 2011 By Ian Kluft
  • 12. Geospatial-related Perl Modules ● Perl modules with Great Circle functions ● Geo::Calc ● Geo::Track::Log ● GIS::Distance ● Perl module front-ends to mapping sites ● Geo::Google::StaticMaps – Google Maps ● Geo::OSM::StaticMaps – OpenStreetMap ● Many more – use search.cpan.org to search Presented at SVPerl Geographic Computation in Perl Slide 12 of 23 March 3, 2011 By Ian Kluft
  • 13. Examples Two examples follow with Perl code that was actually used for geographic computation to solve real problems. ● CanSat Search at Black Rock Desert Perl script generated search area coordinates for a missing payload from a rocket launch ● Balloon and tracking teams live APRS map Perl script makes live tracking map of teams chasing a high-altitude balloon Presented at SVPerl Geographic Computation in Perl Slide 13 of 23 March 3, 2011 By Ian Kluft
  • 14. Example 1 CanSat Search at Black Rock Desert Location: Black Rock Desert, Nevada Problem: Rocket launched, payload missing ● Soka University (Japan) students needed data ● AeroPac club knew rocket landing coordinates ● Turned to Stratofox Aerospace Tracking Team ● Transmitter batteries died before their contact ● I wrote a Perl script to generate a grid search Presented at SVPerl Geographic Computation in Perl Slide 14 of 23 March 3, 2011 By Ian Kluft
  • 15. Perl Script to Plot Search Grid ● Search area was 3x3 mile parallelogram ● Each side divided into 10 sections, 1584' long ● 10x10 loop projects each computed waypoint ● Command-line controls output to text or GPX ● “gpsbabel” turns GPX into many formats ● Raw Garmin waypoint data for upload to GPS ● KML for display on Google Earth Presented at SVPerl Geographic Computation in Perl Slide 15 of 23 March 3, 2011 By Ian Kluft
  • 16. Projecting Search Grid Waypoints ● Nested loop: i = 0-10 over, j = 0-10 up ● Over = 270° heading, up = 330° heading ● Convert lat/lon from degrees to radians ● Use Great Circle projection formula ● Compute intermediate point from i “over” ● Compute final point from j “up” ● Convert new lat/lon from radians to degrees ● Code available at svperl.org with slides Presented at SVPerl Geographic Computation in Perl Slide 16 of 23 March 3, 2011 By Ian Kluft
  • 17. Search Area Grid Map Result of the script shown on Google Earth Presented at SVPerl Geographic Computation in Perl Slide 17 of 23 March 3, 2011 By Ian Kluft
  • 18. Result: Success!!! Expected to be worse than needle in a haystack Payload found 2500' west of rocket landing site Presented at SVPerl Geographic Computation in Perl Slide 18 of 23 March 3, 2011 By Ian Kluft
  • 19. Example 2 Live APRS Balloon Tracking Map Problem: Display APRS tracking data for a balloon and our team who are tracking it ● APRS = Automatic Packet Reporting System, Ham Radio data protocol for transmitting your position ● The balloon and the tracking team all transmit their positions via APRS every minute or so ● Sites to display APRS data on a map don't do what we want Presented at SVPerl Geographic Computation in Perl Slide 19 of 23 March 3, 2011 By Ian Kluft
  • 20. APRS.FI posted their Perl code ● Popular APRS mapping site APRS.FI uses Perl ● They posted Ham::APRS::FAP (“fabulous APRS parser”) on CPAN for all Perl developers ● You need Ham Radio license to transmit APRS ● You do not need Ham Radio license to receive APRS data ● Many volunteers forward APRS packets to APRS-IS servers on the Internet ● Everyone can subscribe to data streams there Presented at SVPerl Geographic Computation in Perl Slide 20 of 23 March 3, 2011 By Ian Kluft
  • 21. Custom APRS Mapping Script ● Command-line parameter sets callsigns to log ● Subscribe to APRS-IS via Ham::APRS::FAP ● For each incoming line: ● Parse line w/ Ham::APRS::FAP ● Save data in a per-callsign list ● Update output file in GeoRSS format ● Output file URL can be used in near real-time as an input to Google Maps ● Code available at svperl.org with slides Presented at SVPerl Geographic Computation in Perl Slide 21 of 23 March 3, 2011 By Ian Kluft
  • 22. Balloon Chase on Google Maps ● A balloon on Feb 5, 2011 was lost in the ocean ● Teams chased it until Carmel – others watched Presented at SVPerl Geographic Computation in Perl Slide 22 of 23 March 3, 2011 By Ian Kluft
  • 23. What else can you do? ● Your imagination may be your only limit ● Get a Google Maps API key and you can embed Google Maps into your web pages ● Calculate air-mile distance of a trip you took ● Process satellite data downloaded from NASA ● What do you want to do? ● Post your new modules on CPAN! Presented at SVPerl Geographic Computation in Perl Slide 23 of 23 March 3, 2011 By Ian Kluft