Sk:LLS ÚGKK SR

From OpenStreetMap Wiki
Jump to navigation Jump to search

Návod na extrakciu lesov a iných klasifikovaných plôch:

wine lastile -v -lof file_list.8.txt -o "tile.laz" -tile_size 800 -buffer 8 -flag_as_withheld -faf -cores 23 -odir "E:\media\martin\OSM" -olaz
wine blast2dem -lof files.txt -cores 4 -keep_classification 4 -keep_classification 5 -elevation -kill 5 -use_tile_bb -otif -odir /media/martin/14TB/LOT06/LIDAR/tiled/

## alternative if LAStools is not available
# whitebox_tools -r=FilterLidarClasses -v --wd=. -i=merged.las -o=filtered.las --exclude_cls='0,1,2,3,6,7,8,9,10,11,12,13,14,15,16,17,18'
# whitebox_tools -r=LidarDigitalSurfaceModel -v --wd=. -i=filtered.las -o test.tif --returns=last --resolution=0.5 --max_triangle_edge_length=5

# TODO add alternative using pdal

gdal_merge.py -co TILED=YES -co BIGTIFF=YES -co COMPRESS=DEFLATE -co PREDICTOR=2 -co NUM_THREADS=ALL_CPUS -ot byte -o merged.tif tile_*.tif
gdal_edit.py -a_srs EPSG:8353 merged.tif
gdal_calc.py -A merged.tif --outfile=binary.tif --overwrite --hideNoData --co="COMPRESS=DEFLATE" --co="PREDICTOR=2" --co "NUM_THREADS=ALL_CPUS" --calc="1*(A > 0)"
ogr2ogr buffered.gpkg /vsizip//home/martin/prehlad_lls.zip -dialect sqlite -sql "SELECT ST_Buffer(geometry, -1.0) AS geometry FROM """Prehlad_LLS""" WHERE Cislo_loka = '06'" -f "GPKG"
gdalwarp -overwrite -of GTiff -cutline buffered.gpkg -cl SELECT -crop_to_cutline -co COMPRESS=NONE binary.tif cut.tif
whitebox_tools -r=MajorityFilter -v --wd=. -i=cut.tif -o=major.tif --filter=15
gdal_sieve.py -st 120 major.tif sieved.tif
gdal_polygonize.py sieved.tif poly.gpkg
qgis_process run grass7:v.generalize --distance_units=meters --area_units=m2 --ellipsoid=EPSG:7004 --input=poly.gpkg --type=0 --type=1 --type=2 --cats= --where= --method=6 --threshold=1 --look_ahead=7 --reduction=50 --slide=0.5 --angle_thresh=3 --degree_thresh=0 --closeness_thresh=0 --betweeness_thresh=0 --alpha=1 --beta=1 --iterations=1 ---t=false ---l=true --GRASS_SNAP_TOLERANCE_PARAMETER=-1 --GRASS_MIN_AREA_PARAMETER=0.0001 --GRASS_OUTPUT_TYPE_PARAMETER=0 --GRASS_VECTOR_DSCO= --GRASS_VECTOR_LCO= --GRASS_VECTOR_EXPORT_NOCAT=false --output=generalized.gpkg --error=TEMPORARY_OUTPUT
qgis_process run native:smoothgeometry --distance_units=meters --area_units=m2 --ellipsoid=EPSG:7004 --INPUT=generalized.gpkg --ITERATIONS=1 --OFFSET=0.25 --MAX_ANGLE=180 --OUTPUT=smooth.gpkg
qgis_process run native:simplifygeometries --distance_units=meters --area_units=m2 --ellipsoid=EPSG:7004 --INPUT=smooth.gpkg --METHOD=0 --TOLERANCE=1 --OUTPUT=simplified.gpkg
ogr2ogr -f GeoJSON -t_srs EPSG:4326 result.geojson simplified.gpkg