[Qgis-developer] OSM intergration: first public release

Martin Dobias wonder.sk at gmail.com
Sat Feb 7 17:17:50 EST 2009


Hi all,

I'm happy to introduce another piece of software from our labs! This
time it's OpenStreetMap intergration which comes in two parts:
- vector data provider - implemented in c++
- plugin - implemented in python (requires the provider for proper
functionality)

How to get it working:
- download the provider:
    http://mapserver.sk/~wonder/qgis/osm_provider-snapshot-090207.tar.gz
- copy it to source tree into directory src/providers and add the new
directory in src/providers/CMakeLists.txt
- do make and make install
- install the plugin from my sandbox repository:
    http://mapserver.sk/~wonder/qgis/plugins-sandbox.xml

Features:
- open .osm files
- download data from OSM server
- upload changes back to OSM server

OpenStreetMap data model is topological and allows assignment of
arbitrary tags to any nodes or arcs (called ways in osm). This has
several drawbacks when doing the integration.

When an .osm file is loaded, the user can select whether he wants to
load points and/or ways (they're loaded as separate layers). Only
nodes that are not assigned to any way are loaded in the point layer.
Ways represent both polylines and polygons (closed way), however
they're (not yet) recognized and handled only as lines. Not all
editing tasks can be accomplished with current set of editing tools in
QGIS, such as joining a way to another with common node or actions
that work with both nodes and ways. Probably a real topology editing
should be added (i.e. topology created from one or more vector
layers).

The next problem are the tags. They can virtually consist of any
number of key-value pairs. This makes classical approach with fixed
attributes unusable. We've decided to pack all the tags into one
attribute (in format "key1"="value1","key2=value2"), in future
releases we plan to create a simple widget that will explode the list
and bring a convenient GUI for editing of tags. This also complicates
symbolization: primary roads are defined by "highway"="primary" tag,
rivers as "waterway"="river" etc. We've added a possibility to select
what tags should be accessible directly - if you select "name" and
"highway", you will be able to apply correct symbols and optionally
also labeling with the names.

OpenStreetMap file format is XML. We've decided to cache the parsed
data in sqlite database, so further loads will be much quicker. The
cached data is put in the same directory and same name as original
file, with suffix ".db". It contains also all edits you've done in the
file. There's also upload functionality, but it's still very
experimental, so I advise you not to use it yet. Anyway there will be
a switch to new API in about two months and the plugin doesn't support
it.

Download should work fine - you can download either current extent or
some specific extent by entering coordinates. The server has limit on
total number of features to be returned and area, so make sure that
you're not trying to fetch too big extent. The server sometimes needs
quite some time to process the query, so be patient :-) It's possible
to get .osm data also from database dumps, e.g. geofabrik.de.

I would consider this as alpha release, but it should be already
usable for some basic usage.

Any testing and comments are highly welcome!

Regards
Martin


More information about the Qgis-developer mailing list