New Download: Osm2po Light Style

Inspired by the “OSM Bright Minimal” style for Tilemill, I’ve created a similar background map style for osm2po layers in QGIS trunk (uses features unavailable in 1.7.3): osm2po_light_style.qml. Together with a grey background (RGB:232,232,232) and an OSM natural layer (RGB:208,208,208 for water), the style looks like this:

example map using osm2po_light_style.qml

It’s plain and bright, so any overlay will stand out nicely. Hope you find it useful.

  1. I should be able to use this by going into a Layer’s Style properties and using Load Style, correct?

    When I do that I get an error: “Loading style file failed because:” and no actual reason. I tried it in both QGIS 1.7.3 and 1.9 on the Mac. I assume I’m doing something wrong?

    • underdark said:

      Do you have a PostGIS layer with OSM road data that has been imported using osm2po?

  2. No, I do not. I just have OSM data using the OpenStreetMap plugin. I just assumed it would work with a simple OSM layer. My bad.

    • underdark said:

      I’ve had a closer look. The style does not work for me in 1.7.3 but loads fine in 1.9 even with OSM layers from OpenStreetMap plugin. But of course the rules have to be rewritten to look correct.

    • underdark said:

      I’m working on a style for OSMplugin layers right now.

  3. pvanb said:

    Hi, just tried it out with an OSM layer imported in spatialite (using QGIS 1.9). I am getting the message “tag mismatch at line 39 column 9”. Any idea?

    • pvanb said:

      OK, tried it again, now getting the message: “Loading style file osm2po_light_style.qml failed because”.. without the actual explaination why?

      • underdark said:

        I can only reproduce this problem in 1.7.3 but 1.9 works fine.

    • underdark said:

      Sorry, this style is written for osm2po layers, that is an OSM file imported into PostGIS using osm2po tool. I’m working on a style for OSMplugin-generated layers now.

  4. rune said:

    Hi, I just started using Qgis/PostgreSQL. The style files I found sofar on the internet all have rules like: “tags like ‘%”something”%’. I can query the tags column from pgAdmin but it doesn’t show in Qgis. Also, the ‘like’ operator doesn’t work from pgAdmin on a hstore column. What am I missing? Cheers, Rune

    • underdark said:

      I don’t think QGIS can handle hstore columns. I never use them. The LIKE operator only works on text columns.

      • rune said:

        I’ve downloade a few qgis style files, all reference a column called tags, does that mean people rename the hstore tags column and add a text column named ‘tags’ which they fill with the original hstore column values?

      • underdark said:

        If you open an OSM file using Openstreetmap plugin for QGIS, the resulting layer will have an attribute called “tags”. That’s most likely the one you’ll find in most available styles. (Note: PostGIS is not used in any step of this process.)

  5. rune said:

    Phew! Finally, got it. Thanks! Thought it was all referring PostGIS layers…

  6. Tim Couwelier said:

    For the ease of matching up my data, I downloaded the OSM shapefiles for Belgium, converted them to .tab, had MapInfo save the tab-file to EPSG:31370..

    Now I can load the tab-file, it matches up nicely with any vector/raster/WMS layers already in the project.. but it looks like rubbish as only the lines are displayed. Therefor I was hoping this would help me out (despite not being purpose-written for this), but I also get the tag mismatch error at line 39 column 9…

    Would it be possible at all to adapt the .qml you made to work along with that, or should I not bother? osm2po seems to produce great results, but I’m not too familiar with running these things from commandline… (thats the ‘cmd’ command line in Windows?)

    • underdark said:

      To me, OSM Shapefiles to TAB doesn’t sound like a very straight-forward solution. Why not load the Shapefiles directly? What are you trying to gain? Just reproject the Shapefiles in QGIS. You’ll just have to adjust the rules a little.

      Yes, osm2po can be run from “cmd” command line in Windows. It requires very few steps, so it’s well worth a try.

      • Tim Couwelier said:

        I just hadn’t figured out how to convert the dataset to another CRS using QGis. Surely it could be done ‘on the fly’, but if I have the physical dataset it seemed logical to convert it to the same CRS as all the other layers are.

        As I was unaware how to do it with QGis, and we have a MapInfo license here, I figured I’d use that. MapInfo however refuses to edit .shp files, have to save them as .tab. Hence me ending up with .tab files. Using the ‘Save As’ function there, I can make it convert the data to another CRS. (i.e. EPSG:31370)

        So now I have two options:
        I either figure out a way to create a .qml file to make it look decent (seems the more unlikely option) or I go and try to do the conversion with osm2po.
        I’ll try the latter, and report back when I get desperate…

      • underdark said:

        Reprojecting datasets in QGIS is simple:

        1. Load the dataset
        2. right-click the layer in layer list and choose “Save as …”
        3. Choose a new file name and pick the target CRS
        4. Save and you’re done.

        Do you need the data routable and/or in PostGIS? Or do you just want to have a background map?

      • Tim Couwelier said:

        Thank you for the explanation.

        Routability is not the main purpose, serving as a background is. I have acces to several sources of street imagery / orthophoto’s through WMS services, but I’d also like to build a Qgis project file where I can show most datasets without internet connection. Hence a fysical download of the OSM dataset would be great, if the display options make it nice. (It would be great either way, even with internet access enabled).

        However, the styles you created for osm2po exports do not work for the tab/shp files, and I doubt they are easily adapted.. Possibly easily remade if you know what you’re doing when creating styles – which I obviously do not.

        As for the time taken to convert with osm2po: after 23hours the conversion is still running.. is that normal?
        (windows XP, dualcore intel processor 3.17 ghz, 3.48gb ram)

      • underdark said:

        If you want just a background, don’t bother with osm2po. It shouldn’t run as long as you describe anyway.
        An alternative would be the new styles osm_light_line.qml and osm_light_polygon.qml which can be used to style layers loaded directly from OSM files using Openstreetmap plugin for QGIS.

  7. Tim Couwelier said:

    So far the conversion (for austria, as done in your example) has been running for 7 hours.. No visible result, but it is still running.. is that normal? (I’ll leave pc up overnight, just in case)

  8. John said:

    Now that I’ve had a moment to sort out osm2po and give this a try, I wanted to thank you for sharing the qml file. This makes for a very nice road layer. Cheers

  9. Kurt said:

    Hello Underdark!
    could you please give some hints: I downloaded an osm-file for vienna, which I imported into spatialite with the commandline-tool spatiallite_osm_map. this spatialite-database is rendered correct with qgis 1.8 (under windows7 64bit) with default-styles: Now I rightclick on a layer and click properties and load your style-file osm2po_light.qml and click apply. for a few seconds qgis crashes.
    Could you please give me some hints, what goes wrong?
    Thank you very much!


    • Hi Kurt,
      This style only works for OSM imported into PostGIS using osm2po. Each command line tool creates a different table layout, so it’s always necessary to adjust the styles. I haven’t tried spatiallite_osm_map, so I don’t know how well it works with QGIS.

%d bloggers like this: