Using PERL for Geocoding

Our editor, Jason Gilmore, has written two excellent articles (1 and 2) about using perl’s Geo::Coder::US module to build a home-grown geocoder. It uses the TIGER/Line data and the code behind the service to build something very quickly and robustly.

These articles inspired Chapter 11 of our new book, so they get a BIG thank you here. We didn’t cover this perl module in the book because we wanted to keep it 100% PHP-based. We decided that since there was no equivalent to Geo::Coder::US in the PECL or PEAR repositories we’d explore building a work-alike from the ground up in PHP. Thus Chapter 11 was born.

However, Chapter 11 is large, involved, very detailed and not for the faint of heart. It is truly on the “professional” end of the spectrum in terms of content. For those of you in a hurry or with basic perl experience might want to consider playing with the Geo::Coder::US stuff first, and Jason’s articles will get you started in a hurry.

Side Note: In the process of digging through the documentation on TIGER/Line to determine how we could go about building a geocoder from scratch we discovered a whole array of amazing data that can be used for mapping, so learning the internals is well worth the effort in Chapter 11. We highlight some of the coolest parts of this in Appendix A.

2 Responses to “Using PERL for Geocoding”  

  1. 1 Stephan Wehner

    How about none-US addresses?


  2. 2 Cam

    The same principles apply for non-US sources though the internals of the parsing of the raw data will be different. In Chapter 11 of the book I go into great detail on building a Geocoder from scratch for a number of different data sources. This should work as a guide for any country’s data source, but finding and parsing the data is up to you.

    I hope this helps.

Buy Our Books!

(Here's Why) PHP book Rails book DOM book mashups book