Archiv der Kategorie: FOSSGIS

My subjective perception of the impact of the OSM licence change

As most of my readers will probably know Openstreetmap is in progress to change it’s licence to a less restrictive one (at least from a data users perspective). Fortunately this will likely remain the only Openstreetmap licence change in my livetime well at least the only invasive one.

Today the so called redaction bot finished its work leaving the database in a state where most of the data origins from people which approved the new licence.

The Place where I live (Karlsruhe/Germany) has been one of the places to be fully mapped at a fairly early state of the project.
And ss with the rest of Germany most of the stuff originates from crowdsourcing work.

This turned out to be a huge advantage compared to places likeSydneywhere quite a lot of data has been imported from sources which did partly not agree with the licence change and which looks quite messy now.

While Karlsruhe also looks quite bad on theredaction bot view of OSM Inspector it does not look that bad if you check the details.

The red stuff mainly originates from one mapper doing quite a lot of public transport stuff, which lost some details now here and there, but most parts of the map are still quite intact.

But after all this is mostly what I would have expected, so here comes what I did not expect at all:

Back in 2009 I mapped two long-distance cycle tracks and last sommer we mapped another one while I was cycling with Christoph.

So this evening I decided to repair these relations and based on the fact that every single one of them is roughly 150km long I expected that this would be a lot of work.

This proved to be completely wrong. I did have to fix next to nothing on any of the three relations. Only one licence change related fix in all of them!

So instead of fixing bugs caused by OSM licence change I spend my evening writing silly blog postings like this one 🙂

Handy bash function for Unix GIS people :)

The usually so called shapefiles are typically not files but a couple of them with different extensions. Thus it is not very convenient to rename them.

Fortunately a Unix Shell is a very powerful tool so here comes shpmv which is a simple bash shell function. Just put it in your .bashrc. It works fine regardless if an extension (e.g. .shp) is given or not.

