I have some Ordnance Survey Address Base data files which have a .gml extension. I have imported them to GGIS as vector layers along with some mapping data but would like to explore them with PostgreSQL. I see that QGIS comes with SpatiaLite installed. Can I import the gml files into SpatiaLite or for that matter PostgreSQL?

I suspect the format and content of my question says more about what I don't know so any comments or even answers would be appreciated.


Yes. If you right click the layer in QGIS and select Save As the Save As dialog will give you a ton of formats you can save the file to, one of those is Spatialite. You can also use ogr2ogr to convert the file to pretty much any format you want.


| improve this answer | |
  • Thank you for that. Having just installed PostgreSQL as well can you tell me which of those formats best suits that please? – nigellaw Jan 12 '13 at 21:48
  • Personally I like shapefile, then I can use the shp2pgsql-gui tool to upload the data in to a PostGIS database. One caveat, if you have long field names they will be truncated when you convert to shapefile due to DBF's limitations. You can change their names back on Postgres with ALTER statements. – HeyOverThere Jan 12 '13 at 21:57
  • 1
    The main advantage of spatialite is that you can take the data easily from one computer to another, at least for backup reasons. A Postgis database is faster, so I use that for large datasets like Openstreetmap and for rendering with mapnik. – AndreJ Jan 14 '13 at 6:16

With the Qspatialite plugin you can import any loaded qgis-layer in spatalite, that way you can load multiple layers in your DB.

| improve this answer | |
  • For me this is the better option the using the Save As.. route as it will allow you to import more then one layer. – Nathan W Jan 14 '13 at 5:54

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.