Infinitely high blocks being generated for DEM areas without data...

I have a collection of DEM tiles which don't form a uniform shape (they roughly cover a city area for a city that's not a rectangle ;-).

I need to process these through Global Mapper and Export another DEM Elevation Grid (GeoTIFF 32bit float format). The tiles I output are a different size to the incoming tiles and fit together to fill a rectangular "bounding box" around the city - as such there are large areas in the output tiles which there was no input data for in the first place...

The problem I have is that the output DEM files contain perfect data for the areas where there was input data available, but the for the areas where there was no input data the heights are recorded as "infinitely high" or something close to it... I would have expected (and wanted) areas where there was no data to be set to zero/sea-level??

Looking at the generated images I can see the areas with data are very close to "white" (close to sea-level) and all the areas where there was no data are black. Is there any way to tell Global Mapper to use a "zero height" value for areas where there is no input data?

Thanks,
Tagged:

Answers

  • AaronAaron Posts: 5
    Exporting as unsigned 32bit integer seems to work around the problem (no data is saved as "zero" rather than "really big"), but the default value with 32bit floats seems to be a bug?
  • AaronAaron Posts: 5
    Nope; this isn't a viable workaround - the resulting data has vertical steps in it (the integer values I guess) which look to be 1 meter high, which is FAR too large to be useful for many purposes. I tried generating again and setting the units to "millimeters" in Global Mapper but the resulting maps seemed - I don't know - definitely broken.

    Still looking for a way to generate float32 DEM maps where "no data available" is set to sea-level rather than "infinitely high".
  • AaronAaron Posts: 5
    I *think* I've resolved this problem through a work-around outside of Global Mapper. Examining the pixels in the Global Mapper output float32 DEM file, it seems the pixels where there wasn't any input information were being stored with a value of about -32,000. The process I was using this to generate a 3D terrain mesh was interpreting the value as ridiculously high in the sky for some reason (rather than 32km under ground, which is what Global Mapper was implying).

    I wrote the following python snippet to re-process my 10k x 10k tiled images and make anything with a value < 0 instead have a value of zero.

    from osgeo import gdal
    src = gdal.Open('myDEMfile.tif', gdal.GA_Update)
    band = src.GetRasterBand(1)
    ar = band.ReadAsArray()
    for y in range(10000):
        for x in range(10000):
            if ar[x,y] < 0.0:
                ar[x,y] = 0.0
    # Save/close the file
    band.WriteArray(ar)
    del ar, band, src

    Still seems like Global Mapper should use a zero value to indicate a lack of input data rather than ~ -32k.
  • MicheleMichele Posts: 26
    In GM, go to the options for the elevation grid layer, go to alter elevation data tab, you can set what to substitute no data with.
    Hope this helps.
    Best regards 
    Michele 
Sign In or Register to comment.