function shpmv() {
  if [ $# -ne 2 ]; then
    echo "shpmv: rename shapefiles"
    echo "usage: shpmv  "
    return
  fi
  src="${1%.*}"
  tgt="${2%.*}"
  if ! [ -f $src.shp ]; then
    echo "$src.shp: file not found"   
    return  
  fi
  for f in $src.*; do
    ext="${f##*.}"      
    mv $f $tgt.$ext
  done  
}

A Mapserver backend for Tirex

When rendering maps people coming from a traditional GIS background tend to use Mapserver rather than Mapnik. I don’t know the reason for this, but it is probably just because Mapserver is quite mature and has been around for a long time while Mapnik is still relatively new.

I also did quite a few things using Mapserver in the past but mostly in the WMS and raster data area.

One thing Mapserver can do is rendering based on data values rather than just by predefined rules, which could be quite useful for river widths and the like. This was not possible in Mapnik at least not in Mapnik versions < 2.0.

Mapserver is scriptable in a couple of languages (not just Python) and this is why it has been relatively easy coding a new backend for Tirex although Perl is not quite my favourite scripting language. Of course this new backend is heavily based on the existing WMS backend.

So why did I do this? Well, last week I just stumbled upon the nice Topomap project which Max Berger is doing and unfortunately he map is limited to a very small area.

Hopefully I will be able to provide a map of this style for a couple of other areas real soon now. I’m especially interested in islands with good hiking options, the so called Wanderinseln in German.

I just commited the changes to the Openstreetmap SVN-repository in the hope that it might be useful for others as well.

BTW, Max is using TileCache which I could probably use as well. Probably someone can enlighten me about the pros and cons of Tirex vs. TileCache.

Der deutsche OSM Kartenstil, Aufzucht und Pflege

Seit einigen Monaten gibt es auf der deutschen OSM Homepage einen eigenen Kartenstil, der im Rahmen einer Bachelorarbeit an der HFT Stuttgart aus dem internationalen Stil entstanden ist. Dieser Stil versucht sich an die hierzulande in Karten üblichen Gepflogenheiten zu halten und trotzdem nicht allzuweit von der internationalen Variante abzuweichen.

Im Gegensatz zu einer Bachelorarbeit und einem Studium ist ein Kartenstil für ein solch dynamisches Projekt wie Openstreetmap aber niemals fertig.

Aus diesem Grund haben wir jetzt eine Arbeitsliste gegründet. Die Abonnenten dieser Liste möchten sich der Weiterentwicklung und Pflege dieses Kartenstils annehmen.

Insbesondere warten schon diverse Änderungen am internationalen Stil auf ihre Portierung.

Über weitere Mitstreiter, die mit der Mapnik Toolchain und Subversion umgehen können würden wir uns freuen.

Es geht bei der Liste ausdrücklich nicht um Diskussionen was man darstellen sollte und was nicht. Dafür gibt es talk-de und das Forum.

Was die Technik betrifft ist der Server leider sehr langsam und stellt derzeit auch nur Europa zur Verfügung. Das ändert sich hoffentlich bald wenn wir unseren eigenen Server bekommen.

Wenn jemand den Betreiber eines Rechenzentrums kennt der dem Openstreetmap Projekt etwas gutes tun möchte möge sich umgehend bei mir melden. Wir bräuchten etwa 3HE Platz in einem Serverschrank.

A WMS-server in about 100 lines of code…

or how to use geoimage.at and others in josm

A few weeks ago a few austrian mappers contacted me because we are now allowed to us the WMS server at http://geoimage.at/ for mapping.

Unfortunately the data is currently only available in an austrian koordinate system (EPSG:31287). With EPSG:4326 beeing unavailable this is in fact a violation of the WMS spec 🙁

This could however be easily fixed using UMN-Mapserver as WMS-proxy, but unfortunately we are not allowed to do this at wms.openstreetmap.debecause we are not permitted to set up a cascading WMS based on their rules.

Anyway, with my wms.openstreetmap.de setup already using the python wsgi-interface (apache mod_wsgi) I thought that a standalone UMN-Mapserver based WMS-server should be very easy to hack, given the fact, that all the difficult stuff is already available in python and mapscript. Well, my presumption proved to be true 🙂

So here is my standalone WMS-server written in roughly 100 lines of python code.

As far as geoimage.at is concerned, there are already other solutions at the OSM-Wiki page, but this was fun to hack and might be useful for other purposes as well. An advantage of my solution is that it is possible to use the Austrian GIS-grid file for reprojection to achieve the highest possible accuracy. For this purpose the proj4-definition for EPSG:31287 (defined in /usr/share/proj/epsg on Linux) must look like this:

<31287> +proj=lcc +lat_1=49 +lat_2=46 +lat_0=47.5 +lon_0=13.33333333333333 +x_0=400000 +y_0=400000 +ellps=bessel +units=m +nadgrids=/path/to/GIS_GRID_austria.gsb +no_defs

I would be interested in feedback on how to get this to work on Windows as well. Talking about Linux this has only been a matter of typing apt-get install python-mapscript and adjusting the proj4 definition file to use the GIS-grid.

The state of free bicycle trip planning tools

While the quality of openstreetmap has changed from unusable to what is now arguably the best map for bicycle trip planning in recent years (at least in germany) unfortunately free bicycle trip planning software has not.

The following table is probably not complete so please post your suggestions if you know about other tools.

I just tested FOSS and web based tools because commercial applications like TTQV tend to be running on windows only anyway.

So here is the current state of the tools I checked. What I would really like to see in the future is a gpsies.com like semi-automatic-routing feature but based on osm instead of google.

stand alone applications:

Software

OSM tiles

Google maps/aerial images

WMS

Garmin maps

rectified images

Automatic routing

Manual route planning

semi-automatic routing

Viking

yes

not allowed

via hack

no

no

no

yes

no

QLandkarteGT

yes

no

no

no

yes

no

yes

no

web based tools:

Software

OSM tiles

Google maps/aerial images

WMS

Garmin maps

rectified images

Automatic routing

Manual route planning

semi-automatic routing

marengo-ltd.co.uk

my hacked version

yes

no

no

no

no

yes

no

pifpafpuf.de

yes

no

no

no

no

no

yes

no

gpsies.com

yes

yes

no

no

no

Google API

yes

Google API

openrouteservice.org

yes

no

no

no

no

OSM

no

no

My current workflow ist still using about 2 or 3 of these tools because fortunately all of them are able to read/write GPX file format.

Currently I just set up a hack which will translate tile requests into WMS to allow using them in viking. This is basically the same setup (with a slightly modified mapfile) already in use at wms.openstreetmap.de and available from Openstreetmap SVN.

An example tile URL for this kind of setup would be http://wms.gegg.us/tms/DOP_RGB/12/2143/1406.png. Please note that this data has not been approved for Openstreetmap use so please do not use these tiles for mapping.

PostGIS and hstore for OSM Data

Unlike traditional GIS data, which usually uses just a couple of attributes per spacial object, openstreetmaps comes with a free tagging scheme. In traditional database design it is impossible to store this type of data in a single table thus adding the need for joins in any single SQL request.

Starting from Version 9.0 PostgreSQL will however include an extension called hstore which is available as a backport for current Versions of PostgreSQL (8.3 and 8.4) and even as a debian package.

Using this extension an additional key/value table is no longer needed.

Already back in March I commited a patch for osm2pgsl which would allow for storage of tag objects inside such a hstore column.

An hstore is basically what is known as hash (perl) or dictionary (python) in scripting languages. A datatype for storage of key value pairs – well suited for storage of OSM data tags.

Talking about python I took me quite some time to figure out how to convert a hstore result from an SQL query so here is how it works:

q="select (each(tags)).key,(each(tags)).value from ... where ..."
cur.execute(q)
rows = cur.fetchall()
hstore=dict(rows)

Back to the actual hstore issue…

In the meantime people are actually starting to use this stuff and MaZder even wrote a HOWTO document (currently in german language only) on howto set up such a database.

So here are the projects currently using hstore that I am aware of:

Tags:

The 201 Gigapixel Image :)

