[gdal-dev] Problem using gdal_contour after gdal_merge.py

Tom Beddard tom at subblue.com
Sat Mar 22 10:59:54 PDT 2014


I’m having an issue generating a contour shape file with gdal_contour from a source file that has been merged with gdal_merge.py
I can generate contours from a single unmerged source tif without problems, so it seems something gdal_merge.py is doing is causing an issue.


This is my process:


I’ve downloaded SRTM data for the UK from
http://srtm.csi.cgiar.org/SELECTION/inputCoord.asp




After downloading the tifs I’m using gdal_merge.py to combine them all into a single file like:
gdal_merge.py srtm_*.tif -o uk.tif



I’m then re-projecting it to Google Web Mercator with:
gdalwarp -s_srs EPSG:4326 -t_srs EPSG:3785 -r bilinear uk.tif uk-3785.tif



Finally I’m generating the contours with:
gdal_contour -a elev -snodata 32767 -i uk-3785.tif uk-contour.shp



Generating the contours from a single reprojected tile works fine (takes about 80secs), however even trying it on two tiles that have been merged with gdal_merge.py it seems to process for a very long time (the .shp file quickly rises to a few gigs but then doesn’t change size) until after an age it errors with:
ERROR 1: Failed to write shape object. File size cannot reach 4294964860 + 2696.



It’s strange that a tif combined from two tiles fails when it reaches a ~4GB file size and yet doing just one of them individually only results in a 90MB .shp file.


As a side note I’m also generating hill and slope shading images (for use in TileMill). 
You can see my full script for that here: https://gist.github.com/subblue/9705999



I’m using gdal v1.10.1 that has been installed via brew on OSX 10.9.2


Are there any tricks to generating contours from merged files or is it just going to be a case of scripting the generation of lots of .shp contour files from each of the elevation tiles?


Thanks for any help, I’m still on the steep bit of the learning curve with all of this :)


Tom




--
Tom Beddard
www.subblue.com

twitter.com/subblue



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20140322/52648ebc/attachment.html>


More information about the gdal-dev mailing list