### Makefile --- study one street: Heshun Road
## Author: Dan Jacobson https://www.jidanni.org/
## Copyright: https://www.gnu.org/licenses/gpl.html
## Created: 2025-01-29T08:17:36+0000
## Last-Updated: 2025-04-26T02:27:42+0000
##     Update #: 17

# Instead of whatever my original objective was, Maybe instead one day
# make a map of how far out of sync the two sides of the road get as
# one goes along. I could use linear referencing along each side, and
# inquire at regular distances, as to what the current difference is,
# and make that into some color step map.

A:=https://overpass-turbo.eu/?Q=[out:json][timeout:25];\
{{geocodeArea:Beitun District}}->.searchArea;nwr[name~"
R:=https://overpass-turbo.eu/?Q=[out:json][timeout:25];\
{{geocodeArea:Beitun District}}->.searchArea;nwr[addr:street]~"

[out:json][timeout:25]; {{geocodeArea:Beitun District}}->.searchArea;nwr["addr:street"~"和順"](area.searchArea);out geom;

B:="](area.searchArea);out geom;
和順:=$A和順$B
軍和:=$A軍和$B
v=viking
%.vik:%.kml
	if pidof -q $v; then killall --wait --signal SIGHUP $v; fi; \
	>> /tmp/nohup2.out nohup $v $^ & sleep 11
j=heshun.geojson
i:$j; ogrinfo $< -al
j.vik:
j.kml:$j
	ogr2ogr $@ -q -f LIBKML $< -dialect SQLite -sql \
	'SELECT Name, ST_LineMerge(ST_Collect(geometry)) FROM $(basename $<) $(\
	)GROUP BY Name ORDER BY Name+0'
%.geojson:~/Downloads/d/data/%.geojson
	perl -pwle '' $< > $@
clean:; rm *.kml *.csv *.geojson
#I did attempt to use gdal_grid and gdal_contour but as the streets
#aren't very logical, it didn't look good.
b:; $$BROWSER '$(和順)'