1

I need dtm format that store only heights and scaling and left up position for saving storage

I glad to know if any stadard save heights that way

1
  • 2
    What formats did you consider so far? How large have they been and what are you aiming for in size?
    – Kersten
    Commented Aug 25, 2015 at 8:59

1 Answer 1

1

Base on your specification, i think ESRI ASCII raster format is the most suitable format. This link explain the basic structure of ESRI ASCII format :

http://resources.esri.com/help/9.3/arcgisdesktop/com/gp_toolref/spatial_analyst_tools/esri_ascii_raster_format.htm

I hope you can figure out how the header and the value can match with your specification (heights and scaling and left up position). Remind that you add GDAL in your tag, it seems that you need to know how to convert DEM inputed by GDAL into your specifically format which means ESRI ASCII format base on my opinion. These are the script i've been made so far, i'm using python :

from osgeo import gdal
from gdalconst import *
import numpy as np

# Input DEM raster data by using GDAL
filename_dem = raw_input("Input DEM FILE : ") 
dem_surface = gdal.Open( filename_dem, GA_ReadOnly )
geotransform = dem_surface.GetGeoTransform()
DEM_Value = np.array(dem_surface.GetRasterBand(1).ReadAsArray(), dtype ="float")

# Get the basic raster information 
Col = dem_surface.RasterXSize
Row = dem_surface.RasterYSize
Origin_X = geotransform[0]
Origin_Y = geotransform[3]
Cell_Size = geotransform[1]
CRS = dem_surface.GetProjection()

# Write into ESRI ASCII format
filename_ras = raw_input("Output Raster PATH :")+'.asc' 
out = open(filename_ras, 'wb+')
out.write('ncols         %i\n' % Col)
out.write('nrows         %i\n' % Row)
out.write('xllcorner     %f\n' % Origin_X)
out.write('yllcorner     %f\n' % (Origin_Y - (Cell_Size * Row)) )
out.write('cellsize      %i\n' % Cell_Size)
out.write('NODATA_value  %i\n' % 0)
np.savetxt(out, DEM_Value, fmt="%4i")

base on my answer below, i use GDAL firstly to read DEM data from any format, translate the value (height) into array by using numpy, then store it into ESRI ASCII (.asc) data format. I hope this is what you means and it can helping you..

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.