Showing posts from May, 2013

OGR2OGR examples for Spatialite, PostGIS, Shapefiles

I'm constantly trying to avoid Shapefiles but seem to only fail because some software GPS or GIS only supports Shapefiles as the interchange format.  Hence bye bye table names longer than 10 Characters (very annoying !) when going from a DB to Shapefile. Here are some examples that I have recently used in doing some batch conversions here and there between PostGIS, Spatialite and Shapefiles. My Setup :  Windows 7 Pro, 32 Bit,  ogr2ogr.exe  version GDAL 1.9.2, released 2012/10/08 (Installed using OSGeo4W  installer) Example how to get version of ogr2ogr on my machine, at the command prompt.  Note your path to ogr2ogr is most likely not where I have it. > c:/OSGeo4W/bin/ogr2ogr.exe/ogr2ogr.exe --version   version GDAL 1.9.2, released 2012/10/08 So now the examples Example 1.  upload all Spatialite tables to an existing PostGIS DB and existing tables with same name as the Spatialite table names  c:/OSGeo4W/bin/ogr2ogr.exe/ogr2ogr.exe -append -lco GEOMETRY_NAME=geom