Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
84 lines (52 sloc) 2.48 KB

NOTE: The current directory '.' refers to sgeo/sgeo.

  1. Download and extract the latest tar ball ===========================================

    wget; tar xvzf "the tar ball";

  2. Download geo data ====================

NOTE: GeoIP is optional. NOTE: You may want to download Geonames to ./data/geonames and zip-codes to ./data/zipcodesdotcom. NOTE: Because Geonames has unprecise zip code geo-information, we had to use of

  1. Setup and populate your database ===================================

Create the databases:

mysql -pe 'create database geonames character set utf8; create database zipcodesdotcom;'</pre>

Setup data to be populated:

Read comments in populate.sql, setup the appropriate paths and perform the formatting.

Create the required tables and load the data:

mysql -p geonames < ./sql/geonames.sql
mysql -p geonames < ./sql/geonames_more.sql
mysql -p geonames < ./sql/geonames_postals.sql
mysql -p zipcodesdotcom < ./sql/zipcodesdotcom.sql
  1. Download and install dependecies ===================================
  1. Setup Sphinx ================

Go over:

./config/indexer_example.conf and make sure to rename it config/indexer.conf.

Create Sphinx index:

/path-to-sphinx-bin/indexer -c ./config/indexer.conf --all

Serve Sphinx index:

/path-to-sphinx-bin/searchd -c ./config/indexer.conf

NOTE: You should run these commands in sgeo/sgeo if you haven't changed your paths in indexer.conf.

  1. Further configurations =========================

Go over:

./config/ and make sure to rename it

Add sgeo to your PYTHONPATH

  1. You're done! ===============

in your code:

import sgeo
gc = sgeo.GeoCoder(usa_only=usa)
sgeo.get_locations('Newport Beach, CA')

or use command line interface to test:

python 'Newport Beach, CA'

Check out the file for the full API.