This is a simple session of how to use Pygeoclients.
Suppose you have a MySQL database named “cli” and it contains the table “client” with the field “address”, which represents the address of each person. You MySQL database is located at “mydbserver.com” and uses the user “root” with password “12345”.
The first thing you need is to create the connection string for this structure, which can be:
mysql://root:12345@mydbserver.com/cli
As you can see, it clearly represents our database.
And suppose that you want to store the imported client’s addresses into a SQLite3 database (in a file), so our connection string for the destination database is:
sqlite:///database.db
Please note the three slashs, they represent a file database, if you use two, it will maybe create a in-memory database.
The next step is to use the Polyglot utility to import the addresses from our MySQL database and store them into a Pygeoclient’s format SQLite3 database.
The command should be this in our example:
python -m pygeoclients.polyglot -s mysql://root:12345@mydbserver.com/cli -d sqlite:///database.db -f client.address
And voila, the addresses of our clients are now stored into the “database.db” file. The next step is to geocode them.
Now, we will use the Geocoding utility to use the Google geocoding service to convert the addresses into geo locations:
python -m pygeoclients.geocoding -f sqlite:///database.db
Done, now all the addresses in “database.db” have the geo locations.
Now that we have the database sqlite:///database.db with the geo locations, we can start the Geoserver:
python -m pygeoclients.geoserver -f sqlite:///database.db -e
and create a Network Link in Google Earth pointing to the server at “http://localhost:6666“. You can change the host and port too using parameters of Geoserver utility.
You can view the addresses in Google Maps too using the default behavior of Geoserver:
python -m pygeoclients.geoserver -f sqlite:///database.db
And opening the “geoserver.html” which comes with the Pygeoclients package.
Firefox is currently not opening the map due security issues, so you can use IE for a while.