Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
View CCTV camera locations from OpenStreetMap in Google Earth
Python
branch: master

readme modified

latest commit 7fdd810ebc
Martijn van Exel authored
Failed to load latest commit information.
.gitignore password change
README.md readme modified
cctv.py made wsgi work, cleaned up print statements hanging around

README.md

cctv.py

This is a python script that reads all CCTV cameras from a local OpenStreetMap PostGIS database and spits them out as KML. It takes the standard BBOX=minlon,minlat,maxlon,maxlat as querystring so you can just plug it into Google Earth as a network link.

installation

You will need a local database with all CCTV cameras from OSM in the osmosis DB schema. There's a step-by-step on how to accomplish that here.

You will also need a few python modules:

  • Shapely
  • web.py
  • psycopg2

Finally, you will need a web server with WSGI support. Instructions for Apache are here. I use Ubuntu so I did it like this. You can also adapt the script to work with another python interface. The web.py documentation will tell you how.

Add something like this to your Apache config: WSGIScriptAlias /cctv /home/mvexel/www/cctv/cctv.py/ Alias /cctv/static /home/mvexel/www/cctv/static/ AddType text/html .py

<Directory /home/mvexel/www/cctv/>
    Order deny,allow
    Allow from all 
</Directory>

Put cctv.py somewhere in your web tree and navigate to yourserver/cctv/?BBOX=4.9,52.35,4.95,52.40. The result should be a KML file with some cameras - if the example bounding box is in your database.

usage

Ad a 'Network Link' in Google Earth pointing to http://yourserver/pathtocctv/

adapting for other tags

You can change the script easily to extract other features from the database. The only change necessary would be to adapt the first WHERE clause (man_made = 'surveillance') to a different key/value pair, and the name / description in the Placemark output. You would of course need to make sure that the features you want are in your local database as well. This requires adapting the how-to for the database setup to your particular needs.

Something went wrong with that request. Please try again.