Introduction

Pygeoclients is a simple Python module with a collection of command-line utilities to import, geocode and show a map of addresses. It was intented to to plot business clients on a map in a simple and easy way.

Pygeoclients can automatically import addresses from follow databases (which are the currently supported databases of SQLAlchemy):

Warning

you must install database python drivers above cited in order to use them.

The process of Pygeoclients can be viewed as:

  1. Import addresses from a source to any database
  2. Geocode the imported addresses
  3. Start the Geoserver to plot the addreses on a map

Pygeoclients comes with three small command-line utilities to make it possible:

  • pygeoclients.polyglot: the utility used to import data from databases to the Pygeoclient’s format.
  • pygeoclients.db: a tool to manage the Pygeoclient’s databases.
  • pygeoclients.geocoding: the geocode service, used to convert address to map locations.
  • pygeoclients.geoserver: the addresses server, this server is used from the map applications.

Installing

The install of Pygeoclients is very easy, you must just type:

easy_install pygeoclients

or go to the download page.

Creating database connections

Pygeoclients uses the great SQLAlchemy module to manage connections with databases, so in the curse of this tutorial, you’ll see many database connection strings like mysql://localhost/foo; these strings follow the SQLAlchemy engine creation rules, here is some examples of how to create these connection strings:

# postgres
pg_db = create_engine('postgres://scott:tiger@localhost:5432/mydatabase')

# sqlite (note the four slashes for an absolute path)
sqlite_db = create_engine('sqlite:////absolute/path/to/database.txt')
sqlite_db = create_engine('sqlite:///relative/path/to/database.txt')
sqlite_db = create_engine('sqlite://')  # in-memory database
sqlite_db = create_engine('sqlite://:memory:')  # the same

# mysql
mysql_db = create_engine('mysql://localhost/foo')

# oracle
oracle_db = create_engine('oracle://scott:tiger@host:port/dbname?key1=value1&key2=value2')

# oracle via TNS name
oracle_db = create_engine('oracle://scott:tiger@tnsname')
oracle_db = create_engine('oracle://scott:tiger@tnsname/?key1=value1&key2=value2')

# oracle will feed host/port/SID into cx_oracle.makedsn
oracle_db = create_engine('oracle://scott:tiger@127.0.0.1:1521/sidname')

# mssql
mssql_db = create_engine('mssql://username:password@localhost/database')

# mssql via a DSN connection
mssql_db = create_engine('mssql://mydsn')
mssql_db = create_engine('mssql://username:password@mydsn')

For more information, see the SQLAlchemy site.

Table Of Contents

Previous topic

Welcome to Pygeoclients’s docs !

Next topic

Utilities Manual

This Page