Mittsommer in Schweden
Am vergangenen Wochenende war Mittsommer hier in Schweden. Anders als in Deutschland hat Mittsommer (schwed. Midsommar) hier Feiertagscharakter, was man spätestens daran merkt, daß Geschäfte, die eigentlich immer offen haben*, plötzlich erst später aufmachen.
Nun, wir haben die Gelegenheit genutzt, eine kleine Nachtwanderung auf den Hausberg Billingen zu machen.
Die drei folgenden Bilder zeigen den gleichen See (fragt mich nicht nach dem Namen), wobei die dunklen von Norden nach Süden und das helle Bild von Süden nach Norden jeweils gegen Mitternacht aufgenommen wurden. Der Nebel deutet an, daß es gar nicht trocken-sommerlich warm war…
Von besagtem Billingen aus hat man auch eine schöne Sicht auf die Stadt Skövde (wobei es auf dem Bild etwas heller aussieht, als es wirklich war):
Mit diesen Bildern gehe ich in den Sommerurlaub und wünsche allen ein schönes Mittsommerfest!
* Anders als in Deutschland üblich verkaufen Lebensmittelgeschäfte, die sonntags offen haben, normalerweise kein Benzin.
Drawing GPS Traces on Map Tiles from OpenStreetMap
Ever wondered how to show your GPS traces to non-techie friends? This article may be the answer to your question.
Last weekend, I had the problem of visualizing a GPS trace to show a friend where I had been. Sending a .gpx file may be an answer to this question, but for someone not related to this whole map-making voodoo this file won’t help.
Well, given that a world map rendered as .png files is freely available from the OpenStreetMap project, isn’t there a way to draw GPS tracks on those images? The OpenStreetMap project allows you to download map tiles of size 256×256 pixel. To access those tiles (and to know which tile), you have to calculate the tile number depending on latitute, longitude, and zoom level. Using the coordinates from a .gpx file, all neccessary tiles can be retrieved and glued together to your own map. On this map, the tour as described by the .gpx file can be drawn.
Script
To simplify this process, I wrote a Perl script, which takes one or several .gpx files as input and generates a PNG image containing the map tiles and the GPS tracks as colored lines.
The script is available for download, released under the GPL version 3 or any later version.
The script’s usage is quite simle. Run
to generate a file called map.png which contains the track in a PNG file.
The output can be controlled by setting command line options:
-o FILENAME: Output filename of the image.
-z N: Zoom level, where N is a number between 1 (world) and 16 (most details) or “auto” (automatically determines a reasonable zoom level, default).
More command line options are shown when running the script with -h.
If you are familiar with Perl, you can change even more default settings (e.g. colors) at the start of the Perl script.
Perl hackers are welcome to send bug reports (I’m sure there are bugs) and suggestions for improvements.
Example
Below example visualizes two GPS tracks from Skara region (randomly selected) using the script’s default settings:
Using custom settings such as done by running
results in this image:
For reference, see how the original map looks like.
Update 20090623 I uploaded a new version which is more configurable and draws waypoints as small circles on the map.
Update 20090709 The new version improves the projection of coordinates on tile images (suggested by Pedja); tile sources can be selected via command line.
Angekommen in Schweden
Nach etwas längerer Blog-Abstinenz wollte ich mich mal wieder melden, zumal Günther den neuen Planet UNIX-AG angekündigt hat.
Nachdem ich meine Verteidigung hinter mir hatte, habe ich mich dann doch ernsthaft mit der Jobsuche befasst. Inzwischen bin ich hier in Skövde im sonnigen Südschweden gelandet. An der örtlichen Universität bin ich (vorläufig) als Gastlehrer angestellt und werde in den nächsten Monaten verschiedene Informatikkurse (mit-)betreuen.
Das Wetter hier erfüllt alle Erwartungen und Vorurteile der Deutschen, wie schon am ersten Tag ein Blick aus dem (Büro)Fenster zeigte:

