things
things

--- a/results/.gitignore
+++ b/results/.gitignore
@@ -1,2 +1,3 @@
 rivers.html
+*.html
 

--- /dev/null
+++ b/results/index.html
@@ -1,1 +1,16 @@
+<!DOCTYPE html>
+<html>
+	<!-- vim: set ts=4 sw=4 noet: -->
+	<head>
+		<title>OSM QA tools</title>
+		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+	</head>
+	<body>
+		<ul>
+			<li><a href="nc_lakes.html">Non closed lakes</a></li>
+			<li><a href="rivers.html">Rivers going up instead of down</a></li>
+		</ul>
+	</body>
+</html>
 
+

--- /dev/null
+++ b/rivers_QA/export_all_rivers.sh
@@ -1,1 +1,56 @@
+#!/bin/bash
 
+
+OSM_BIN=/media/ssd/osm-3s_v0.7.52/bin
+BULKUTILS=../bulkupload
+
+
+ODIR=out/
+
+
+echo "Will generate relations"
+echo "TODO: parallelize the thing"
+mkdir $ODIR/
+rm -rf $ODIR/*
+#rm -rf $ODIROSC/*
+
+YFROM=36
+YTO=70
+TSTEP=2
+for Y in `seq $YFROM $TSTEP $YTO`; do
+	for X in `seq -180 $TSTEP 180`; do
+		X1=$X
+		Y1=$Y
+		X2=$(($X+$TSTEP))
+		Y2=$(($Y+$TSTEP))
+		BOX="($Y1, $X1, $Y2, $X2)"
+		FNAME='rel_'$X1'_'$Y1'_'$X2'_'$Y2
+
+		EXNAME=$ODIR/$FNAME.osm
+		FIXNAME=$ODIR/corr_$FNAME.osm
+		OSCTMP=$ODIR/corr_$FNAME.osc
+		echo $FNAME
+#		[timeout:3600]
+#		[maxsize:6073741824];
+		$OSM_BIN/osm3s_query > $EXNAME 2>/dev/null << EOF
+		(
+			way[waterway~"river|stream|canal|drain|ditch"]
+			$BOX;
+		);
+		out meta;
+		>;
+		out meta;
+EOF
+		fsize=$(wc -c <"$EXNAME")
+		if [ $fsize -gt 251 ]; then
+			./check_river.sh $EXNAME >> errors.csv
+		else
+			rm $EXNAME
+		fi
+	done
+	cat errors.csv | sort -h | uniq > uniq_errors.csv
+	./generate_html.sh
+	echo "Progress: $Y/$YTO"
+done
+
+

--- /dev/null
+++ b/rivers_QA/update_river.sh
@@ -1,1 +1,20 @@
+#!/bin/bash
+riverid=$1
+echo my riverid is $riverid
 
+OSM_BIN=/media/ssd/osm-3s_v0.7.52/bin
+ODIR=out/
+OFILE=updated.csv
+
+EXNAME=$ODIR$riverid.osm
+echo $EXNAME
+$OSM_BIN/osm3s_query > $EXNAME 2>/dev/null << EOF
+way($riverid);
+out meta;
+>;
+out meta;
+EOF
+python3 check_river.py $EXNAME >> $OFILE
+rm $EXNAME
+
+

--- /dev/null
+++ b/rivers_QA/update_rivers.sh
@@ -1,1 +1,27 @@
+#!/bin/bash
 
+
+IFILE=errors.csv
+OFILE=updated.csv
+
+> $OFILE
+
+#for line in `cat $IFILE | sort -h | uniq`; do
+#	river_way=$(echo $line | cut -d, -f1)
+#	EXNAME=$ODIR$river_way.osm
+#	echo $EXNAME
+#	$OSM_BIN/osm3s_query > $EXNAME 2>/dev/null << EOF
+#	way($river_way);
+#	out meta;
+#	>;
+#	out meta;
+#EOF
+##	cat $EXNAME
+#	python3 check_river.py $EXNAME >> $OFILE
+#	rm $EXNAME
+#done
+
+cat $IFILE | sort -h | uniq | cut -d, -f1 | parallel ./update_river.sh
+
+exit
+