Archiv der Kategorie: Openstreetmap

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.

Axel Springer Chef beleidigt uns :(

Axel Springer Vorstandschef Mathias Döpfner hat laut einem Bericht der taz öffentlich davon geredet, dass die sogenannte Gratiskultur im Internet die Pressefreiheit bedrohen würde. Was für ein unglaublicher Bockmist! Der Originaltext der Rede würde mich dann doch mal interessieren.

Ehrlich gesagt erwarte ich von diesem Verlag ja ohnehin nicht sehr viel, aber diese Aussage halte ich schlichtweg eine Beleidigung all derer die sich im Umfeld freier Internetprojekte engagieren. Sei es nun bei Openstreetmap, bei der Wikipedia oder im FOSS Umfeld.

Wenn die Gratiskultur so schlimm ist Herr Döpfner, warum setzen Sie denn dann auf ihren Servern freie Software ein. Da sollten Sie sich dann konsequenterweise auch widersetzen!

Überhaupt dieser Begriff: „Gratiskultur“

Offensichtlich soll suggeriert werden dass hier unlauterer Wettbewerb betrieben wird indem man etwas das eigentlich Geld kosten würde kostenlos hergibt. Das Gegenteil ist der Fall. Durch croudsourcing Effekte und weltweite Zusammenarbeit entstehen Dinge kostenlos die ohne die Hilfe des Internets eben nur durch den Einsatz von Geld möglich waren. Das kann man mögen oder nicht, unlauterer Wettbewerb ist es jedenfalls nicht.

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!

Die deutsche Wikipedia hat offensichtlich wirklich ein Problem :(

Da unterhält man sich ganz normal mit anderen Geeks und amüsiert sich über das xkcd Special zur Schließung von GeoCities. Webseiten, wie sie die alten Säcke unter uns alle noch erlebt haben. Soweit so lustig.

Nun schlägt man bei Wikipedia nach und stellt fest, dass da nur ein Teil der Realität beschreiben wird. Die Beschreibung darüber, dass diese Webseiten typischerweise ein wie soll man sagen „ganz spezielles“ Aussehen hatten wurde schlichtweg als irrelevant gelöscht.

Das zu den Hochzeiten von GeoCities oft verwendete, eigenwillige Seitendesign – geprägt von animierten GIF-Bildern, Frames, blinkenden Hintergrundbildern, dudelnder Musik sowie „Under Construction“-Schildern – kann im Firefox-Browser durch ein Plugin simuliert werden.

Nun kann man das sicher besser formulieren, aber die zugrunde liegende Idee, dass gar keine Information besser ist als schlecht formulierte Information ist schlichtweg nicht akzeptabel.

In diesem Sinne, tun wir alles dafür, dass Openstreetmap niemals so enden muss! Ja Leute, eine Straße mit halbwegs richtigem Verlauf ist besser als gar keine Straße.

Problems in Wikipedia that Openstreetmap does not have

Currently there are ongoing discussions in the german arm of the wikipedia about the relevance of certain articles. Some people think they should be deleted because they are not relevant enough to be mentioned in an encyclopedia.

While Openstreetmap has different and arguably harder to solve problems in other areas, we fortunately do not have them in this particular case.

As a matter of fact, we simply don’t even try to rate something as relevant.
If you want to put an object into our database, because it is relevant for you, then you are welcome to do so. The now infamous discussion on the german mailinglist about dog-excrement-bags comes to mind.

The only thing where I could imagine a simular discussion is one about particular objects to be rendered in the standard map style or not.

There is only one reason for objects to be deleted from our database. They are nonexistent on a particular place, ever were or ever will.

If they are non-existant anymore (e.g. stuff like disused railways) they have to be marked as such. Pretty black and white stuff as you can see.

„Edit in JOSM“ Greasemonkey script for Openstreetmap Objects

Thinking about customization of the Openstreetmap Website in addition to my load current map view into josmbookmarklet I came across Greasemonkey which is a Firefox add-on that allows users to install scripts that make on-the-fly changes to HTML web page content.

This comes very handy if one uses JOSM for Editing Openstreetmap stuff instead of the online editor Potlatch. As JOSM allows to be remote-controlled by means of HTTP commands it is now possible using my greasemonkey script to load OSM objects (nodes,ways and relations) into a running Editor while browsing them with the OSM Data Layer.

Currently edit links are added to OSM browse-URLs of the following form:

  • http://www.openstreetmap.org/browse/node/<node-id>
  • http://www.openstreetmap.org/browse/way/<way-id>
  • http://www.openstreetmap.org/browse/relation/<relation-id>

OSM and Greasemonkey

Feel free to contact me if this should be added for other URLs on the Openstreetmap Website as well.