Light Styles for OSM Layers in QGIS

The default look of OSM plugin layers is not well-suited for background map usage. It’s too colorful and any overlay just gets lost:

Default look of OSM plugin layers

A good background map has enough detail to allow the reader to orient himself but at the same time must not overwhelm the overlays. For data to be overlaid onto OSM plugin layers, a more neutral style is needed. And this is my first attempt at such a style, containing rules for the polygon and line layers (no point style yet):

Light OSM style applied to polygon and line layer

As before, these styles can be downloaded from my “QGIS-resources” Github repository. They are called osm_light_line.qml and osm_light_polygon.qml and require QGIS trunk. They do not work in QGIS 1.7.x because they contain some new features that are only available in the developer version (aka trunk).

47 comments
  1. Thanks, How to make a map Light OSM style to load in qgis for my place (Mkassar city).

    syafrauf

    • underdark said:

      First download the data for your city using OSM plugin, then apply the styles.

  2. Hi,
    I add no success on import using QGIS 4e4603f (from osgeo4w). I select the osm line layer. I set it to use new symbology and to use rules based. So I click on load style, select the qml for light line and error :
    tag mismatch at line 39 column 9
    Same problem (diffrent message) on polygon

    Bests regards

    • underdark said:

      When loading the OSM file, did you check all check boxes in “Add columns for tags” section?

      • kagou said:

        In fact I used the direct download link. I’d never used the + icon. Now with your help i’v discovered it. I will try this afternoon at work. Thanks

      • Tim Couwelier said:

        Same problem here, same error.
        Imported the .osm file, checked all boxed (as you suggested here).. the layers themselves load. Right click them, go to properties, select the .qml file… and get the error message.

        I’ve tried loading the .qml from both the ‘new symbology’ and the standard functions, to no avail, error message is the same.
        Both checking or unchecking the checkbox in the OSM import to use a non-standard renderer lead to same results.

        Also, when looking at the data in attribute table, I get 12 colums of data. You seem to be having for 0 to 14 (so 15 columns?). Line 39 column 9 is the one refering tot “labelling/dataDefinedProperty0”..

        In case it helps, I get:
        timestamp/user/tags/name/place/highway/landuse/waterway/railway/amenity/tourism/leaning as column, for points, lines and polygons alike.

        The above is tested with QGis 1.9.90 cbef41c, with the .osm files downloaded from Geofabrik for West-Flanders (Belgium)

      • underdark said:

        Hi Tim,
        Thanks for helping me to debug this problem.
        I got the .osm file for Belgium and tested it on my Win7 with current QGIS trunk. It works fine, here is a screenshot.
        I also get the same columns you’ve listed above. Right now, I’m a little stuck since I cannot reproduce the problem.
        I’ll keep looking.

      • Tim Couwelier said:

        That’s odd. I’m on a Windows XP build here.

        I’ll remove all previous QGis installations here and try getting the latest version trunk, check if that helps.
        Grass6.4.2RC3 was the latest here, if that’s relevant?

      • underdark said:

        I wonder if it could be an encoding problem caused by different system locals.

      • Tim Couwelier said:

        If you’ll explain where I can look those up, I’ll post mine here.

        And ugh, osgeo4w installer keeps stopping its download at zlib-1.2.3-1.tar.bz2, on both the installers listed…No luck doing my testing as mentioned before due to that. (both when downloading the files for a direct install or to download without install).

        I’ll try the download from another PC I guess.

      • Ok, after test , under Windows XP i always have this problem (using now 9A9AB73)

      • underdark said:

        I don’t have XP. But I did a clean install on a new Win7 machine today (German locale) and everything worked fine. No errors still.

      • Tim Couwelier said:

        Tried change the locale settings.. standard I had no succes, overriding it with US no succes either. What locale are you using?

    • Tim Couwelier said:

      Same problem still, same version as Patrice is using (9a9ab73).
      On startup I do get error messages for loading the plugins Googlelayers, Contour and Profiletools, no idea if they are related or if Patrice gets those as well.

      Contrary to before however the default style IS loading this time, whereas it would only show me the lines before (in the QGis settings I apparantely hadn’t checked the option for displaying new symbology) (Extra/Options/Rendering)

      No help there solving the error message though, still line 39 column 9.
      Have no idea how the .qml files are built, but I have a feeling the ‘labelling/dataDefinedProperty0’ part is causing the trouble.

      I will try and see if there’s other .qml’s I can find with that parameter that do work for me.

    • I just went to test under Windows 7 and I have the same problems. Could you be very precise on using your script. May be a screen video capture ?..

      • Ok so I don’t understand why it’s not working here :( I do all as you.

      • You have many strange text information on your .qml… There are links for javascript files, links for a github. I suspect that files that we download are not clean to use as style in qgis…

      • Yes ! Found the problem.

        DO NOT download directly your files on github using right click on each files ! Seems to work but not !

        Click on one file, and click on “Download” up right. You download an archive with 2 reps, a README an styles files are now good !

      • underdark said:

        Great! I’m glad we figured this out :)

    • Tim Couwelier said:

      Doing as Patrice described solved the line 39 column 9 tag mismatch error for me too.
      Now to play around with it :)

  3. Thanks, If I want edit OSM shapefile uses the default QGIS editing tools,can I load google hibrid as refference background (make OSM shapefile to transparence).

    syafrauf

  4. Tim said:

    Hi Anita

    I just passed your article on to someone who is using QGIS 1.7.4 on OSX. Then they try to load the qml, they get a non explanatory email message. Can you verify if your qml is intended to work against master only or also 1.7.4?

    Regards

    Tim

    • underdark said:

      Hi Tim,
      It’s master only. I wasn’t aware that qml files of master and 1.7.x are incompatible when I started designing them :|

      • Tim said:

        Thanks Anita – sorry my question had so many typos / wrong words…too much mutlitasking eh?

        Regards

        Tim

  5. Hi,

    Thank you for the great work. Unfortunately nothing is working to me.
    The GoogleMap style for OSM layers do not work, once I load them all the roads disappear.
    Concerning instead this latest version called light styles, I get the same error as others “tag mismatch at line 39 column 9”.
    I hope that you can fix all your work so that I also can use it, thank you so much for sharing this!

    I use ubuntu 11.10 (with unity 3d) and QGIS 1.9.90 latest version directly from the debian repo.

    Regards,
    Matteo

    • underdark said:

      Which GoogleMaps style does not work. There is one which requires an osm2po layer (that’s not the same as loading an OSM file with Openstreetmap plugin). The other requires a specific view. If all roads vanish, it’s most likely a problem that none of the rules evaluate as true.
      I’m still working on reproducing the error in light style. No luck so far.
      Regards

  6. Miguel Sevilla-Callejo said:

    Hello to all. I tried first with QGIS 1.7.4 and it doesn’t work. After read the comments I decided to upgrade to master (1.9.90-Alpha / rev. ad955e2 ) and, then, it work for me. Thanks Anita for the styles. Unfortunately in Zaragoza (Spain) we have to improve OSM with buildings and land-use to have better results.

  7. WB said:

    Is it possible to get a WindowsXP QGIS version of the 1.9.90-Aplha / Rev version? Because QGIS 1.7.4 with the ZIP download doesn’t work for me. This is the error I get (nothting is there beyond ” failed because:”) :

    Loading style file C:/Documents and Settings/Administrator/Desktop/Openstreetmap/QGIS/anitagraser/styles/osm_light_polygon.qml failed because:

    • underdark said:

      Yes, installing 1.9.90 is possible using OSGeo4W installer. The link is available on the QGIS download page.

  8. Route Maker said:

    Hi Anita again,
    I translated Greece.osm to PostgreSQL table with osm2po. I have database “greece” and roads table ‘’road”. In QGIS I select from main menu Layer/Add PostGIS layer/ and then I connect to database “greece” and select “road” table. In QGIS I can only see lines.
    What should I do to see map like your second picture. I still don’t understand how to apply this style? And what does it mean OSM style, is it only for OSM map or not? I am sorry for this question but I am beginner …

  9. Route Maker said:

    One more question … I have some other maps (not OSM), do I need some special style for that maps or I can use some existing styles? Sorry, but it is not so clear to me about styles …

    • underdark said:

      It is possible to adjust this style by rewriting the rules to fit another road dataset.

      • Route Maker said:

        Thank you, I will try …

  10. Route Maker said:

    Thank you for new link, now I downloaded these files. But when I try to load style in QGIS I got error: “Style cannot be loaded because:” and that is all … Should I put this style in some special directory?

    • underdark said:

      If you get that error, it means you are using QGIS 1.7, but the styles require current QGIS developer version as has been discussed in previous comments.

      • Route Maker said:

        OMG, I just downloaded 1.7 for your pgRouting Layer …
        Does it means that I need 1.9.90-Alpha ?

      • underdark said:

        If you want to use the style, yes. As mentioned in another comment, I wasn’t aware of the incompatibility between 1.7 and 1.9.90 when I created the styles. But of course you can write/adjust them yourself too.

  11. Route Maker said:

    Thank you Anita, you did a great job …
    But I was hoping to find simple solution to see my route for test purpose. Now, it takes much more time to set QGIS right version and style then to make route which is my primary job. I will try this one day …

    • underdark said:

      It’s really not necessary for testing purposes to use any styles I think. Why not just use pgRouting Layer and leave the road layer at default style for now.

      • Route Maker said:

        I don’t have any default style. My roads in QGIs are only thin lines in one color.

  12. stefz said:

    Thanks a lot. Great job I just found (as a pure newbie with QGIS…). You saved me after hours looking for a good qml to work with.