Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A very simple geocoder ...
tree: d5c3a59e30

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.


1. About

sGeo is a very simple minimalistic geocoder built around Geonames, and Sphinx. You can try to geocode any place in the world or just restrict it to US cities and zip codes. sGeo will not geocode full addresses as they are not available in Geonames. It will only geocode cities, zip codes or places such as national parks, universities, etc ... sGeo was first written in late 2007 to batch geocode the contractor database used in Chiefmall.

Feel free to try a demo.

2. Installation

Read for installation instructions.

3. How to use within your code

import sgeo
gc = sgeo.GeoCoder(usa_only=True)

# querying Geonames
location = 'Newport Beach, CA'
coords = gc.get_locations(location, limit=5)

# using MaxMind GeoIP
location = ''
coords = gc.get_locations(location)

# using
location = '94720'
coords = gc.get_locations(location)

# using Geonames to find nearby hotels
hits = gc.get_nearby_places(, coords.lon, 'hotels', radius=50*1000, limit=10)
print hits

4. Use command line interface for testing

python sgeo/sgeo/ --usa-only 'Newport Beach, CA'


python [options] place_name'

    Use to test and debug sGeo at the command line.'

        -l, --limit  int            : (default is 1)'
        --usa                       : USA geocoding only'
        --nearby  int               : show top nearby places on geonames'
        --listen  host:port         : address to searchd (default localhost:9312)'
        -h, --help                  : this help message'
Something went wrong with that request. Please try again.