German Company Aerowest is providing Openstreetmap with high resolution Images.

Once again I have been doing most of the technical work which needed to be done behind the scenes. While wms.openstreetmap.de has been up and running for a few weeks now I still had to do some stuff to get the things going.

First of all I converted the mapscript from the older mod_python to the state of the art mod_wsgi. Furthermore the script has been extended to allow for individual copyright-watermarks based on mapfile entries. Tiles generated for Potlatch are now cached using the Apache Module mod_disk_cache.

The aerial image itself came as a raster image of 201 Gigapixels in the very good (in terms of image compression) but proprietary ECW-format. For legal reasons we are now using another format for actually serving the image (eating a huge 675 Gigabytes of disk-space) because the proprietary license of libecwj2 does not state very clearly if we are allowed to use it in our setup or not.

Announcing wms.openstreetmap.de

A few weeks ago I started to set up http://wms.openstreetmap.de to serve aerial images donated by various sources for Openstreetmap use. Currently the system holds data from german communities Lauf an der Pegnitz and Neunkirchen am Sand (thank you very much for donating the data!). It is designed to be extensible with additional data in an easy way. If anybody in the Openstreetmap community is looking for such a service just drop me a line.

The system is powered by Mapservers mapscript written in Python to allow for convenient URLs in JOSM’s WMS plugin. In addition to this I just added support for the Online Openstreetmap Editor Potlatch while learning how to use custom tile-servers with it by chance. This is done by converting tilenames in z/x/y format to the bounding boxes needed for WMS. An Apache mod_rewrite rule provides a virtual tile-URL in the syntax needed by Potlatch and allows for direct edit-links of the available areas now provided on http://wms.openstreetmap.de

The script itself will be released as free software and added to Openstreetmap SVN.

Finally I need to mention that the system is also running on one of the Servers sponsored by german webhosting company STRATO AG.

IPv6 bei Strato: Der Kenner wundert sich!

Heute lese ich bei Heise, dass Strato ab sofort IPV6 und VLAN anbietet. Nun hat die deutsche Openstreetmap Community ja freundlicherweise 3 Server von dieser Firma gesponsort bekommen und ich dachte mir dass man da ja mal IPv6 aktivieren könnte!

Über die Realisierung ist man man dann jedoch, wenn man IPv6 schon länger kennt etwas verwundert. Während die Konfiguration der IPv4 Adresse automatisch per DHCP erfolgt muss man die IPv6 Adresse manuell einstellen und das obwohl bei IPv6 im Gegensatz zu IPv4 die automatische Konfiguration eigentlich das übliche Verfahren ist.

Ich habe hier zu Hause auf meinem Desktoprechner beispielsweise keine IPv6 Adresse explizit eingestellt. Stattdessen bekomme ich diese von meinem Router per radvd automatisch anhand der MAC-Adresse zugewiesen.

Es ist schon erstaunlich, dass das bei Strato nicht so funktioniert. Trotzdem natürlich kein Vergleich zu den Mitbewerbern bei denen man IPv6 nur zum völlig absurden Aufpreis von 29 €/Monat (Hetzner) oder kostenlos per Tunnel (1&1) bekommt.

Langer Rede kurzer Sinn, die drei FOSSGIS Rechner bei Strato sind also ab sofort auch per IPv6 erreichbar!