Skip to content

Latest commit

 

History

History
340 lines (263 loc) · 11 KB

README.md

File metadata and controls

340 lines (263 loc) · 11 KB

AwGeo - geo- and mappingtools

I am a skilled orienteer who works with maps using Ocad software. In Finland, we are happy because we have so much open source geospatial data. License CC 4.0, data open source National Land Survey of Finland

The tools used to find the needs for processing geodata

My geo programs use various software, including Lastools, PDAL and GDAL.

The full licence terms can be found on the individual pages of the following tools.

My online tools

Lidar maps and tools

Other interesting tools

Install tools

This example is for Ubuntu, Debian, WSL2 Ubuntu, ...

Each software pages include also download for Windows, OS/X, ...

Ubuntu, Debian, WSL2 Ubuntu, ...

#sudo apt-get install proj-bin libproj-dev
sudo apt-get install python3-dev python3.8-dev python3-pip
# update PIP
pip3 install --upgrade pip

# GDAL install include PROJ
# Official stable UbuntuGIS packages.
sudo add-apt-repository ppa:ubuntugis/ppa
sudo apt-get update
sudo apt-get install gdal-bin libgdal-dev 
#       Check:
ogrinfo --version

sudo apt-get install python3-gdal python3-numpy

# If using perl and need GDAL, then
sudo apt-get install libgd-gd2-perl
# PDAL
sudo apt-get install -y pdal libpdal-plugins

If you get error free(): invalid pointer using cmds:

ogrinfo --version
gdalinfo --version
pdal --version

Then you have problem with libproj versions. Solutions is usually to find correct libproj = latest and then soft link to the older version numbers.

Read solutions.

Pip for python

# User env
#       - look version using: ogrinfo --version
#       - in this example version is 3.3.2
       pip install GDAL==3.3.2
       pip install pygdal=="3.3.2.*"
       pip install laspy[laszip]
       pip install scipy numpy
       pip install lasio

Awot sh-scripts use various software, including proj, gdal, pdal, lastools, ...

All example files are in the examples directory.

setup AWGEO env

After you have get copy of awgeo, you need setup config/awgeo.ini file. Example if this directory is /home/user/awgeo then your configfile /home/user/awgeo/config/awgeo.ini has one line:

AWGEO=/home/user/awgeo

raw2xy.sh - Make XY polygon file from Ocad polygon information

  • draw polygon in Ocad
  • get polygon info (button i)
  • copy polycon text to the textfile ex. area.raw

Convert raw to the xy format:

$AWGEO/raw2xy.sh -i area.raw -o area.txt

xy2wkt.sh - Make WKT Polygon from x,y polygon text file

Convert x,y polygon textfile to the WKT polygon format.

cd examples
cat area.txt
632162.5 6954655.8
632176.7 6954656.9
632200.1 6954651.5
632162.5 6954655.8

$AWGEO/xy2wkt.sh -i area.txt -o area.wkt
# or using pipe
cat area.txt | $AWGEO/xy2wkt.sh > area.wkt

lazcrop.sh - Crop polygon area from LAZ file

You can use Lastools lasclip or this small PDAL script to crop polygon area from laz file. lazcrop.sh need polygon in WKT Polygon format. Look xy2wkt.sh how to convert x,y textfile to the wkt format.

# using lastools
lasclip64 -i example.laz -o areax.las -poly area.txt
# using lazcrop.sh
$AWGEO/lazcrop.sh -i example.laz -p area.wkt -o areay.las

laz2tif.sh - Make GeoTiff from LAZ file

laz2tif.sh -i input.laz -o result.tif [ -d 0|1 ]
   -i input laz file name
   -o result tif file
   -d 0|1 , default 0 - debug output
   -v       version
   -h       this help

Example from example.laz

cd examples
$AWGEO/laz2tif.sh -i example.laz -o example1.tif

Result file is example1.tif

hillshade.sh - Make hillshade from lidar file (laz)

