changewithin is a simple script that pulls daily changes
from OpenStreetMap with requests
, parses them with lxml
, finds the ones that are inside
of a GeoJSON shape, sorts out the ones that are buildings, and emails a set of users
with mailgun.
Files edited for deployment by City of Boston:
-
users.json. This is simply a list of email addresses to which the script will send the reports, in JSON format. The email templates for both html and text can be edited within script. The report itself contains a summary of changes, then lists each relevant changeset, its ID, and further details. These include the user who made the change and their comment, individual element IDs for building footprint and address changes that link to their history, and a map thumbnail that is centered on the location where the edits were made.
-
boston.geojson GeoJSON file of city limits
-
changewithin.py Added MultiPolygon support to script
Requires wget
for Mac use homebrew:
brew install wget
for Ubuntu/Linux
apt-get install wget
Requires Python with lxml, requests, pystache, pil, modestmaps
mkvirtualenv --no-site-packages changewithin
pip install -r requirements.txt
python changewithin.py
Assuming the above installation, edit your cron table (crontab -e
) to run the script once a day at 7:00am.
0 7 * * * ~/path/to/changewithin/bin/python ~/path/to/changewithin/changewithin.py