SlideShare ist ein Scribd-Unternehmen logo
1 von 33
&Beer
 GeoLocation

 @NeilCrosby
I’m Neil Crosby
          (everywhere)
I work for
         the BBC
http://www.flickr.com/photos/captaintim/3117409726/
On the homepage
I did the location stuff
But that’s boring
There’s
                no beer
http://www.flickr.com/photos/mehan/3979975563/
And no
        geolocation
http://www.flickr.com/photos/irisheyes/17560846/
What will I talk about?


          Building beernear.me
          “A simple weekend project
          to learn about geolocation”
So?

• Location finding using navigator.geolocation
• Translating lat/lon to an address
• Static google maps

                   http://www.flickr.com/photos/yersinia/2051806493/
navigator.geolocation
        support

• Firefox 3.5+
• Mobile Safari
• Chrome(ish)
Other APIs are available


       Geode
       (Firefox 3.1)
       Loki (Skyhook
       plugin)
       Google Gears
                http://www.flickr.com/photos/st3f4n/4482211416/
geolocation

if (navigator.geolocation) {
   // do geolocation
} else {
   // say sorry to the user
}


              http://www.flickr.com/photos/fweez/278017185/
Find the user’s location
nav….geo….getCurrentPosition(
   foundLocationFunc,
   noLocationFunc,
   {
     enableHighAccuracy: true,
     maximumAge: 120000
   }
);
          http://www.flickr.com/photos/clevergrrl/218312595/
Keep finding the user
nav….geo….watchPosition(
   foundLocationFunc,
   noLocationFunc,
   {
     enableHighAccuracy: true,
     maximumAge: 120000
   }
);
         http://www.flickr.com/photos/pierrickblons/4496055947/
You’ve got a location!
      http://dev.w3.org/geo/api/spec-source.html#position_interface

function
foundLocationFunc(position) {
  // position.coords.latitude
  // position.coords.longitude
  // position.coords.accuracy
  // and more…
}
            http://www.flickr.com/photos/merlijnhoek/2789604490/
• But we only know a lat/lon.
• Where is the user really?

                  http://www.flickr.com/photos/ancawonka/116484666/
Getting an address
http://ajax.googleapis.com
/ajax/services/search/local
  ?v=1.0
  &q=lat,lon
  &key=yourkey



               http://www.flickr.com/photos/csessums/4415113131/
Blob of location data
{"responseData": {"results":[{
  …
  "title":"Kelly Langley…",
  "streetAddress":"Cowley Rd,
    Cavendish House…",
  "city":"Cambridge",
     …
}]}}
           http://www.flickr.com/photos/locator/948390609/
Awesome!
So we can tell the user
where they are.
How about a static
map?                      http://www.flickr.com/photos/clintjcl/3657971496/
Why a static map?




 Reduced load for iPhone users.
              http://www.flickr.com/photos/petereed/496392956/
Getting a static map
http://maps.google.com/maps/
api/staticmap
  ?sensor=true
  &size=320x300&zoom=15
  &maptype=roadmap
  &mobile=true
  &center=lat,lon
        http://www.flickr.com/photos/manitobamaps/2340939496/
Yay! A Map!
Custom markers
markers=
icon:http%3A%2F%2Fbeernear.me
%2Fimg.png
|shadow:false
|52.2282962,0.1537945
|52.134152,-0.486364

          http://www.flickr.com/photos/denisgiles/4291494985/
Put it all
together
First, the iPhone asks for
permission because we used
getCurrentPosition
We say “thanks for sharing”
because getCurrentPosition
returned successfully.
Send lat/lon to google.
Translate to address.
Then accuracy improves and
we do the same again.
Click through.
We have beer!
Where’s the beer?
There’s the beer!
Further Reading

• W3 geolocation documentation
• Google Static Maps API
• Google Local Search API
• My blog - The Code Train

   http://www.flickr.com/photos/trucolorsfly/352573802/
I’ve been @NeilCrosby

Weitere ähnliche Inhalte

Andere mochten auch

Perceptual map of Head and shoulder
Perceptual map of Head and shoulderPerceptual map of Head and shoulder
Perceptual map of Head and shoulder
Saad Munami
 
Competitive positioning through perceptual mapping
Competitive positioning through perceptual mappingCompetitive positioning through perceptual mapping
Competitive positioning through perceptual mapping
Abhinav Gulati
 
Perceptual mapping techniques
Perceptual mapping techniquesPerceptual mapping techniques
Perceptual mapping techniques
Axay Pithava
 

