Blog Posted December 17, 2012

Using the phl_geocode Ruby Gem

I recently released phl_geocode, a simple Ruby gem which gets latitude and longitude coordinates for a Philadelphia address.

Getting Started

1. Install phl_geocode:

1
gem install phl_geocode

2. Require phl_geocode:

1
require "phl_geocode"

3. Instantiate a PHLGeocode instance:

1
phl = PHLGeocode.new

4. Get latitude/longitude coordinates for a philadelphia address:

1
phl.get_coordinates "1500 market street"

Example response:

1
2
3
4
5
6
7
8
9
10
11
[{
  :address => "1500 MARKET ST",
  :similarity => 100,
  :latitude => 39.9521740263203,
  :longitude => -75.1661518986459
}, {
  :address => "1500S MARKET ST",
  :similarity => 99,
  :latitude => 39.9521740263203,
  :longitude => -75.1661518986459
}]