Version 20 (modified by knpa, 8 years ago) (diff)


NextMap data

A 5m DEM dataset generated from airborne radar mapping. NEODC holds the dataset and can distribute it to registered academic users. You can sign up at:

Creation of DEMs from NextMap data

(arsf-dan internal use only)

Automatically creates a DEM from our collection of nextmap data stored in ~arsf/nextmap_dems/neodc/by_tile/by_product/dsm/
Can create either an ascii DEM for use with azgcorr or a binary latlong DEM which is suitable for aplcorr.
Run in the top project directory as the arsf user.


Note: This section describes how to create an azgcorr compatible ascii DEM only.
The azgcorr format is plain ASCII text, with decimal numbers separated by spaces, one row per row of the DEM. At the top of the file, you need a single line that describes the geographic position of the DEM.

NextMAP DEMs are supplied in Arc format. To do the conversion, we use GRASS, though other tools will probably work fine too. Basic process is:

  • load in the tiles you need
  • patch them together, adding zero levels if necessary
  • output as ASCII
  • add the azgcorr header line (manually or by script)

Command line method

If you don't have a suitable grass location and don't want to work out how to create one, download the attached grass template for UK British National Grid projection and start with a command like grass62 /path/to/grass_db_template/UKBNG/PERMANENT.

 # read in a couple of tiles -e input=~arsf/nextmap_dems/neodc/by_tile/by_product/dsm/tl/tl17/tl17dsm/w001001.adf output=tl17 -e input=~arsf/nextmap_dems/neodc/by_tile/by_product/dsm/tl/tl27/tl27dsm/w001001.adf output=tl27
 # set the region of interest to the (two) tiles we want to export
g.region rast=tl17,tl27
 # patch them together into a single raster
r.patch input=tl17,tl27 output=tl17and27
 # write out as an ASCII DEM (needs editing as below)
r.out.ascii input=tl17and27 output=/tmp/tl17and27.dem null=0

Note the "null=0" in the r.out.ascii command. Without this the default null value is '*', which will cause problems in azgcorr. If you mistakenly create a file with *'s in it, you can fix it without rerunning everything using this command: cat its_full_of_stars.dem | sed 's/\*/0/g' > fixed.dem.

Then run the script or manually edit the DEM file to include an azgcorr header (or you can specify this on the command line if you prefer).

Adding the azgcorr header

Run the script to convert the ASCII file to have an azgcorr compatible header. Note this will delete the original ASCII file unless you specify -nodel at the end. The optional resolution argument specifies the DEM grid resolution in metres, defaults to 5m if omitted.

# Run conversion script, input file is the first argument, output file is the second asciifile.dem azgcorrfile.dem [-nodel] [-res <resolution>]

If for any reason the script doesn't work, edit the ASCII file manually (first line must be as follows, then DEM data):

 -ed or c r xm ym xx yx gi : is the basic flat file ascii DEM definition
            : or = data order =0 rows S->N, =1 rows N->S
            : c = cols, r = rows, xm, ym = SW, xx, yx = NE corners
            : gi = grid increments; grid values separated by spaces
            : ** NB: for this definition georeferencing of the DEM grid is assumed
            :    to be at the CENTRE of the cell defined by the grid coordinates
            : ** if this is NOTthe case use option -edx, below

    1 2000 2000 400000 850000 410000 860000 5
 N->s Xsize YSize Xmin Ymin   Xmax   Ymax   grid size (5m for nextmap)

Make sure that no non-numeric values are present in the DEM, as this will confuse azgcorr.

Use DEM with azgcorr -eh demfilename

To add a zero-level area to a map (ie sea level):
# Restrict active region to area you're interested in - must use eastings/northings, lat/long seems to have problems determining valid values
g.region n=601000 e=451000 s=579000 w=389000

# Check region is restricted correctly
g.region -gb

# Create vector map of active region, output param is name of output map output=v_sealevel

# Convert vector map to raster map input=v_sealevel output=r_sealevel use=val value=0.0

# Create raster maps for areas with OS data as first line only in section above -e input=/data/aegean1/nextmap_dems/neodc/by_tile/by_product/dsm/ny/ny98/ny98dsm/w001001.adf output=ny98 -e input=/data/aegean1/nextmap_dems/neodc/by_tile/by_product/dsm/ny/ny99/ny99dsm/w001001.adf output=ny99

# Patch raster maps together as section above
# NOTE SEA LEVEL MAP MUST BE LAST IN LIST, since Grass starts with a blank map and adds patched raster maps in order
r.patch input=ny98,ny99,...,r_sealevel output=map_with_added_sea_level

# Create DEM from raster map as section above
r.out.ascii input=map_with_added_sea_level output=/tmp/map_with_added_sea_level.dem null=0

GRASS GUI method

(brief description)

load arc files into grass

  • import->raster->gdal
  • pick file
  • choose create new location if this is the first import
  • run (will fail for UK as it needs user input)
  • copy and paste command into grass shell so you can respond (e.g. -e input=/data/aegean1/nextmap_dems/neodc/by_tile/by_product/dsm/nk/nk02/nk02dsm/w001001.adf output=nk02
  • if you need to import multiple rasters, you can use the location created, but must select extend region
  • (need to figure out how to join rasters into one, then subset in grass)

export as ASCII grid, manually add header as above

[you can load this grid into ENVI to test against vector layers, etc - file->open external->generic->ascii, then georeference (edit headers->mapinfo, etc)]

Attachments (2)

Download all attachments as: .zip