Andere mochten auch (20)

What is obesity
What is obesityWhat is obesity
What is obesity
 
Chapter 7
Chapter 7Chapter 7
Chapter 7
 
330345 634022944265375000
330345 634022944265375000330345 634022944265375000
330345 634022944265375000
 
T.V map positioning
T.V map positioningT.V map positioning
T.V map positioning
 
Perceptual map of Head and shoulder
Perceptual map of Head and shoulderPerceptual map of Head and shoulder
Perceptual map of Head and shoulder
 
RESILIA positioning map
RESILIA positioning mapRESILIA positioning map
RESILIA positioning map
 
2013 Summer School
2013 Summer School2013 Summer School
2013 Summer School
 
150 Basic Business Diagrams for business presentation
150 Basic Business Diagrams for business presentation150 Basic Business Diagrams for business presentation
150 Basic Business Diagrams for business presentation
 
Competitive positioning through perceptual mapping
Competitive positioning through perceptual mappingCompetitive positioning through perceptual mapping
Competitive positioning through perceptual mapping
 
positioning map of beer
positioning map of beer positioning map of beer
positioning map of beer
 
Krispy Kreme SPACE Matrix, BCG Matrix and Product Positioning Map
Krispy Kreme SPACE Matrix, BCG Matrix and Product Positioning MapKrispy Kreme SPACE Matrix, BCG Matrix and Product Positioning Map
Krispy Kreme SPACE Matrix, BCG Matrix and Product Positioning Map
 
Multidimensional Perceptual Map for Project Prioritization and Selection - 20...
Multidimensional Perceptual Map for Project Prioritization and Selection - 20...Multidimensional Perceptual Map for Project Prioritization and Selection - 20...
Multidimensional Perceptual Map for Project Prioritization and Selection - 20...
 
Cebu Pacific Air SPACE Matrix, BCG Matrix, Product Positioning Map
Cebu Pacific Air SPACE Matrix, BCG Matrix, Product Positioning MapCebu Pacific Air SPACE Matrix, BCG Matrix, Product Positioning Map
Cebu Pacific Air SPACE Matrix, BCG Matrix, Product Positioning Map
 
Basics of brand map
Basics of brand mapBasics of brand map
Basics of brand map
 
Enu market segmentation 090912
Enu market segmentation 090912Enu market segmentation 090912
Enu market segmentation 090912
 
Perceptual mapping techniques
Perceptual mapping techniquesPerceptual mapping techniques
Perceptual mapping techniques
 
Mc donald's ppt
Mc donald's   pptMc donald's   ppt
Mc donald's ppt
 
Starbucks Redefining A Cup of Joe - SPACE Matrix, BCG Matrix, Product Positio...
Starbucks Redefining A Cup of Joe - SPACE Matrix, BCG Matrix, Product Positio...Starbucks Redefining A Cup of Joe - SPACE Matrix, BCG Matrix, Product Positio...
Starbucks Redefining A Cup of Joe - SPACE Matrix, BCG Matrix, Product Positio...
 
Ray-Ban Consumer Study
Ray-Ban Consumer StudyRay-Ban Consumer Study
Ray-Ban Consumer Study
 
McDonalds SPACE Matrix, BCG Matrix, Product Positioning Map
McDonalds SPACE Matrix, BCG Matrix, Product Positioning MapMcDonalds SPACE Matrix, BCG Matrix, Product Positioning Map
McDonalds SPACE Matrix, BCG Matrix, Product Positioning Map
 

Ähnlich wie Geolocation and Beer

Hacking up location aware apps
Hacking up location aware appsHacking up location aware apps
Hacking up location aware apps
Anshu Prateek
 
Library of Congress - Neogeography and Geospatial data preservation
Library of Congress - Neogeography and Geospatial data preservationLibrary of Congress - Neogeography and Geospatial data preservation
Library of Congress - Neogeography and Geospatial data preservation
Andrew Turner
 
GTALUG Presentation on CouchDB
GTALUG Presentation on CouchDBGTALUG Presentation on CouchDB
GTALUG Presentation on CouchDB
Myles Braithwaite
 
Drupal and the GeoSpatial Web
Drupal and the GeoSpatial WebDrupal and the GeoSpatial Web
Drupal and the GeoSpatial Web
Andrew Turner
 

Ähnlich wie Geolocation and Beer (20)

Locate your hacks
Locate your hacksLocate your hacks
Locate your hacks
 
