2020-12-15 23:49:25 +02:00
|
|
|
#uzupis
|
|
|
|
#BOUNDS = xmin=582700 ymin=6060750 xmax=584830 ymax=6062750
|
|
|
|
#krekenava
|
2020-12-16 08:00:45 +02:00
|
|
|
#BOUNDS = xmin=493674 ymin=6146103 xmax=518869 ymax=6171741
|
|
|
|
BOUNDS = xmin=504440 ymin=6154741 xmax=507410 ymax=6158941
|
|
|
|
#OUTSIZE = $(shell awk $(addprefix -v ,$(BOUNDS)) 'BEGIN{print ymax-ymin" "xmax-xmin}' /dev/null)
|
|
|
|
OUTSIZE = $(shell awk $(addprefix -v ,$(BOUNDS)) 'BEGIN{print int((ymax-ymin)/8)" "int((xmax-xmin)/8)}' /dev/null)
|
2020-12-16 07:23:35 +02:00
|
|
|
XYZ = $(patsubst %.zip,%.xyz,$(wildcard 6*.zip))
|
2020-12-11 10:44:26 +02:00
|
|
|
SORT = sort -n -k2 -k1 -t,
|
|
|
|
|
|
|
|
.PHONY: all
|
|
|
|
all: smooth_2_5.gpkg smooth_5.gpkg
|
|
|
|
|
|
|
|
smooth_%.gpkg: db/smooth_%
|
|
|
|
ogr2ogr $@ "PG:host=127.0.0.1 user=osm dbname=osm" $(basename $@)
|
|
|
|
|
|
|
|
db/smooth_%: db/contour_% chaikin.sql
|
|
|
|
./managedb -- --echo-all \
|
|
|
|
-v ON_ERROR_STOP=1 \
|
|
|
|
-v src=$(notdir $(basename $<)) \
|
|
|
|
-v tbl=$(notdir $(basename $@)) \
|
|
|
|
-f chaikin.sql
|
|
|
|
touch $@
|
|
|
|
|
|
|
|
db/contour_%: contour_%.gpkg db/.ready
|
|
|
|
./managedb -- -c "DROP TABLE IF EXISTS $(basename $<)"
|
|
|
|
ogr2ogr -f PostgreSQL "PG:host=127.0.0.1 user=osm dbname=osm" $<
|
|
|
|
touch $@
|
|
|
|
|
|
|
|
contour_%.gpkg: all.tif
|
|
|
|
gdal_contour -nln $(basename $@) -i $(subst _,.,$*) -a z $^ $@
|
|
|
|
|
2020-12-16 07:23:35 +02:00
|
|
|
all-grid.tif: all.vrt all.csv
|
2020-12-16 08:00:45 +02:00
|
|
|
gdal_grid $< $@ -ot Float32 -outsize $(OUTSIZE)
|
2020-12-16 07:23:35 +02:00
|
|
|
|
|
|
|
all.tif: all-grid.tif
|
2020-12-11 10:44:26 +02:00
|
|
|
gdal_translate $< $@ \
|
|
|
|
-ot Float32 -a_srs EPSG:3346 \
|
|
|
|
-co COMPRESS=DEFLATE -co PREDICTOR=2
|
|
|
|
|
2020-12-16 07:23:35 +02:00
|
|
|
.INTERMEDIATE: all.csv
|
|
|
|
all.csv: $(XYZ)
|
2020-12-11 10:44:26 +02:00
|
|
|
$(SORT) -m $^ > $@
|
|
|
|
|
|
|
|
.INTERMEDIATE: $(XYZ)
|
|
|
|
%.xyz: %.zip
|
|
|
|
unzip -qq -c $< $@ | \
|
2020-12-16 00:12:25 +02:00
|
|
|
./clip-2009.awk $(addprefix -v ,$(BOUNDS)) | \
|
2020-12-11 10:44:26 +02:00
|
|
|
$(SORT) > $@
|
|
|
|
|
|
|
|
db/.ready: managedb
|
2020-12-15 23:58:02 +02:00
|
|
|
mkdir -p db
|
2020-12-15 23:49:25 +02:00
|
|
|
./managedb start
|
2020-12-11 10:44:26 +02:00
|
|
|
touch $@
|