South Kensington Mapping Party Animation
Every two weeks or-so, the London OpenStreetMap group comes together for a mapping party. The main idea is to go to an area of London to improve the map there. Sometimes that's adding streets, but as most of those are now completed, time is spend on buildings, address information and points-of-interest.
As an experiment I recorded a snapshot of the map for the area (http://mapcraft.nanodesu.ru/pie/73) every hour to follow the progress of people adding new and improved data to the map. I then rendered an image of each map snapshot and put those together to create a video:
You can see the video in HD on Vimeo.
How Did He Do That?
Well, first of all, I already have a script to keep a local version of the London XML map data (as london.osm) up to date. Each hour, this script:
-
Read the old
london.osmfile and merge in changes through the OpenStreetMap replication service and write it aslondon-new.osm. -
Compare the old file and the new file and write out a changes file to
changes/diff-<timestamp>.osc. This is not needed for this to work, but I am interested in this information as well. -
Move the new file to the old file.
-
Import it into my local PostGreSQL/PostGIS instance.
In script form, that looks like:
#!/bin/bash NOW=`date +%Y%m%d-%H%M` export JAVACMD_OPTIONS="$JAVACMD_OPTIONS -Djava.net.preferIPv4Stack=true" ../osmosis-0.39/bin/osmosis --rri --simc --rx london.osm --ac --bb left=-0.563 right=0.28 top=51.68 bottom=51.26 --wx london-new.osm ../osmosis-0.39/bin/osmosis --rx london-new.osm --rx london.osm --derive-change --write-xml-change file="changes/diff-$NOW.osc" mv london-new.osm london.osm ../try4/bin/osm2pgsql/osm2pgsql -S ../try4/bin/osm2pgsql/default.style --slim -d gis -C 2400 london.osm #-e 15 -o expiry.log
And from that I then can render maps of London quite easily:
cd /backup/osm/try4/bin/mapnik ./generate_tiles_london.py | grep -v " exists"
In order to make a snapshot of South Kensington, or at least, the area that we were going to map in, I added another task. I placed it just after the moving of the old file to the new file. This task cuts out the South Kensington area and puts it in a file south-ken/south-kensington-<timestamp>.osm:
../osmosis-0.39/bin/osmosis --rx london.osm --bb left=-0.18256 right=-0.16853 top=51.49426 bottom=51.48733 --wx south-ken/south-kensington-$NOW.osm
This generated about 100 files in the south-ken directory, where each XML file contained a snapshot of the map on each specific hour.
I then ran the following script to create a image of each of those map files:
#!/bin/bash
export MAPNIK_MAP_FILE=/backup/osm/try4/bin/mapnik/osm.xml
mkdir -p images
LAT1=-0.18256
LON1=51.48833
LAT2=-0.16853
LON2=51.49326
for i in south*osm; do
/backup/osm/try4/bin/osm2pgsql/osm2pgsql -S /backup/osm/try4/bin/osm2pgsql/default.style --slim -d gis -C 2400 $i
/backup/osm/try4/bin/mapnik/generate_image.py ${LAT1} ${LON1} ${LAT2} ${LON2}
mv image.png images/${i}-0.png
LAT1=`echo "${LAT1} + 0.000005" | bc -q`
LON1=`echo "${LON1} + 0.00001" | bc -q`
LAT2=`echo "${LAT2} - 0.00001" | bc -q`
LON2=`echo "${LON2} - 0" | bc -q`
/backup/osm/try4/bin/mapnik/generate_image.py ${LAT1} ${LON1} ${LAT2} ${LON2}
mv image.png images/${i}-1.png
LAT1=`echo "${LAT1} + 0.000005" | bc -q`
LON1=`echo "${LON1} + 0.00001" | bc -q`
LAT2=`echo "${LAT2} - 0.00001" | bc -q`
LON2=`echo "${LON2} - 0" | bc -q`
done
I had to modify the generate_image.py script from the Mapnik distribution slightly to allow the bounding box to be passed in through the command line. I also set the image width and height to 1280 by 720:
...
ll = [];
for arg in sys.argv:
ll.append(arg)
ll.pop(0);
for index, arg in enumerate(ll):
ll[index] = float(arg)
z = 15
imgx = 1280
imgy = 720
m = mapnik.Map(imgx,imgy)
...
Once all the PNG files were created, I converted them to the JPEG format and ran mencoder to generate the AVI film:
for i in *png; do convert -quality 100 $i $i.jpg; done mencoder "mf://*.jpg" -mf fps=10 -o test.avi -ovc lavc -lavcopts vcodec=msmpeg4v2:vbitrate=7200
And this video I then uploaded to Vimeo. Voilà! One OpenStreetMap mapping party progress animation!
Comments
That's cool! We need more videos like that as they can attract new contributors.
A month ago I discussed with Osmisto (a guy working on mapcraft) the idea of adding new frames to animations when someone changes the state of theirs slices on mapcraft or adds a link to a new changeset in comments. Thus you can get more different frames and the video will be more interesting to watch. Hope they find time to do this one day.
Additionally, it's possible to add some kind of api to make animation rendering easier for external renderers as your. You simply would have to do something like
wget http://mapcraft.nanodesu.ru/pie/73/state_hash
once a minute and if the result you receive is different, grab new data and render it, or just glue refreshed mapnik tiles and get a new frame.
Have you seen this project?
https://github.com/synewaves/geo_helper
Seems like it could possibly be useful in your mapping endeavors.
Life Line
Updated a waste_basket
Created 11 benches, 2 life_rings, and 3 other objects; Updated 8 benches and a waste_basket; Deleted a bench and a log; Confirmed a cafe
I walked 7.8km in 1h52m27s
Tomorrow we have elections in the UK!
Lots of local authorities, all London Councils, the Welsh Senedd, and the Scottish Parliament.
Don't forget to vote if you have the right.
I get to vote for myself again 😎.
Benches, and corrections for the QE II Gardens
Addresses on College Road
Created 2 main entrances and an entrance; Updated an entrance, a residential building, and a house building
Created an apartments building and a main entrance
I walked 9.5km in 2h21m10s
Created a waste_basket
I walked 6.6km in 1h13m23s
On my walk from Aylesbury to Princes Risborough I spotted a few new bird species. I didn't get all the best photos though!
A Common Buzzard, a Yellow Wagtail, a Greater White throat, and a Green Woodpecker.
#photography #Birds #BirdPhotogaphy #BirdsOfMastodon #nature #Buckinghamshire
Updated an alcohol shop
I walked 9.4km in 1h58m25s
Updated 2 benches
Created a bench; Updated a bench
I hiked 19.0km in 4h35m50s
I hiked 19.0km in 4h35m50s
I walked 6.8km in 1h15m36s
Updated an estate_agent office
I walked 4.1km in 55m33s
I walked 1.1km in 10m05s
My First Lapwing!
I went to the London Wetland Centre yesterday, for a day out in nature.
While hiding in a hide, this chap and a friend showed up starting to forage for grubs.
#BirdPhotography #BirdsOfMastodon #Photography #Birds #London #Nature
Created a waste_basket; Updated a cafe and a restaurant; Confirmed an estate_agent office
I walked 6.6km in 1h8m53s



Shortlink
This article has a short URL available: https://drck.me/sken-vid-8po