hillshade.sh -i input.laz -o resultname [ -z NUMBER ] [ -g 0|1 ] [ -d 0|1 ]
   -i input laz file name
   -o resultname, result file is resultname.tif !!!
   -g 0|1 , default 1, using ground filter or not
   -z NUMBER  , default is 3
   -d 0|1 , default 0 - debug output
   -v 	     version
   -h       this help

Example hillshade from example.laz

cd examples
$AWGEO/hillshade.sh -i example.laz -o example1

Result file is example1.tif

Convert Tiff to PNG

gdal_translate -of PNG example1.tif example1.png
  • default values, look hillshade.sh, funtion *json and set_def.

lidar_volume.py - Calculate volume of Lidar

Example hill, calculate volume.

Calculate the volume from the Lidar data (LAZ-file) data above a certain height.

lidar_volume.py I have used to calculate volume of lidar, using some base z-index.

Here is example how to clip some area from LAZ-file and then calculate volume above level 112.

cd examples
# unzip laz and clip area using polycon area.txt
lasclip64 -i example.laz -o areax.las -poly area.txt  -keep_class 2
# or drop below 112 data already in this step, lidar_volume.py also accept above level value
lasclip64 -i example.laz -o areax.las -poly area.txt  -keep_class 2  -drop_z_below 112
# or using my lazcrop.sh

# or using Pdal to unzip laz to las
pdal translate example.laz example.las

# look lazcrop.sh how to clip polygon from the LAZ-file

# calculate volume 
python3 $AWGEO/lidar_volume.py areax.las 112
112.0 38780.31 m3

Rotate GeoTIFF

Source for this solution. Thanks for WaterFox.

python3 rotate.angle.py source.tif  angle rotated.tif
# angle is +/- degrees

Remove geogoords from GeoTiff

Need to remove geodata from GeoTiff => it is "only" tif image without geolocation.

gdal_translate -of GTiff -co PROFILE=BASELINE input.tif output.tif
# or
cp geotif.tif output.tif
gdal_edit.py  -unsetgt output.tif

Forest "hillshade" from LAZ

A so-called "spike free" shade image representing the density and height of the trees.

More documentation in the script.

forest.sh

Hillshade and Forest "hillshade" from LAZ

Do both hillshade.sh and forest.sh

More documentation in the script.

forest_hillshade.sh

Karttapullautin batch execute

pullauta.run.sh is my version to batch pullauta process.

setup

  • mkdir input and output
  • config/pullauta.ini use some variable = dynamic template , make your edits to this version
  • edit awgeo.ini, set directory where is AwGeo binary's

config/pullauta.ini

Have to set:

batch=1
processes=4  # how many core you can use 
batchoutfolder=./output
lazfolder=./input

execute

Normal batch:

  • put input files to the dir input: LAZ + Maastotietokanta SHP zipped (ZIP)
  • execute pullauta
  • make also hillshade and intermediate curves
pullauta.run.sh -a 11 -i 0.625 -s -z 3
# - northlineangle 11, intermediate curve 0.625, hillshade using z=3

Only map without hillshade and intermediate curves, nothlines angle 11: If angle=0, no northlines.

pullauta.run.sh -a 11 

Re-run only using tempfiles hillshade:

  • reuse temp files
pullauta.run.sh --onlyhillshade  -s  -z 3

Re-run only using tempfiles intermediate curves:

pullauta.run.sh --onlyintermediate -i 0.625
# - run only intermediate curves (0.625 m) after basic run - use temp files

Coming ...

Full packet to make map

  • input MML (NLM) tile code, example P5313L
  • need MML apikey or use Kapsi.fi-server to get those materials
  • execute - including all:
    • get orthophoto, laser scanning data, topographic database (FI:ilmakuvat, laserdata, maastotietokanta)
    • get ...
    • create DXF from shp files (topographic database)
    • run pullauta including 0.625 intermediate curves
    • hillshade image
    • forest "spike free" image
    • FIshp2ISOM2017.crt file for Ocad
  • you need import DXF using CRT file to Ocad and select background images

Open source data: geospatial data. License CC 4.0, data source National Land Survey of Finland