From 4aa3ce35dd6fa4f4000a72d172158e0be98fd2fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Wed, 16 Dec 2020 08:52:18 +0200 Subject: [PATCH] README --- contours/Makefile | 6 +++--- contours/README.md | 34 +++++++++++++++++++++++----------- contours/config.mk | 8 ++++---- 3 files changed, 30 insertions(+), 18 deletions(-) diff --git a/contours/Makefile b/contours/Makefile index c0aceb9..e580c15 100644 --- a/contours/Makefile +++ b/contours/Makefile @@ -1,7 +1,7 @@ include config.mk OUTSIZE = $(shell awk $(addprefix -v ,$(BOUNDS)) 'BEGIN{print ymax-ymin" "xmax-xmin}' /dev/null) -XYZ = $(patsubst %.zip,%.xyz,$(wildcard 6*.zip)) +XYZ = $(patsubst %.zip,%.xyz,$(wildcard *.zip)) SORT = sort -n -k2 -k1 -t, .PHONY: all @@ -34,7 +34,7 @@ all.tif: all.vrt all.xyz -outsize $(OUTSIZE) else ifeq ($(VARIANT),2017) -all.tif: all.vrt all.xyz +all.tif: all.xyz gdal_translate $< $@ \ -ot Float32 -a_srs EPSG:3346 \ -co COMPRESS=DEFLATE -co PREDICTOR=2 @@ -50,7 +50,7 @@ all.xyz: $(XYZ) .INTERMEDIATE: $(XYZ) %.xyz: %.zip unzip -qq -c $< $@ | \ - ./clip-2009.awk $(addprefix -v ,$(BOUNDS)) | \ + ./clip-$(VARIANT).awk $(addprefix -v ,$(BOUNDS)) | \ $(SORT) > $@ db/.ready: managedb diff --git a/contours/README.md b/contours/README.md index eaaa98e..6fcea7d 100644 --- a/contours/README.md +++ b/contours/README.md @@ -1,27 +1,39 @@ Countour line generator from LIDAR data --------------------------------------- +This accepts two kinds of contour data: + +*2009 variant*: x, y, z, separated by one or more spaces: +``` + 501991.670 6150000.000 57.689 +``` + +*Non-gridded*, therefore significantly slower (`gdal_grid` must be used before making contours, which is slow). + + +*2017*: y, x, z, separated by commas: +``` +6062999.75,584000.75,88.07 +``` + +This is *gridded*, so quite fast. + Usage: -1. Download contour lines in format `6062999.75,584000.75,88.07`: coordinate - pair and height (in meters) to `DTM_XX_YY_N.zip` files. -2. Adjust `BOUNDS` in the Makefile. +1. Download contour lines to zip files in this directory. +2. Adjust `BOUNDS` and `VARIANT` in `config.mk`. 3. Run `make -j$(nproc) smooth_.gpkg`. This will output a geo-package with contour lines every `X` meters. X can be fractional (e.g. `smooth_2.5.gpkg`). 4. Optional: you may generate a raster image with `layer2img.py`. -Dependencies: +Dependencies for a Linux system: -- postgis +- docker +- psql (client only) - gdal-bin - unzip - -TODO: - -1. Replace `managedb` stack with postgis-over-docker. This will lead to a less - fragile postgis setup. -2. Accept `BOUNDS` in a way that does not require to change the Makefile. +- awk Example ------- diff --git a/contours/config.mk b/contours/config.mk index a5cf1f1..6083a1f 100644 --- a/contours/config.mk +++ b/contours/config.mk @@ -1,8 +1,8 @@ #krekenava #BOUNDS = xmin=504440 ymin=6154741 xmax=507410 ymax=6158941 -BOUNDS = xmin=493674 ymin=6146103 xmax=518869 ymax=6171741 -VARIANT = 2009 +#BOUNDS = xmin=493674 ymin=6146103 xmax=518869 ymax=6171741 +#VARIANT = 2009 #uzupis -#BOUNDS = xmin=582700 ymin=6060750 xmax=584830 ymax=6062750 -#VARIANT=2017 +BOUNDS = xmin=582700 ymin=6060750 xmax=584830 ymax=6062750 +VARIANT = 2017