52
Introduction to Geo hacking with (amongst others) Yahoo Technology. Chris&an Heilmann, Ignite, London, 2nd of March 2010

Introduction to Geo hacking with (amongst others) Yahoo Technology

Embed Size (px)

DESCRIPTION

Introduction to geo technologies for hacking at the Georgia Tech Uni Hack day.

Citation preview

Page 1: Introduction to Geo hacking with (amongst others) Yahoo Technology

Introduction to Geo hacking with (amongst others)

Yahoo Technology.

Chris&an Heilmann, Ignite, London, 2nd of March 2010

Page 2: Introduction to Geo hacking with (amongst others) Yahoo Technology

Geolocation is the new thing.

Page 3: Introduction to Geo hacking with (amongst others) Yahoo Technology

Good news is that it is not hard to do.

Page 4: Introduction to Geo hacking with (amongst others) Yahoo Technology

In the following half hour or so I will show you how to solve almost all Geo problems using YQL.

Page 5: Introduction to Geo hacking with (amongst others) Yahoo Technology

Using YQL in JavaScript:

Page 6: Introduction to Geo hacking with (amongst others) Yahoo Technology

There are a few different ingredients to playing with geo location.

Page 7: Introduction to Geo hacking with (amongst others) Yahoo Technology

Finding the current location.

Turning a location into a place.

Finding a geographical hierarchy.

Geo-tagging information.

Displaying geo information.

Page 8: Introduction to Geo hacking with (amongst others) Yahoo Technology

Fin

din

g t

he

cu

rre

nt

locati

on

.

Finding the current location happens in different ways.

Page 9: Introduction to Geo hacking with (amongst others) Yahoo Technology

The creepy way - IP sniffing.

Fin

din

g t

he

cu

rre

nt

locati

on

.

Page 10: Introduction to Geo hacking with (amongst others) Yahoo Technology

Fin

din

g t

he

cu

rre

nt

locati

on

.

Page 11: Introduction to Geo hacking with (amongst others) Yahoo Technology

h;p://isithackday.com/hacks/geo/js‐loca&on.html

Fin

din

g t

he

cu

rre

nt

locati

on

.

Page 12: Introduction to Geo hacking with (amongst others) Yahoo Technology

The problem with IP sniffing is accuracy.

Fin

din

g t

he

cu

rre

nt

locati

on

.

Page 13: Introduction to Geo hacking with (amongst others) Yahoo Technology

The other problem: it is not reliable.

Fin

din

g t

he

cu

rre

nt

locati

on

.

Page 14: Introduction to Geo hacking with (amongst others) Yahoo Technology

The non-creepy and more accurate way - the W3C geolocation API.

Fin

din

g t

he

cu

rre

nt

locati

on

.

Page 15: Introduction to Geo hacking with (amongst others) Yahoo Technology

Fin

din

g t

he

cu

rre

nt

locati

on

.

Firefox/(Mobile) Safari/Chrome (dev build)

Page 16: Introduction to Geo hacking with (amongst others) Yahoo Technology

Another way is of course to get location information from the user’s social presence.F

ind

ing

th

e c

urr

en

t lo

cati

on

.

Page 17: Introduction to Geo hacking with (amongst others) Yahoo Technology

Plazes, FireEagle, Twitter, Yahoo, Flickr, Foursquare, Gowalla, Brightkite, Google Buzz/Latitude, Dopplr...F

ind

ing

th

e c

urr

en

t lo

cati

on

.

Page 18: Introduction to Geo hacking with (amongst others) Yahoo Technology

Having a latitude and longitude is fine and dandy but it is ambiguous.

Tu

rnin

g a

lo

cati

on

in

to a

pla

ce

.

Page 19: Introduction to Geo hacking with (amongst others) Yahoo Technology

The same lat/lon pair could be a lot of things - the centre of a town, a point of interest...

Tu

rnin

g a

lo

cati

on

in

to a

pla

ce

.