Hacking up location aware apps
Hacking up location aware appsHacking up location aware apps
Hacking up location aware apps
 
Maps 4 Africa
Maps 4 AfricaMaps 4 Africa
Maps 4 Africa
 
Location.Aware
Location.AwareLocation.Aware
Location.Aware
 
Web 2.0
Web 2.0Web 2.0
Web 2.0
 
Introduction to CouchDB
Introduction to CouchDBIntroduction to CouchDB
Introduction to CouchDB
 
Putting Folklore in Its Place
Putting Folklore in Its PlacePutting Folklore in Its Place
Putting Folklore in Its Place
 
Open hack 2011-ppt-geo
Open hack 2011-ppt-geoOpen hack 2011-ppt-geo
Open hack 2011-ppt-geo
 
Library of Congress - Neogeography and Geospatial data preservation
Library of Congress - Neogeography and Geospatial data preservationLibrary of Congress - Neogeography and Geospatial data preservation
Library of Congress - Neogeography and Geospatial data preservation
 
Zoom in on Mapping and Location
Zoom in on Mapping and LocationZoom in on Mapping and Location
Zoom in on Mapping and Location
 
Where20 2008 Ruby Tutorial
Where20 2008 Ruby TutorialWhere20 2008 Ruby Tutorial
Where20 2008 Ruby Tutorial
 
The Shape of Alpha
The Shape of AlphaThe Shape of Alpha
The Shape of Alpha
 
Seti 09
Seti 09Seti 09
Seti 09
 
O'Reilly WebCast - Trends And Technologies In Where2.0
O'Reilly WebCast - Trends And Technologies In Where2.0O'Reilly WebCast - Trends And Technologies In Where2.0
O'Reilly WebCast - Trends And Technologies In Where2.0
 
GTALUG Presentation on CouchDB
GTALUG Presentation on CouchDBGTALUG Presentation on CouchDB
GTALUG Presentation on CouchDB
 
GeoClue - State of the Map 2007
GeoClue - State of the Map 2007GeoClue - State of the Map 2007
GeoClue - State of the Map 2007
 
The Ecology of Information: A Future in a Library Without Walls
The Ecology of Information:  A Future in a Library Without WallsThe Ecology of Information:  A Future in a Library Without Walls
The Ecology of Information: A Future in a Library Without Walls
 
GeoTechTalk InkSatogaeri Project
GeoTechTalk InkSatogaeri ProjectGeoTechTalk InkSatogaeri Project
GeoTechTalk InkSatogaeri Project
 
The gate
The gateThe gate
The gate
 
Drupal and the GeoSpatial Web
Drupal and the GeoSpatial WebDrupal and the GeoSpatial Web
Drupal and the GeoSpatial Web
 

Mehr von Neil Crosby (11)

team++; making your team work better together
team++; making your team work better togetherteam++; making your team work better together
team++; making your team work better together
 
team++
team++team++
team++
 
Lagging Pipes
Lagging PipesLagging Pipes
Lagging Pipes
 
Yahoo! Pipes: Munging, Mixing and Mashing
Yahoo! Pipes: Munging, Mixing and MashingYahoo! Pipes: Munging, Mixing and Mashing
Yahoo! Pipes: Munging, Mixing and Mashing
 
Search Monkey - Open Hack London '09
Search Monkey - Open Hack London '09Search Monkey - Open Hack London '09
Search Monkey - Open Hack London '09
 
Automated Frontend Testing
Automated Frontend TestingAutomated Frontend Testing
Automated Frontend Testing
 
I'll Show You Mine If You Show Me Yours...
I'll Show You Mine If You Show Me Yours...I'll Show You Mine If You Show Me Yours...
I'll Show You Mine If You Show Me Yours...
 
TV Tubes - Talkin' 'bout my automation...
TV Tubes - Talkin' 'bout my automation...TV Tubes - Talkin' 'bout my automation...
TV Tubes - Talkin' 'bout my automation...
 
Starting to Monkey Around With Yahoo! Search Monkey
Starting to Monkey Around With Yahoo! Search MonkeyStarting to Monkey Around With Yahoo! Search Monkey
Starting to Monkey Around With Yahoo! Search Monkey
 
Multi-level vCards
Multi-level vCardsMulti-level vCards
Multi-level vCards
 
Twitter Bots
Twitter BotsTwitter Bots
Twitter Bots
 

Kürzlich hochgeladen

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Kürzlich hochgeladen (20)

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 

Geolocation and Beer

Hinweis der Redaktion