2

I am looking to combine .DEM files into a single .DEM file and export a crop of the center.

My site lies across 4 DEM files, about a quarter in each. It only occupies a small portion of each. I am using an outside program to convert DEM files into 3D data for Rhino to use as a NURBS site map. The problem is the program will combine 3 of the files, but one of the DEMs will not combine with the others reading "Out of Memory." I am thinking that if I crop just the site it will hopefully upload- as it is a much smaller area than any one of the DEMs- but again it exists across 4 separate DEM files.

Essentially, combine all 4, export out a small portion of the middle as a .DEM.

The program only works with .DEM extensions and not GeoTIFFs.

PolyGeo
  • 65,136
  • 29
  • 109
  • 338
Dan
  • 21
  • 2

1 Answers1

2

To merge raster files into one, one can use gdal_merge.py. It works on a lots of raster formats (see list here). I suppose your .dem files comes from USGS

You should then be able, should gdal is properly installed with the python bindings, to merge your files into one by using the command line in something like :

gdal_merge.py -o mymergedem.dem mydem1.dem mydem2.dem mydem3.dem mydem4.dem

gdal_merge.py : This utility will automatically mosaic a set of images. All the images must be in the same coordinate system and have a matching number of bands, but they may be overlapping, and at different resolutions. In areas of overlap, the last image will be copied over earlier ones.

You can then crop your data from coordinates or from a shapefile for example with the gdalwarp utility with something like :

gdalwarp -t_srs EPSG:[Replace with yours] -te xmin ymin xmax ymax mymergedem.dem mycropped.dem

gdalwarp : The gdalwarp utility is an image mosaicing, reprojection and warping utility. The program can reproject to any supported projection, and can also apply GCPs stored with the image if the image is "raw" with control information.

Or with gdal_translate :

  • Unprojected:gdal_translate -srcwin xmin ymin xmax ymax mymergedem.dem mycropped.dem
  • Projected: gdal_translate -projwin ulx uly lrx lry mymergedem.dem mycropped.dem

gdal_translate : The gdal_translate utility can be used to convert raster data between different formats, potentially performing some operations like subsettings, resampling, and rescaling pixels in the process.

To make sure it works, you might need to review the description page of the different utilities and if necessary split your question and/or search for different aspects of what could be blocking you (how to install gdal, how to use gdal_merge, how to use gdal_translate or gdalwarp).

gisnside
  • 7,818
  • 2
  • 29
  • 73
  • 1
    It appears that gdal_merge.py does not allow .dem files. My error upon trying this: Format driver USGSDEM does not support creation and piecewise writing. Please select a format that does, such as GTiff (the default) or HFA (Erdas Imagine). – nukenine Nov 08 '18 at 17:06