I'm trying to import a shapefile into a spatialite database via drag & drop. This works fine while the data is in a geographic coordinate system, but I need to do some measurements and therefore need projected data. However, I get an error when I try to import the projected data. The error message isn't very helpful either. How can I solve this?

enter image description here

I also tried the DB manager and geht this error:

enter image description here

Spatialite-GUI: no "Map Preview" option

enter image description here

EPSG 54004:

enter image description here

EPSG 3857:

enter image description here

  • 1
    Have you tried to import this data via spatialite-gui or QGIS DB manager with proper CRS? Do you have any errors? Aug 17 '16 at 21:45
  • with the DB manager I get another error message (added screenshot above), with the GUI I could import the data but when I want to display it in QGIS I just see a blank canvas (I'm probably doing something wrong here, I'm not too familiar with spatialite) Aug 18 '16 at 7:22
  • please add more info about your shapefile (geometry type, source coordinate system, layer extent). Can you add and plot this shp directly in QGIS? Have checked it for topology errors or/and import other files? Aug 18 '16 at 21:29
  • I tried with different geometry types (point and polygon), the coordinate system is World Mercator (EPSG: 54004), layer extent (of the polygon dataset): xMin,yMin -20037508.34,-8246435.55 : xMax,yMax 20037508.34,18386391.71 I can add the shapefiles as such to QGIS without a problem! I don't think it can be the topology as the point shapefile didn't work either. Aug 23 '16 at 13:15
  • I just tried it with data in other projected coordinate systems, the problem only occurs for coordinate systems like World Mercator, Miller World, Mollweide etc. It does not occur for regional coordinate systems. However, I need to present a world map, what am I supposed to do? Aug 23 '16 at 13:41

I would also suggest to import into the spatialite DB using spatialite-gui. After the shapefile is imported you can see a quick view of the layer directly within ppatialite-gui by right-click on the "geometry" column and choose "Map preview". This will show you if the layer is correctly imported, even before you switch back to QGIS. Be sure to select the correct projection in the :Load Shapefile" window.

  • The import into spatialite via the gui works without errors, but when I want to add the data to QGIS everything is blank. Also I can't fing the "Map Preview", the only options I see when right clicking the geometry column are "Refresh", "Check geometries" and "Get SRID". Aug 23 '16 at 13:09
  • Wait a moment with QGIS. In spatialite-gui, if you right-click on the table (layer) and choose "Edit table rows" what do you get in the data pane on the right? Again, in Spatialite-gui, expand the layer, and do a right click on the geometry. There you should be able to choose Map preview.
    – Micha
    Aug 23 '16 at 18:23
  • I added a screenshot of the spatialite gui in the post above! Aug 24 '16 at 8:44
  • Have you set the SRID inside the spatialite GUI? For World Mercator, try EPSG:3857.
    – AndreJ
    Aug 24 '16 at 14:56
  • AFAIK there's no EPSG:54004. Please drop the countries_p table, then reimport, as AndreJ suggests, with EPSG:3857. Also be sure you know in advance whether the original data is polygon or point, and import as the correct geometry.
    – Micha
    Aug 25 '16 at 11:05

EPSG 54004 seemed to be the source of the problem, EPSG 3857 worked fine for dragging and dropping the shapefile in the spatialite database, it also worked within the DB manager!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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