1

I have a very strange problem with gdal_contour. I have a very large GeoTif of Europe and would like to generate contour-lines for that region. Everything worked fine when I had lines every 25m but now I wanted to do it again and have lines every 10m.

It runs through without any error, but I am missing lines below 500-600m. Some lines until 500m are present, but many aren't. And below 500m I don't have any lines. I already ran it twice to just to make sure if there was a problem at first run, but second run had the same issues. Is there anything I am doing wrong here? Here's my command that I used.

gdal_contour -a height -f PostgreSQL -i 10.0 input "PG:host=localhost user=postgres password=postgres dbname=contours"

I need to have the output in a Postgres DB cause in a later process I would need to simplify some of the lines. So choosing a shapefile wouln't be an option.

8
  • I just tried to create the contours into a shapefile and got this message: Failed to write shape object. File size cannot reach 4294967284 So there is a limit to shapefiles.... But does anybody know if there is a limit to Postgres as well after which gdal_contour just doesn't continue?
    – Georg
    May 4, 2015 at 11:26
  • Is it just not visualizing some of the lines when you plot it or is the data actually missing? Also, you would probably get drastically increased performance and processing speed if you subset your GeoTif prior to processing and merged everything back together at the end.
    – Jezibelle
    May 4, 2015 at 15:04
  • Hello, thanks a lot for your help. No, unfortunately it's not a visualisation error. The lines just are not there. About the sub-geotiff... you mean something like gdalwarp -te <boundingbox>? Do you know if there is a limit of lines gdal_contour processes? Or what could be the explanation of my missing lines?
    – Georg
    May 4, 2015 at 19:00
  • So, these posts about the algorithm are slightly helpful: osgeo-org.1560.x6.nabble.com/…; gis.stackexchange.com/questions/50746/…
    – Jezibelle
    May 4, 2015 at 20:08
  • Yea, you can subset w/ gdalwarp, or manually using a gui (qgis or arcgis). But, for the file type you're using, there shouldn't be limits on what can be stored, and if it had run out of memory, it should have thrown an error. Is it possible your data simply cannot support 10 m contours? If you run the tool on a subset of the tiff with values mostly below 500 m, do you get contour lines?
    – Jezibelle
    May 4, 2015 at 20:38

1 Answer 1

0

The problem was the missing -inodata flag of my gdal_contour command

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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