I have the following problem: I want to use the OSM plugin to import data from a sqlite database that contains OSM data. In the 'Export OSM topolgy to spatialite' dialog I choose the database file and the polygon geometry. Then I click the 'Exported tags' button. This shows me the list of tags together with the count of features. In my case, I select admin_level, which has 267 features. Now I press ok. After the export, I would expect that only 267 features are inserted in the added layer. But when I check the feature count of the new layer it has about 52000 tags, which is pretty much every polygon. When I had a look at the attribute table the admin_level field has the value NULL for every feature.

When I check the 'Not Null' checkbox, the new layer is empty and has no features at all, so it seems that all values are NULL in some sense. I'm not sure to what attribute the 'not null' conditions applies. If I would know, I could cross-check it in the database.

  • related/duplicate: gis.stackexchange.com/questions/73238/…
    – underdark
    Commented Sep 28, 2015 at 10:50
  • @underdark the question is far away from beeing a duplicate, because the import stumbles on some kind of bug.
    – AndreJ
    Commented Sep 28, 2015 at 12:08
  • The linked thread provides some alternative approaches which avoid the buggy/unintuitive OSM plugin.
    – underdark
    Commented Sep 28, 2015 at 13:05
  • @underdark is nobody of the devs interested or capable of improving the plugin, or merging QuickOSM into core? My similar bug report hub.qgis.org/issues/12727 also seems to raise little interest.
    – AndreJ
    Commented Sep 28, 2015 at 15:09
  • 1
    Let's see if there's a reaction to my suggestion to remove the tool from the next release: osgeo-org.1560.x6.nabble.com/…
    – underdark
    Commented Sep 28, 2015 at 15:56

2 Answers 2


The Openstreetmap import tool still seems to have some bugs. While filtering for amenity works for me, it returns no objects for me when filtering for admin_level. It might be that closed ways and relations of type boundary and multipolygon are treated differently.

A more reliable way is the QuickOSM plugin, which lets you search for the key admin_level (with no entry in the value field) on the server side.


Did you check the 'Not Null' checkbox to apply the filter? If you didn't that might explain it.

example Export OSM topology to Spatialite showing Not Null checks

You might not have spotted this... sometimes you need to resize the dialog (or scroll horizontally) to see it. Clicking on Select all selects all tags, but it doesn't check the corresponding 'is null' values, you'll need to do that manually.

Also, I find the OSM Spatialite function falls over if it finds two tags which have the same name, but differ in case (like 'FIXME' and 'Fixme'). You need to remove them by hand. (You'll get a 'duplicate field' error)

If this still doesn't work, there are other ways to get OSM data into QGIS - you might want to look at the QuickOSM plugin (if you don't need a database) and osm2pgsql to populate a postgres/postgis database.

  • 1
    The Not Null checkbox has been added with QGIS 2.10. It does seem to work, but the admin_levels are already missing in the unfiltered database. They are however present in the source datafile.
    – AndreJ
    Commented Sep 28, 2015 at 13:22
  • interesting... I agree with you on QuickOSM, I've hardly used the spatialite plugin since that came out.
    – Steven Kay
    Commented Sep 28, 2015 at 13:50

Your Answer

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

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