Auch wenn das Wetter zwischen Tauen, Gefrieren mit Glatteis und Neuschnee schwankt, sieht es zwischendurch doch immer ganz nett aus:
Enlarge Fullscreen Programs in Wine
Back in the good old days, PC games used a resolution of 320×200, 640×480, or maybe 800×600 for the game play. This was even true for Windows games. Then it was common to have a 15″ CRT monitor which could display a large number of different resolutions with only little loss in quality.
Today, we have nice and shiny LCD displays, which are perfect for common office tasks. But with a horizontal resolution of e.g. 1600 pixel, you have a problem when playing these old games. Basically, you have two options when running your games with Wine: Scale the game’s small resolution to your display’s physical resolution (which looks ugly depending on the interpolation and the display’s aspect ration, e.g. widescreen displays) or run the game in a small window which makes a game designed for fullscreen displaying as large as your palm. No fun playing games here…
As far as I know, there is no possibility to scale a Windows program in Wine to make it more readable for high-resolution displays. However, I was able to create an ugly hack which allows us to “zoom” into these programs. The basic idea is to set up a dedicated X server with a fixed resolution for the Windows program and use a VNC connection (which can scale images) to get an enlarged view on this program.
If you like to follow the examples below, you will need to have the following programs installed:
- Xephyr, which is part of your X server installation
- Wine, installed and configured to run programs fullscreen (deselect “Emulate a virtual desktop” in winecfg)
- x11vnc
- RealVNC, TightVNC, or any other VNC client (server component not required here)
Most distributions such as Gentoo Linux provide packages for above programs.
Getting started
To run Windows programs within a scaled VNC session, the following four easy steps are neccessary. You can start each program in the background by appending an ampersand (&) or opening a terminal (simplifies debugging if something doesn’t work).
- Start Xephyr to initiate a nested X server session. Set the resolution to match the requirements of your game (here, it is set to 640×480). I observed that some programs crash if the GLX extension is activated, so I disabled it here. The display number is set to 5 (arbitrarily).
Xephyr -once -screen 640x480 -extension GLX :5 - Start Wine and your Windows program. Take care to use the display provided by the new Xephyr instance.
DISPLAY=:5 wine path/to/your/windows/program - Start the VNC server which attachs to Xephyr’s display. Only connections from localhost will be accepted (for security purposes) and the scaling factor will be set to 2 (change to other factor to match your requirements). Option “:nb” speeds up the scaling.
x11vnc -localhost -scale 2:nb -display :5 - Start the VNC client which connects to the server (the following example is for RealVNC).
vncviewer -FullColor -ZlibLevel 0 localhost
Well, this is rather cumbersome, but it works
Shell script
Here is a shell script which performs above operations:
#!/bin/sh
XEPHYR_BIN=/usr/bin/Xephyr
WINE_BIN=/usr/bin/wine
WINPROG_BIN=/path/to/windows/program.exe
X11VNC_BIN=/usr/bin/x11vnc
VNCVIEWER_BIN=/usr/bin/vncviewer
XDISPLAY=:5
# start Xephyr in background
# note: *with* GLX extension wine crashs sometimes
${XEPHYR_BIN} -once -screen 640x480 -extension GLX ${XDISPLAY} &
XEPHYR_PID=$!
sleep 2
# start wine
DISPLAY=${XDISPLAY} ${WINE_BIN} "${WINPROG_BIN}" &
WINE_PID=$!
# start VNC server
${X11VNC_BIN} -localhost -scale 2:nb -display :5 &
VNCSERVER_PID=$!
sleep 3
# RealVNC
## ${VNCVIEWER_BIN} -FullColor -ZlibLevel 0 localhost &
# TightVNC
${VNCVIEWER_BIN} -compresslevel 0 -nojpeg localhost &
# keep for both RealVNC and TightVNC
VNCVIEWER_PID=$!
wait ${WINE_PID}
sleep 1
kill ${VNCVIEWER_PID}
sleep 1
kill ${VNCSERVER_PID}
sleep 1
kill ${XEPHYR_PID}
Kindsbach mapped for OSM
During the last few month I mapped Kindsbach (small village near Kaiserslautern, Germany) for the OpenStreetMap project. Before I started, the map contained only the railway line (without station) and the country road passing through the village. Within three weekends totaling into about 8 hours of walking or cycling, I mapped basically all residential roads in Kindsbach.
Creating a map for OSM consists of two steps. First, real-world data must be collected. This data consists of both GPS coordinates and additional information such as street names, important traffic attributes (one-ways, speed limits, …), or other useful information (play grounds, parking lots, restaurants, …). Second, this data gets imported into OSM e.g. using JOSM. This (potentially time consuming) step is required to smooth the scattered GPS points and to integrate the additional information.
The additional information may be collected by making photos of relevant objects (such as traffic signs), as based on the photo’s EXIF time stamp the actual position can be determined later. Alternatively, voice recorders may be used to memorize street names. My favorite method is paper&pen. Below is a scan of a drawing of the south-west part of Kindsbach, which I created while walking through the streets:
After a few days, changes and additions made in JOSM were rendered on the OpenStreetMap website. Eventually, the map of Kindsbach looked as follows:
Mapping streets for OSM is a nice hobby. Besides of supporting the project, it is a good reason to switch off your computer and to get some fresh air…












