Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to generate contours with gdal_contour command. It generates an output as shapefile by default. I want this utility to output a postgresql (postgis) table.

The documentation says there is a -f option, but I couldn't find any examples on specifying a format.

Can anyone provide an example of specifying postgis table as an output for gdal_contour?

share|improve this question
up vote 4 down vote accepted

Solved. Just like in ogr2ogr:

gdal_contour -f PostgreSQL -i 1 -nln cont iamrast.tif "PG:host=localhost user=iampg password=iampgpass dbname=iamgis"
share|improve this answer

I have not seen -f option using as you too.

as a practical solution for loading output shapefile:

shp2pgsql -s 4326 -W latin5 -I -S -D contour.shp contours | psql -U postgres -h localhost -d mydatabase

beside this you can check out gdal extension on qgis how it formatting your command.(it shows gdal command in windows) at Raster->Extraction->Contour menu...

i hope it helps you...

share|improve this answer

Your Answer


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.