I'm trying to use existing OSM style file like those of AsgerPetersen (https://github.com/3liz/osm-in-qgis/tree/master/styles/openstreetmap/geofabrik) or anitagraser's (https://github.com/anitagraser/QGIS-resources/tree/master/qgis2/osm_spatialite) but always got an error = *

" unexpected character à la ligne 31 colonne 72 "

I'm on mac osX QGIS 2.2

  • 1
    Sounds like an encoding issue on your system and a specific file. It occures at applying which of the stylefiles?
    – Mapper
    Jun 7, 2014 at 8:52
  • 1
    Thnak you for the answer. To be short: it happens to each one ...
    – Arthur
    Jun 16, 2014 at 12:31
  • How could I know witch encoding is used by the style file?
    – Arthur
    Jun 16, 2014 at 12:37

2 Answers 2


This was also discussed in the comments to A guide to GoogleMaps-like maps with OSM in QGIS

Are you sure that you downloaded the .qml files correctly from github? I get that error if I try to load the .html file from https://github.com/anitagraser/QGIS-resources/blob/master/qgis2/osm_spatialite/osm_spatialite_googlemaps_lines.qml rather than the raw .qml https://raw.githubusercontent.com/anitagraser/QGIS-resources/master/qgis2/osm_spatialite/osm_spatialite_googlemaps_lines.qml


I may be wrong but I think this error may be because you art trying to work with an xml data file which is incomplete. I had a similar error (although in English). The issue was that my OSM data wasn't downloaded properly. If you open the data file in a text editor you may be able to see that the content ends abruptly rather than being complete. Hope this is helpful - sorry for the lack of clarity, I'm working from memory of what I think happened to me a few weeks ago.

  • Hi, Actually, I'm not working with any xml file. Although if you speak about the qml files from Github, I've already opened them in texteditor and see they have some non needed text at the beginning. But when trying to save them in xml then changing extension in qml I can't open it in Qgis ...
    – Arthur
    Jun 17, 2014 at 7:49
  • Actually I was thinking you might be using Openstreetmap data downloaded in an xml format wiki.openstreetmap.org/wiki/OSM_XML which is where I think I had problems. Reading your question again I may have misunderstood - is your OSM data as SHP files from Geofabrik? Please feel free to ignore this if you already know that the OSM data you are working with displays properly (before styling it). Jun 19, 2014 at 20:31
  • I'am working with .shp files from Geofabrick yes. I don't understand what you mean in your last sentence: "Please feel free to ignore this if you already know that the OSM data you are working with displays properly (before styling it)."
    – Arthur
    Jun 23, 2014 at 10:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.