Look up street addresses, IP addresses,
and geographic coordinates
"Eiffel Tower"
place name or address → 48.8582, 2.2945
latitude, longitude
44.9817, -93.2783
latitude, longitude → 350 7th St N, Minneapolis, MN
street address
24.193.83.1
IP address → Brooklyn, NY, US
street address
Perform geographic queries using objects
Hotel.near(”Vancouver, Canada”)
find hotels near Vancouver
@event.nearbys
find other events near @event
@restaurant.distance_to(”Eiffel Tower”)
find distance from @restaurant to Eiffel Tower
@restaurant.bearing_to(”Eiffel Tower”)
find direction from @restaurant to Eiffel Tower
Geocoder::Calculations.geographic_center([
@brooklyn_bridge,
@chrysler_building,
@madison_square_garden])
find geographic center of multiple places
ActiveRecord Examples
(Mongoid and MongoMapper are very similar; please see README for details.)
Simple Geocoding by Street Address
Given a Venue model with known street address, automatically fetch coordinates after validation and store in latitude and longitude attributes:
# app/models/venue.rb
geocoded_by :address
after_validation :geocode