[postgis-users] PostGIS to SpatiaLite

Mike Toews mwtoews at gmail.com
Sat Jul 24 12:26:38 PDT 2010


Ok ok, I've finally tamed ogr2ogr to a working state. When configuring
GDAL, use "--with-spatialite=/usr/local" (for a locally installed
SpatiaLite library), then make and install GDAL (note my build attempt
with Ubuntu 10.04 was unsuccessful for reasons I don't have time to
care for, but my build with 9.04 works).

To create the SpatiaLite file export the first layer:
$ ogr2ogr -f SQLite -dsco SPATIALITE=yes myfile.sqlite PG:"dbname=mydb
user=myuser password=mypass" myschema.mytable

And for additional layer/tables:
$ ogr2ogr -f SQLite -update myfile.db PG:"dbname=mydb user=myuser
password=mypass" myschema.my2ndtable

The resulting file work with viewers, including SpatiaLite GUI/GIS, Quantum GIS.

I've started http://trac.osgeo.org/postgis/wiki/SpatiaLite

-Mike

On 24 July 2010 10:43, Mike Toews <mwtoews at gmail.com> wrote:
> Hi all,
>
> I need to copy several PostGIS tables to a SpatiaLite file, so it can
> be used on field laptops. A similar question appeared a year ago[1],
> but there were no solutions.
>
> I understand that ogr2ogr has support for SpatiaLite using GDAL 1.7.x,
> however I cannot seem to configure the GDAL source to enable
> SpatiaLite[2]. Yet another option is FME, but I don't have time/budget
> for this. FDO doe
>
> Are there any other freely available server-side tools to do the
> conversion? Thanks.
>
> -Mike
>
> [1] http://postgis.refractions.net/pipermail/postgis-users/2009-June/023707.html
> [2] http://lists.osgeo.org/pipermail/gdal-dev/2010-July/025448.html
>



More information about the postgis-users mailing list