SlideShare a Scribd company logo
1 of 39
Download to read offline
FUN WITH MAPS & PHP
Chris Shiflett — @shiflett — shiflett.org
Web aficionado, author, blogger, soccer player, bike
Who am I?   rider, beer drinker, music lover, Brooklynite.
0. Landice




   Dettifoss
TRAVELOG

Tag everything
– #landice


Blog
– every night


Timeline Visualizations
– maps?


A!regate and Plot
– photos, tweets, videos, etc.
1. Research




   Sjónarsker
EXISTING TOOLS

GPS
– Garmin GPS 60CSx


GPSBabel
– gpsbabel.org


EveryTrail
– everytrail.com


HoudahGeo
– houdah.com/houdahGeo/
2. Reykjavík




    Stóra-Víti
3. Photos




  Kirkjufell
<?xml version="1.0" encoding="UTF-8"?>
<gpx
  version="1.0"
  creator="GPSBabel - http://gpsbabel.org/"
  xmlns:xsi="http://w3.org/2001/XMLSchema-instance"
  xmlns="http://topografix.com/GPX/1/0"
  xsi:schemaLocation="http://topografix.com/GPX/1/0
                       http://topografix.com/GPX/1/0/gpx.xsd">
<time>2009-06-14T23:52:23Z</time>
<bounds minlat="64.143006038" minlon="-21.955686333"
maxlat="64.153455254" maxlon="-21.915427381"/>
<trk>
  <name>14-JUN-09 01</name>
<number>1</number>
<trkseg>
<trkpt lat="64.150910676" lon="-21.946594650">
  <ele>13.115112</ele>
  <time>2009-06-14T21:01:25Z</time>
</trkpt>
<trkpt lat="64.150785115" lon="-21.945423950">
  <ele>13.595825</ele>
  <time>2009-06-14T21:02:08Z</time>
</trkpt>
</trkseg>
</trk>
</gpx>
PARSING GPX
$xml = simplexml_load_file('trip.gpx');

foreach($xml->trk as $part) {
    foreach ($part->trkseg->trkpt as $point) {
        /*
        $point['lat']
        $point['lon']
        $point->time
        $point->ele
        */
    }
}
4. Maps




 Bláa lónið
Garmin GPS 60CSx               Nikon D300




                   HoudahGeo
