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
I've finished reading This Way Up. It's about maps, that went wrong.
It's a good read, but htyerr were several chapters that were written in a novel way (as a video transcript, a series of letters), and I found distracting from the a tail content. It'll have worked better in a produced video.
No mention of @openstreetmap though :-(
Updated a bench
Created a tree; Updated 3 humps and a waste_basket
The Early Cormorant Catches the Eel
Sorry, not the best photo! But I caught this Cormorant catching this large eel when looking for Bank Swallows, right next to Eel Pie Island in the Thames.
#Birds #BirdPhotography #BirdsOfMastodon #Photography #London
Updated an estate_agent office
I went to my nieces' birthday party yesterday.
The theme was pink, and that included all the food, mostly died with beet root.
Shock and horror this morning when doing number two. Not only was my turd dark red, it was also glittering at me. Apparently the carrot cake had edible glitter...
So now I know what's worse than glitter.
😂 ✨ 💩 🟣Long-Tailed Tit on a Branch with Lichen
I've been spending some time in random London local nature reserves.
Sitting and listening, and in fifteen minutes you spot countless species.
This one was in Ham Lands Local Nature Reserve near Teddington.
#london #BirdPhotogaphy #BirdsOfMastodon #Birds #LichenSubscribe
A Colourful Mandarin
In The Long Water in Kensington Palace Gardens, London.
Created 7 benches
Created 2 benches
Created a bench
I walked 7.3km in 2h28m39s
Added a note about a duplicate Papersmiths
I walked 4.1km in 49m02s
Fixed website
fix typo
Updated a bench
I walked 1.6km in 20m26s
I walked 1.1km in 11m49s
The Yellow Eye
A blue heron's head, with its very yellow stare-y eye.
#BirdPhotography #Photography #BirdsOfFediverse #BirdsOfMastodon #London
My little Lego box is telling me it really is quite warm outside.
Created a bicycle_parking and a crossing
I walked 3.3km in 41m56s








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