commit ad0217fec185bcf79bf4ec3dc27774ae25870dac (tree)
parent e9c23a6ded504be7b268a60874b74b740ad1b604
Author: Motiejus Jakštys <motiejus@uber.com>
Date: Wed, 16 Dec 2020 07:23:35 +0200
split 2009 and 2017 makefiles
Diffstat:
3 files changed, 59 insertions(+), 0 deletions(-)
diff --git a/contours/Makefile.2008 b/contours/Makefile.2008
@@ -0,0 +1,51 @@
+#uzupis
+#BOUNDS = xmin=582700 ymin=6060750 xmax=584830 ymax=6062750
+#krekenava
+BOUNDS = xmin=493674 ymin=6146103 xmax=518869 ymax=6171741
+XYZ = $(patsubst %.zip,%.xyz,$(wildcard 6*.zip))
+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 $^ $@
+
+all-grid.tif: all.vrt all.csv
+ gdal_grid $< $@ -ot Float32
+
+all.tif: all-grid.tif
+ gdal_translate $< $@ \
+ -ot Float32 -a_srs EPSG:3346 \
+ -co COMPRESS=DEFLATE -co PREDICTOR=2
+
+.INTERMEDIATE: all.csv
+all.csv: $(XYZ)
+ $(SORT) -m $^ > $@
+
+.INTERMEDIATE: $(XYZ)
+%.xyz: %.zip
+ unzip -qq -c $< $@ | \
+ ./clip-2009.awk $(addprefix -v ,$(BOUNDS)) | \
+ $(SORT) > $@
+
+db/.ready: managedb
+ mkdir -p db
+ ./managedb start
+ touch $@
diff --git a/contours/Makefile b/contours/Makefile.2017
diff --git a/contours/all.vrt b/contours/all.vrt
@@ -0,0 +1,8 @@
+<OGRVRTDataSource>
+ <OGRVRTLayer name="all">
+ <LayerSRS>EPSG:3346</LayerSRS>
+ <SrcDataSource>all-small.csv</SrcDataSource>
+ <GeometryType>wkbPoint</GeometryType>
+ <GeometryField encoding="PointFromColumns" x="field_1" y="field_2" z="field_3"/>
+ </OGRVRTLayer>
+</OGRVRTDataSource>