Page 20: Introduction to Geo hacking with (amongst others) Yahoo Technology

This is why we need to turn lat/lon into something that is human readable.

Tu

rnin

g a

lo

cati

on

in

to a

pla

ce

.

Page 21: Introduction to Geo hacking with (amongst others) Yahoo Technology

This is called reverse geocoding and there are a few services for it out there.

Tu

rnin

g a

lo

cati

on

in

to a

pla

ce

.

Page 22: Introduction to Geo hacking with (amongst others) Yahoo Technology

My personal favourite (as it works world-wide) is the Flickr reverse geocoder.

Tu

rnin

g a

lo

cati

on

in

to a

pla

ce

.

Page 23: Introduction to Geo hacking with (amongst others) Yahoo Technology

Tu

rnin

g a

lo

cati

on

in

to a

pla

ce

.

h;p://www.flickr.com/services/api/flickr.places.findByLatLon.html

Page 24: Introduction to Geo hacking with (amongst others) Yahoo Technology

You can use this using YQL:

Tu

rnin

g a

lo

cati

on

in

to a

pla

ce

.

select * from flickr.places wherelat=51.5142271 and lon=‐0.1289602

Page 25: Introduction to Geo hacking with (amongst others) Yahoo Technology

To get more in-depth data, use flickr and Yahoo Geo:

Tu

rnin

g a

lo

cati

on

in

to a

pla

ce

.

select * from geo.places where woeid in (  select place.woeid from flickr.places   where lat=51.5142271 and lon=‐0.1289602)

Page 26: Introduction to Geo hacking with (amongst others) Yahoo Technology

Tu

rnin

g a

lo

cati

on

in

to a

pla

ce

.

Page 27: Introduction to Geo hacking with (amongst others) Yahoo Technology

Tu

rnin

g a

lo

cati

on

in

to a

pla

ce

.

Page 28: Introduction to Geo hacking with (amongst others) Yahoo Technology

Quick word on woeid: Use it. (Flickr, Dopplr, Twitter and Yahoo do)

Tu

rnin

g a

lo

cati

on

in

to a

pla

ce

.

Page 29: Introduction to Geo hacking with (amongst others) Yahoo Technology

What’s around a certain location?

Fin

din

g a

ge

og

rap

hic

al

hie

rarc

hy.

h;p://developer.yahoo.com/geo/

Page 30: Introduction to Geo hacking with (amongst others) Yahoo Technology

GeoPlanet gives you hierarchies:

Parent, Ancestors, Children, Siblings, Neigbours, BelongTos.

Tu

rnin

g a

lo

cati

on

in

to a

pla

ce

.

Page 31: Introduction to Geo hacking with (amongst others) Yahoo Technology

Fin

din

g a

ge

og

rap

hic

al

hie

rarc

hy.

h;p://isithackday.com/geoplanet‐explorer/?woeid=615702

Page 32: Introduction to Geo hacking with (amongst others) Yahoo Technology

Fin

din

g a

ge

og

rap

hic

al

hie

rarc

hy.

h;p://isithackday.com/geoplanet‐explorer/geodrilldown.php

Page 33: Introduction to Geo hacking with (amongst others) Yahoo Technology

Fin

din

g a

ge

og

rap

hic

al

hie

rarc

hy.

Page 34: Introduction to Geo hacking with (amongst others) Yahoo Technology

Putting it all together, we can get this:

h;p://isithackday.com/hacks/geo/geotest.php

Fin

din

g t

he

cu

rre

nt

locati

on

.

Page 35: Introduction to Geo hacking with (amongst others) Yahoo Technology

What if you have no location but only a resource?

Ge

o-t

ag

gin

g i

nfo

rmati

on

.

Page 36: Introduction to Geo hacking with (amongst others) Yahoo Technology

h;p://developer.yahoo.com/geo/placemaker/Ge

o-t

ag

gin

g i

nfo

rmati

on

.

Page 37: Introduction to Geo hacking with (amongst others) Yahoo Technology

