5

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. http://www.gdal.org/gdal_contour.html

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

  • The time you need to do this is when the generated SHP file exceeds the 2/4 GB limit. – Tybion Feb 8 '17 at 4:25
8

Solved. Just like in ogr2ogr:

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

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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