Geocoding the World in Perl YAPC::EU 2014

33
Geocoding the World (in Perl) Alex Balhatchet @ YAPC::EU 2014, София България

description

Yet another introduction to the challenges of geocoding and the ways we approach those problems at Lokku/Nestoria. I describe the details of how we tackle geocoding in countries like India, and also plug our the new OpenCage Data Geocoder API.

Transcript of Geocoding the World in Perl YAPC::EU 2014

Page 1: Geocoding the World in Perl YAPC::EU 2014

Geocoding the World(in Perl)

Alex Balhatchet @ YAPC::EU 2014, София България

Page 2: Geocoding the World in Perl YAPC::EU 2014
Page 3: Geocoding the World in Perl YAPC::EU 2014
Page 4: Geocoding the World in Perl YAPC::EU 2014
Page 5: Geocoding the World in Perl YAPC::EU 2014

What is Geocoding?

Page 6: Geocoding the World in Perl YAPC::EU 2014

What is Geocoding?

147Tsarigradsko shose blvd1784SofiaBulgaria

Geocoder

42.649996

23.394527

Page 7: Geocoding the World in Perl YAPC::EU 2014

Geocoding at Nestoria

Page 8: Geocoding the World in Perl YAPC::EU 2014

Geocoding at Nestoria

Property Listing(XML)

Geocoder(Perl!)

Results(Percona)

Page 9: Geocoding the World in Perl YAPC::EU 2014

UK - so beautiful...<location>

<full_address>Wold View, Caistor LN7</full_address>

<postcode>LN7 6UU</postcode>

<latitude>53.496356</latitude>

<longitude>-0.312442</longitude>

<coordinate_system>WGS84</coordinate_system>

<coordinate_confidence unit="gmaps">5</coordinate_confidence>

<placenames>

<street number="4">Wold View</street>

<town>Caistor, Market Rasen</town>

</placenames>

</location>

Page 10: Geocoding the World in Perl YAPC::EU 2014

UK Postcodes are insane<postcode>LN7 6UU</postcode>

Page 11: Geocoding the World in Perl YAPC::EU 2014

Germany - still quite good

<geo>

<strasse>Fischbeker Weg 12</strasse>

<ort>Bargteheide</ort>

<bundesland>Schleswig-Holstein</bundesland>

<plz>22941</plz>

</geo>

Page 12: Geocoding the World in Perl YAPC::EU 2014

France - surprisingly bad data

<location>

<postcode>47000</postcode>

<placenames>

<town></town>

<region>Aquitaine</region>

</placenames>

</location>

Page 13: Geocoding the World in Perl YAPC::EU 2014

India - nightmare mode unlocked<location>

<full_address>Hiland Landmark,Jangamakote, Vijayapura, Devanahalli, Bangalore, Karnataka, INDIA.</full_address>

<latitude>13.280192></latitude>

<longitude>77.848219</longitude>

<placenames>

<building>Hiland Landmark</building>

<area>Devanahalli</area>

<town>Bangalore</town>

<province>jangamakote</province>

</placenames>

</location>

Page 14: Geocoding the World in Perl YAPC::EU 2014

India - nightmare mode unlocked

Page 15: Geocoding the World in Perl YAPC::EU 2014

The SolutionThe Nestoria Geocoder

Page 16: Geocoding the World in Perl YAPC::EU 2014

Geodata

+ our own “amendments”

Page 17: Geocoding the World in Perl YAPC::EU 2014

Nestoria Geocoder Internals

Page 18: Geocoding the World in Perl YAPC::EU 2014

Nestoria Geocoder Internals

Page 19: Geocoding the World in Perl YAPC::EU 2014

Nestoria Geocoder Internals

Page 20: Geocoding the World in Perl YAPC::EU 2014

Nestoria Geocoder Internals

Page 21: Geocoding the World in Perl YAPC::EU 2014

Nestoria Geocoder Internals

Page 22: Geocoding the World in Perl YAPC::EU 2014

Nestoria Geocoder Internals

Page 23: Geocoding the World in Perl YAPC::EU 2014

Nestoria Geocoder Internals

Page 24: Geocoding the World in Perl YAPC::EU 2014

Nestoria Geocoder Internals

Page 25: Geocoding the World in Perl YAPC::EU 2014

Nestoria Geocoder Internals

Page 26: Geocoding the World in Perl YAPC::EU 2014

Nestoria Geocoder Internals

Page 27: Geocoding the World in Perl YAPC::EU 2014

External Geocoders

■ https://metacpan.org/search?q=Geo::Coder

■ Lots available!

■ Mostly very low daily usage limits (1000s per day)

■ We wrote Geo::Coder::Many to help multiplex between them within usage limits

Page 28: Geocoding the World in Perl YAPC::EU 2014

The Bad News

Page 29: Geocoding the World in Perl YAPC::EU 2014
Page 30: Geocoding the World in Perl YAPC::EU 2014

The Good News

Page 31: Geocoding the World in Perl YAPC::EU 2014

OpenCage Geocoder API

■ http://geocoder.opencagedata.com/

■ Geo::Coder::OpenCage

■ Currently free

■ Will always have a free tier

Page 32: Geocoding the World in Perl YAPC::EU 2014

OpenCage Geocoder API

■ It’s new!

■ Please try it out and give us your feedback

■ @opencagedata

■ geocoder.opencagedata.com/contact.html

Page 33: Geocoding the World in Perl YAPC::EU 2014

Thanks / Questions