Placemaker takes a text, or a web URL and extracts the geographical information from it.

Ge

o-t

ag

gin

g i

nfo

rmati

on

.

Page 38: Introduction to Geo hacking with (amongst others) Yahoo Technology

Ge

o-t

ag

gin

g i

nfo

rmati

on

. select * from geo.placemaker where documentContent = "Hey I am in Atlanta! I came here from London and will travel onwards to Las Vegas and Sao Paulo" and documentType="text/plain"

Page 39: Introduction to Geo hacking with (amongst others) Yahoo Technology

Ge

o-t

ag

gin

g i

nfo

rmati

on

. select * from geo.placemaker where documentURL ="h;p://icant.co.uk" and documentType="text/html" and appid=""

select * from geo.placemaker where documentURL ="h;p://newsrss.bbc.co.uk/rss/newsonline_uk_edi&on/front_page/rss.xml"and documentType="text/rss" and appid=""

Page 40: Introduction to Geo hacking with (amongst others) Yahoo Technology

Placemaker returns places and references - you can use these to enhance texts with geo information.

Ge

o-t

ag

gin

g i

nfo

rmati

on

.

Page 41: Introduction to Geo hacking with (amongst others) Yahoo Technology

To see Placemaker in action, check out the GeoMaker hack.

Ge

o-t

ag

gin

g i

nfo

rmati

on

.

h;p://github.com/codepo8/geomaker

Page 42: Introduction to Geo hacking with (amongst others) Yahoo Technology

h;p://icant.co.uk/geomaker/Ge

o-t

ag

gin

g i

nfo

rmati

on

.

Page 43: Introduction to Geo hacking with (amongst others) Yahoo Technology

Displaying geo information is done via Map APIs

Dis

pla

yin

g g

eo

in

form

ati

on

.

Page 44: Introduction to Geo hacking with (amongst others) Yahoo Technology

By far the easiest way to build a very simple map is to use the Google static maps API.

Dis

pla

yin

g g

eo

in

form

ati

on

.

Page 45: Introduction to Geo hacking with (amongst others) Yahoo Technology

<img src=”h;p://maps.google.com/maps/api/sta&cmap?sensor=false&size=200x200&maptype=roadmap&key=YOUR_MAP_KEY&markers=color:blue|label:1|37.4447,‐122.161&markers=color:blue|label:2|37.3385,‐121.886&markers=color:blue|label:3|37.3716,‐122.038&markers=color:blue|label:4|37.7792,‐122.42” alt=””>

Dis

pla

yin

g g

eo

in

form

ati

on

.

Page 46: Introduction to Geo hacking with (amongst others) Yahoo Technology

If you want to use Yahoo Maps with the data returned from the earlier YQL calls here’s the code:

Dis

pla

yin

g g

eo

in

form

ati

on

.

Page 47: Introduction to Geo hacking with (amongst others) Yahoo Technology

Dis

pla

yin

g g

eo

in

form

ati

on

.

Page 48: Introduction to Geo hacking with (amongst others) Yahoo Technology

Dis

pla

yin

g g

eo

in

form

ati

on

.

Page 49: Introduction to Geo hacking with (amongst others) Yahoo Technology

If you want to use any map provider easily without deep-diving into an API, use Mapstraction.

Dis

pla

yin

g g

eo

in

form

ati

on

.

Page 50: Introduction to Geo hacking with (amongst others) Yahoo Technology

Dis

pla

yin

g g

eo

in

form

ati

on

.

h;p://www.mapstrac&on.com/

Page 51: Introduction to Geo hacking with (amongst others) Yahoo Technology

That’s it! You have the tools, now find a cause and get geo hacking!

h;p://delicious.com/tag/geotoys

Page 52: Introduction to Geo hacking with (amongst others) Yahoo Technology

  Chris&an Heilmann  h;p://wait‐&ll‐i.com   h;p://developer‐evangelism.com  h;p://twi;er.com/codepo8   

Cheers