Tag Archives: ogr2ogr

This is an update to my previous post “WFS to PostGIS in 3 Steps”. Thanks to Even Rouault’s comments and improvements to GDAL, it is now possible to load Latin1-encoded WFS (like the one by into PostGIS in just one simple step.

To use the following instructions, you’ll have to get the latest GDAL (

You only need to run SDKShell.bat to set up the environment and ogr2ogr is ready for action:

C:\Users\Anita>cd C:\release-1600-gdal-mapserver
C:\release-1600-gdal-mapserver>ogr2ogr -overwrite -f PostgreSQL PG:"user=myuser password=mypassword dbname=wien_ogd" "WFS:"

Thanks everyone for your comments and help!

This is just a quick “note to self” on some interesting information I picked up from the QGIS mailing list today. Kudos to David J. Bakeman for sharing this:

If both the input and the output arguments to ogr2ogr are directories then it will clip all of the shapes in the source directory and write them to the output directory.

So: ogr2ogr -clipsrc mask.shp output source

Shapefiles are the default so you don’t even need the -f “ESRI Shapefile”.

The following Shell script performs a conversion and reprojection of a folder full of Shapefiles to CSVs:

for f in `ls *.shp`; do
ogr2ogr -s_srs EPSG:4326 -t_srs EPSG:3035 -f CSV $f.csv $f -lco GEOMETRY=AS_XYZ

Thanks OGR!

%d bloggers like this: