The logical approach is correct, but 60 Gb is a massive raster file: I would first asses if all that detail is really needed. A 0.3 raster over Hong Kong seems a little far, if the input data does not have that resolution. Keep also in mind that the contouring process by definition introduces a smoothing of the data.
If reducing the detail is not an option in your case, you must resort to tiling.
Also, you might want to try
gdal_grid instead of
Use smaller regions to run
r.surf. Make sure your raster tiles do overlap, otherwise contours from different tiles will not match do to border artifacts.
To do so:
- Create square tiles as polygons, this will be your base to run
- Buffer (without dissolving) by a reasonable amount (which depends on resolution, interpolation parameters, etc.). Rule of thumb: 5% of the tile width.
gdal_grid on each buffered tile.
r.surf.contour on each base tile and the corresponding interpolated raster.
- Check for consistency how contours match at the tiles borders.
- Optionally merge the output contours.
gdal_grid -txe Xmin Xmax -tye Ymin Ymax -outsize pixel_width pixel_height \
-l input_vector_file \
-zfield name_of_field_with_elevation \
-a nearest:radius1=15.0:radius2=15.0:angle=0.0:nodata=0.0 \
-ot Float32 -of GTiff -co COMPRESS=NONE -co BIGTIFF=IF_NEEDED \
To find out (H/T kartoza-geek) which version of Grass your PC is running, and therefore the maximum addressable memory, which in turn will help you figuring out the tile dimension:
# run next line in a GRASS GIS session:
file `which r.contour`