kopia lustrzana https://github.com/OpenDroneMap/ODM
Merge pull request #561 from hblanken/grass-update-1
Linked contour map generation with ODM DEM model
Former-commit-id: 2821079f25
pull/1161/head
commit
d1242cd1ce
|
@ -12,7 +12,6 @@ import grass.script as gscript
|
||||||
import grass.script.core
|
import grass.script.core
|
||||||
import grass.script.setup
|
import grass.script.setup
|
||||||
|
|
||||||
vlidarName = 'odm_vlidar'
|
|
||||||
rsurfName = 'odm_rsurf'
|
rsurfName = 'odm_rsurf'
|
||||||
contourName = 'odm_contour'
|
contourName = 'odm_contour'
|
||||||
orthophotoName = 'odm_orthophoto'
|
orthophotoName = 'odm_orthophoto'
|
||||||
|
@ -65,47 +64,25 @@ def main():
|
||||||
gscript.run_command('g.region', flags='s', n=n, s=s, e=e, w=w, res=0.01,
|
gscript.run_command('g.region', flags='s', n=n, s=s, e=e, w=w, res=0.01,
|
||||||
res3=0.01, overwrite=overwrite)
|
res3=0.01, overwrite=overwrite)
|
||||||
|
|
||||||
dem(projectHome)
|
|
||||||
contour(projectHome)
|
contour(projectHome)
|
||||||
relief(projectHome)
|
relief(projectHome)
|
||||||
|
|
||||||
os.remove(gisrc)
|
os.remove(gisrc)
|
||||||
|
|
||||||
|
|
||||||
def dem(projectHome):
|
|
||||||
"""
|
|
||||||
Creates a DEM in GeoTIFF format.
|
|
||||||
NB: this is a data raster, not an RGBA raster
|
|
||||||
and so is normally only readable by GIS and not image software.
|
|
||||||
"""
|
|
||||||
print 'Creating DEM'
|
|
||||||
|
|
||||||
step = 0.5
|
|
||||||
gscript.run_command('v.in.lidar', flags='beo',
|
|
||||||
input=projectHome +
|
|
||||||
'/odm_georeferencing/odm_georeferenced_model.ply.las',
|
|
||||||
output=vlidarName, overwrite=overwrite)
|
|
||||||
|
|
||||||
gscript.run_command('v.surf.bspline', input=vlidarName,
|
|
||||||
raster_output=rsurfName,
|
|
||||||
ew_step=step, ns_step=step, method='bicubic',
|
|
||||||
memory=4096, overwrite=overwrite)
|
|
||||||
|
|
||||||
gscript.run_command('r.out.gdal', flags='cfm', input=rsurfName,
|
|
||||||
output=projectHome+'/odm_georeferencing/odm_dem.tif',
|
|
||||||
format='GTiff', type='Float32',
|
|
||||||
createopt='TILED=yes,COMPRESS=DEFLATE,PREDICTOR=2,' +
|
|
||||||
'BLOCKXSIZE=512,BLOCKYSIZE=512', nodata=0,
|
|
||||||
overwrite=overwrite)
|
|
||||||
|
|
||||||
|
|
||||||
def contour(projectHome):
|
def contour(projectHome):
|
||||||
"""
|
"""
|
||||||
Creates a contour map.
|
Creates a contour map based on the ODM project DEM model.
|
||||||
"""
|
"""
|
||||||
print 'Creating contour map'
|
print 'Creating contour map'
|
||||||
|
|
||||||
step = 0.25
|
step = 0.25
|
||||||
|
|
||||||
|
gscript.run_command('r.in.gdal', flags='o',
|
||||||
|
input=projectHome+'/odm_georeferencing/odm_georeferencing_model_dem.tif',
|
||||||
|
output=rsurfName, memory=2047,
|
||||||
|
overwrite=overwrite)
|
||||||
|
|
||||||
gscript.run_command('r.contour', input=rsurfName, output=contourName,
|
gscript.run_command('r.contour', input=rsurfName, output=contourName,
|
||||||
step=step, overwrite=overwrite)
|
step=step, overwrite=overwrite)
|
||||||
|
|
||||||
|
@ -122,7 +99,7 @@ def relief(projectHome):
|
||||||
"""
|
"""
|
||||||
print 'Creating relief map'
|
print 'Creating relief map'
|
||||||
|
|
||||||
gscript.run_command('r.in.gdal', flags='e',
|
gscript.run_command('r.in.gdal', flags='o',
|
||||||
input=projectHome+'/odm_orthophoto/odm_orthophoto.tif',
|
input=projectHome+'/odm_orthophoto/odm_orthophoto.tif',
|
||||||
output=orthophotoName, memory=2047,
|
output=orthophotoName, memory=2047,
|
||||||
overwrite=overwrite)
|
overwrite=overwrite)
|
||||||
|
|
Ładowanie…
Reference in New Issue