EVERYTRAIL
$query = $db->prepare("SELECT     lat, lon
                       FROM       points
                       WHERE      timestamp > '$start'
                       AND        timestamp < '$end'
                       ORDER BY   timestamp");
$query->execute();

$points = array();

while ($row = $query->fetch()) {
    $points[] = array('lat' => $row['lat'],
                      'lon' => $row['lon']);
}

$trip['points'] = $points;
$json = json_encode($trip);
file_put_contents("/tmp/landice-$day.json", $json);
// FIXME: http://tr.im/selectclosest
$sql = "SELECT   lat, lon, elevation,
                 ABS(timestamp - :timestamp) as distance
        FROM     points
        ORDER BY distance
        LIMIT    1"
$select = $this->db->prepare($sql);
 
foreach ($this->photos as $photo) {
    $id = (string)$photo['id'];
 
    // Get lat and lon from points table.
    $select->execute(array('timestamp' => $photo['timestamp']));
    $row = $select->fetch();
    $this->photos[$id]['lat'] = $row['lat'];
    $this->photos[$id]['lon'] = $row['lon'];
    $this->photos[$id]['elevation'] = $row['elevation'];
}
FLICKR API

$flickrMethod = 'flickr.photos.getInfo';
$apiUrl = "http://api.flickr.com/services/rest/?
method={$flickrMethod}&api_key={$this->apiKey}&photo_id={$id}";
$xml = simplexml_load_file($apiUrl);
 
$title = (string)$xml->photo->title;
$desc = (string)$xml->photo->description;
Google Maps   OpenStreetMaps
5. Challenges




   Stykkishólmur
CLUSTERS
PERFORMANCE


20,000 points loaded on a
single map is very slow

You don’t need a# points
for every view

Mature solutions exist
–http://tr.im/polyline
6. Storytelling




     Reykjavík
7. Future




   Tjörnin
TRAILS




GPX Tracking
GEOLOCATION API




 http://mozi#a.com/en-US/firefox/geolocation/
  http://dev.w3.org/geo/api/spec-source.html
Click here
FEEDBACK?


Fo#ow me on Twitter
– @shiflett


Comment on my blog
– shiflett.org


Email me
– chris@shiflett.org
Thanks for listening!




Chris Shiflett — @shiflett — shiflett.org

More Related Content

Viewers also liked

OpenWrt Case Study 2008
OpenWrt Case Study 2008OpenWrt Case Study 2008
OpenWrt Case Study 2008Rex Tsai
 
遺失的時代精神 - Zeitgeist and GNOME Activity Journal
遺失的時代精神 - Zeitgeist and GNOME Activity Journal遺失的時代精神 - Zeitgeist and GNOME Activity Journal
遺失的時代精神 - Zeitgeist and GNOME Activity JournalRex Tsai
 
Get your FLOSS problems solved
Get your FLOSS problems solvedGet your FLOSS problems solved
Get your FLOSS problems solvedRex Tsai
 
Evolution Of Web Security
Evolution Of Web SecurityEvolution Of Web Security
Evolution Of Web SecurityChris Shiflett
 
Building a developer community with containers
Building a developer community with containersBuilding a developer community with containers
Building a developer community with containersRex Tsai
 
Sistem pencegah kebakaran
Sistem pencegah kebakaranSistem pencegah kebakaran
Sistem pencegah kebakaranUTHM
 

Viewers also liked (6)

OpenWrt Case Study 2008
OpenWrt Case Study 2008OpenWrt Case Study 2008
OpenWrt Case Study 2008
 
遺失的時代精神 - Zeitgeist and GNOME Activity Journal
遺失的時代精神 - Zeitgeist and GNOME Activity Journal遺失的時代精神 - Zeitgeist and GNOME Activity Journal
遺失的時代精神 - Zeitgeist and GNOME Activity Journal
 
Get your FLOSS problems solved
Get your FLOSS problems solvedGet your FLOSS problems solved
Get your FLOSS problems solved
 
Evolution Of Web Security
Evolution Of Web SecurityEvolution Of Web Security
Evolution Of Web Security
 
Building a developer community with containers
Building a developer community with containersBuilding a developer community with containers
Building a developer community with containers
 
Sistem pencegah kebakaran
Sistem pencegah kebakaranSistem pencegah kebakaran
Sistem pencegah kebakaran
 

Similar to Fun with Maps and PHP

Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011Masahiro Nagano
 
Keeping it Small: Getting to know the Slim Micro Framework
Keeping it Small: Getting to know the Slim Micro FrameworkKeeping it Small: Getting to know the Slim Micro Framework
Keeping it Small: Getting to know the Slim Micro FrameworkJeremy Kendall
 
GeoTechTalk InkSatogaeri Project
GeoTechTalk InkSatogaeri ProjectGeoTechTalk InkSatogaeri Project
GeoTechTalk InkSatogaeri ProjectKentaro Ishimaru
 
Keeping it small: Getting to know the Slim micro framework
Keeping it small: Getting to know the Slim micro frameworkKeeping it small: Getting to know the Slim micro framework
Keeping it small: Getting to know the Slim micro frameworkJeremy Kendall
 
Geo distance search with my sql presentation
Geo distance search with my sql presentationGeo distance search with my sql presentation
Geo distance search with my sql presentationGSMboy
 
OSCON july 2011
OSCON july 2011OSCON july 2011
OSCON july 2011chelm
 
Всеволод Струкчинский: Node.js
Всеволод Струкчинский: Node.jsВсеволод Струкчинский: Node.js
Всеволод Струкчинский: Node.jsYandex
 
Keeping It Small with Slim
Keeping It Small with SlimKeeping It Small with Slim
Keeping It Small with SlimRaven Tools
 
Monitoring Your ISP Using InfluxDB Cloud and Raspberry Pi
Monitoring Your ISP Using InfluxDB Cloud and Raspberry PiMonitoring Your ISP Using InfluxDB Cloud and Raspberry Pi
Monitoring Your ISP Using InfluxDB Cloud and Raspberry PiInfluxData
 
Geospatial Graphs made easy with OrientDB - Codemotion Warsaw 2016
Geospatial Graphs made easy with OrientDB - Codemotion Warsaw 2016Geospatial Graphs made easy with OrientDB - Codemotion Warsaw 2016
Geospatial Graphs made easy with OrientDB - Codemotion Warsaw 2016Luigi Dell'Aquila
 
Security: The Great WordPress Lockdown - WordCamp Melbourne - February 2011
Security: The Great WordPress Lockdown - WordCamp Melbourne - February 2011Security: The Great WordPress Lockdown - WordCamp Melbourne - February 2011
Security: The Great WordPress Lockdown - WordCamp Melbourne - February 2011John Ford
 
Advanced symfony Techniques
Advanced symfony TechniquesAdvanced symfony Techniques
Advanced symfony TechniquesKris Wallsmith
 
Das Web Wird Mobil - Geolocation und Location Based Services
Das Web Wird Mobil - Geolocation und Location Based ServicesDas Web Wird Mobil - Geolocation und Location Based Services
Das Web Wird Mobil - Geolocation und Location Based ServicesStephan Schmidt
 
Where20 2008 Ruby Tutorial
Where20 2008 Ruby TutorialWhere20 2008 Ruby Tutorial
Where20 2008 Ruby TutorialShoaib Burq
 

Similar to Fun with Maps and PHP (20)

Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
Designing Opeation Oriented Web Applications / YAPC::Asia Tokyo 2011
 
Keeping it Small: Getting to know the Slim Micro Framework
Keeping it Small: Getting to know the Slim Micro FrameworkKeeping it Small: Getting to know the Slim Micro Framework
Keeping it Small: Getting to know the Slim Micro Framework
 
Where in the world
Where in the worldWhere in the world
Where in the world
 
app.js.docx
app.js.docxapp.js.docx
app.js.docx
 
GeoTechTalk InkSatogaeri Project
GeoTechTalk InkSatogaeri ProjectGeoTechTalk InkSatogaeri Project
GeoTechTalk InkSatogaeri Project
 
Lithium Best
Lithium Best Lithium Best
Lithium Best
 
Keeping it small: Getting to know the Slim micro framework
Keeping it small: Getting to know the Slim micro frameworkKeeping it small: Getting to know the Slim micro framework
Keeping it small: Getting to know the Slim micro framework
 
Sample document
Sample documentSample document
Sample document
 
Geo distance search with my sql presentation
Geo distance search with my sql presentationGeo distance search with my sql presentation
Geo distance search with my sql presentation
 
OSCON july 2011
OSCON july 2011OSCON july 2011
OSCON july 2011
 
Всеволод Струкчинский: Node.js
Всеволод Струкчинский: Node.jsВсеволод Струкчинский: Node.js
Всеволод Струкчинский: Node.js
 
Keeping It Small with Slim
Keeping It Small with SlimKeeping It Small with Slim
Keeping It Small with Slim
 
Monitoring Your ISP Using InfluxDB Cloud and Raspberry Pi
Monitoring Your ISP Using InfluxDB Cloud and Raspberry PiMonitoring Your ISP Using InfluxDB Cloud and Raspberry Pi
Monitoring Your ISP Using InfluxDB Cloud and Raspberry Pi
 
Geospatial Graphs made easy with OrientDB - Codemotion Warsaw 2016
Geospatial Graphs made easy with OrientDB - Codemotion Warsaw 2016Geospatial Graphs made easy with OrientDB - Codemotion Warsaw 2016
Geospatial Graphs made easy with OrientDB - Codemotion Warsaw 2016
 
Play vs Rails
Play vs RailsPlay vs Rails
Play vs Rails
 
Security: The Great WordPress Lockdown - WordCamp Melbourne - February 2011
Security: The Great WordPress Lockdown - WordCamp Melbourne - February 2011Security: The Great WordPress Lockdown - WordCamp Melbourne - February 2011
Security: The Great WordPress Lockdown - WordCamp Melbourne - February 2011
 
Advanced symfony Techniques
Advanced symfony TechniquesAdvanced symfony Techniques
Advanced symfony Techniques
 
Das Web Wird Mobil - Geolocation und Location Based Services
Das Web Wird Mobil - Geolocation und Location Based ServicesDas Web Wird Mobil - Geolocation und Location Based Services
Das Web Wird Mobil - Geolocation und Location Based Services
 
Where20 2008 Ruby Tutorial
Where20 2008 Ruby TutorialWhere20 2008 Ruby Tutorial
Where20 2008 Ruby Tutorial
 
Php
PhpPhp
Php
 

Recently uploaded

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
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
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
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
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
 
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
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
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
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
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
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
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
 
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
 
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
 
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
 

Recently uploaded (20)

Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
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
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
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
 
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
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
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
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
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
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 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
 
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...
 
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 ...
 
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
 

Fun with Maps and PHP

  • 1. FUN WITH MAPS & PHP Chris Shiflett — @shiflett — shiflett.org
  • 2. Web aficionado, author, blogger, soccer player, bike Who am I? rider, beer drinker, music lover, Brooklynite.
  • 3. 0. Landice Dettifoss
  • 4. TRAVELOG Tag everything – #landice Blog – every night Timeline Visualizations – maps? A!regate and Plot – photos, tweets, videos, etc.
  • 5. 1. Research Sjónarsker
  • 6. EXISTING TOOLS GPS – Garmin GPS 60CSx GPSBabel – gpsbabel.org EveryTrail – everytrail.com HoudahGeo – houdah.com/houdahGeo/
  • 7. 2. Reykjavík Stóra-Víti
  • 8.
  • 9.
  • 10.
  • 11. 3. Photos Kirkjufell
  • 12. <?xml version="1.0" encoding="UTF-8"?> <gpx version="1.0" creator="GPSBabel - http://gpsbabel.org/" xmlns:xsi="http://w3.org/2001/XMLSchema-instance" xmlns="http://topografix.com/GPX/1/0" xsi:schemaLocation="http://topografix.com/GPX/1/0 http://topografix.com/GPX/1/0/gpx.xsd"> <time>2009-06-14T23:52:23Z</time> <bounds minlat="64.143006038" minlon="-21.955686333" maxlat="64.153455254" maxlon="-21.915427381"/> <trk> <name>14-JUN-09 01</name> <number>1</number> <trkseg> <trkpt lat="64.150910676" lon="-21.946594650"> <ele>13.115112</ele> <time>2009-06-14T21:01:25Z</time> </trkpt> <trkpt lat="64.150785115" lon="-21.945423950"> <ele>13.595825</ele> <time>2009-06-14T21:02:08Z</time> </trkpt> </trkseg> </trk> </gpx>
  • 13. PARSING GPX $xml = simplexml_load_file('trip.gpx'); foreach($xml->trk as $part) { foreach ($part->trkseg->trkpt as $point) { /* $point['lat'] $point['lon'] $point->time $point->ele */ } }
  • 14.
  • 15. 4. Maps Bláa lónið
  • 16. Garmin GPS 60CSx Nikon D300 HoudahGeo
  • 18.
  • 19. $query = $db->prepare("SELECT lat, lon FROM points WHERE timestamp > '$start' AND timestamp < '$end' ORDER BY timestamp"); $query->execute(); $points = array(); while ($row = $query->fetch()) { $points[] = array('lat' => $row['lat'], 'lon' => $row['lon']); } $trip['points'] = $points; $json = json_encode($trip); file_put_contents("/tmp/landice-$day.json", $json);
  • 20. // FIXME: http://tr.im/selectclosest $sql = "SELECT lat, lon, elevation, ABS(timestamp - :timestamp) as distance FROM points ORDER BY distance LIMIT 1" $select = $this->db->prepare($sql);   foreach ($this->photos as $photo) { $id = (string)$photo['id'];   // Get lat and lon from points table. $select->execute(array('timestamp' => $photo['timestamp'])); $row = $select->fetch(); $this->photos[$id]['lat'] = $row['lat']; $this->photos[$id]['lon'] = $row['lon']; $this->photos[$id]['elevation'] = $row['elevation']; }
  • 21. FLICKR API $flickrMethod = 'flickr.photos.getInfo'; $apiUrl = "http://api.flickr.com/services/rest/? method={$flickrMethod}&api_key={$this->apiKey}&photo_id={$id}"; $xml = simplexml_load_file($apiUrl);   $title = (string)$xml->photo->title; $desc = (string)$xml->photo->description;
  • 22.
  • 23. Google Maps OpenStreetMaps
  • 24. 5. Challenges Stykkishólmur
  • 25.
  • 27. PERFORMANCE 20,000 points loaded on a single map is very slow You don’t need a# points for every view Mature solutions exist –http://tr.im/polyline
  • 28. 6. Storytelling Reykjavík
  • 29.
  • 30.
  • 31.
  • 32.
  • 33. 7. Future Tjörnin
  • 35. GEOLOCATION API http://mozi#a.com/en-US/firefox/geolocation/ http://dev.w3.org/geo/api/spec-source.html
  • 37.
  • 38. FEEDBACK? Fo#ow me on Twitter – @shiflett Comment on my blog – shiflett.org Email me – chris@shiflett.org
  • 39. Thanks for listening! Chris Shiflett — @shiflett — shiflett.org