# Geocoder

> Complete geocoding solution for Ruby

Source: https://talira.ai/catalog/geocoder-xes75jkg
Every listing: https://talira.ai/catalog.md

- Kind: Open source
- Types: Library, Command-line tool
- Categories: [location / geocoding](https://talira.ai/categories/location/geocoding), [languages / ruby / rails](https://talira.ai/categories/languages/ruby/rails)
- Licence: MIT[^2]
- Pricing: Free and open source[^2]
- Free tier: yes[^2]
- Self-hostable: yes[^1]
- API: yes[^1]
- Creator: Alex Reisner

Geocoder turns addresses into coordinates, coordinates into addresses and IP addresses into locations, through more than 40 services, among them Google's Geocoding API and [Google Places API](https://talira.ai/catalog/google-places-api-x0xgq1bg.md), Nominatim, Mapbox, HERE, Bing, Esri, OpenCage, Geoapify and many national and IP lookup APIs, or a local MaxMind GeoLite2 database. Added to an ActiveRecord or Mongoid model with `geocoded_by` or `reverse_geocoded_by`, it fills latitude and longitude on save and adds `near` and `within_bounding_box` scopes, distances and bearings for [MySQL](https://talira.ai/catalog/mysql-dy4scprm.md), [PostgreSQL](https://talira.ai/catalog/postgresql-cm55wcnd.md) and [SQLite](https://talira.ai/catalog/sqlite-cys3nt23.md). It caches results in [Redis](https://talira.ai/catalog/redis-v917j45s.md) or any key-value store, adds a `location` method to Rack requests, has a test lookup for specs and ships a `geocode` command. Alex Reisner first released it in 2009.

## Links

- Website: https://www.rubygeocoder.com/
- GitHub: https://github.com/alexreisner/geocoder

## Problems it solves

- turn the street addresses in my database into latitude and longitude
- find all stores within 20 miles of a customer's location in my Rails app
- show the nearest locations to the visitor based on their IP address
- get a readable address back from GPS coordinates a phone app sent
- switch geocoding providers without rewriting my code when one gets expensive
- cache geocoding API responses so I don't burn through my daily quota
- geocode thousands of existing records in batches without hitting rate limits
- use different geocoding services for addresses in different countries
- work out the distance and compass bearing between two points in Ruby
- look up an IP's city offline from a downloaded MaxMind database
- stop my specs making real network calls to the geocoding API
- geocode an address from the terminal to check what a provider returns
- sort search results by distance from a postcode

## Features

- forward and reverse geocoding
- IP address geolocation, including Rack request.location and safe_location
- more than 40 street address and IP lookup services, plus local MaxMind GeoLite2 and IP2Location LITE files
- geocoded_by and reverse_geocoded_by for ActiveRecord and Mongoid models
- near, within_bounding_box and nearbys scopes with distance and bearing
- distance, bearing and geographic center calculations
- result caching in Redis, Rails.cache or any key-value store
- per-lookup configuration and per-model lookup selection
- rake geocode:all with batches, sleep and limit options
- test lookup that returns stubbed results
- geocode command-line tool
- works outside Rails with ActiveRecord, e.g. Sinatra

## Limitations

- Doesn't hold its own geocoding data: every lookup goes to an outside service you configure (or a local MaxMind file for IPs), and accuracy depends on it[^1]
- No radius or distance queries for MongoDB models: use MongoDB's own geospatial queries[^1]

## Capabilities

- Has an API: plan not known
- Has a command line tool: plan not known

## Trust

Overall: 0.34 out of 1.
Signals: backing 0.20, extensibility 0.40.

- created by Alex Reisner

Warnings:

- GitHub activity not fetched yet

## Alternatives

- [Nominatim](https://talira.ai/catalog/nominatim-fa4w8qyj.md): Open-source geocoding with OpenStreetMap data
- [OpenCage](https://talira.ai/catalog/opencage-7c03gnkk.md): Forward and reverse geocoding API built on open data, at a flat monthly fee
- [Smarty](https://talira.ai/catalog/smarty-abh4c25q.md): Address verification, autocomplete and geocoding APIs (formerly SmartyStreets)

## Sources

[^1]: https://github.com/alexreisner/geocoder (checked 20 Nov 2026)
[^2]: https://github.com/alexreisner/geocoder/blob/master/LICENSE (checked 20 Nov 2026)
