Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

My PostGIS database contains OSM data from my country. For transportation reasons I want to export a spatial view I created from that data to a SpatiaLite database.

Is there any way to directly extract my PostGIS view to a SpatiaLite db without resorting to a man-in-the-middle (shapefile then SQLite) solution?

Im using Ubuntu Linux, with PostGIS 2.1 GDAL 191.

EDIT:

Here's a single cmd to export to shapefile:

ogr2ogr -f "ESRI Shapefile" <name-of-folder-to-be-created> \
PG:"dbname=dbname user=username password=pass" \
-sql "<sql query eg> select * from database where <whatever>"

If you get a getsrid(geom) error, load in your database the "legacy.sql"

psql -f /path/to/legacy.sql
share|improve this question
    
I'm pretty sure that the DBManager plugin to QGIS can do this. –  Micha Sep 9 '12 at 6:22
add comment

2 Answers 2

up vote 4 down vote accepted

ogr2ogr?

See here for more information and maybe here as well

Cheers

Stéphane

share|improve this answer
    
this seems to be relevant. I will give it a try and then update with results –  nickves Sep 8 '12 at 20:48
    
Hi! Have you managed to export with ogr2ogr? –  Stéphane Henriod Sep 27 '12 at 5:51
    
yes I did. I had to load legacy.sql, but it works! –  nickves Sep 27 '12 at 10:15
add comment

If you haven't done a lot of work in postgis, another alternative might be to import it directly from OSM into spatialite.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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