2016-12-02 16:44:14 +00:00
|
|
|
#!/bin/bash
|
2016-12-04 00:37:28 +00:00
|
|
|
set -o errexit
|
|
|
|
set -o pipefail
|
|
|
|
set -o nounset
|
2016-12-02 16:44:14 +00:00
|
|
|
|
|
|
|
layerid=$1
|
|
|
|
var=$2
|
|
|
|
|
|
|
|
echo "# NUMVAR-ANALYZE - $layerid - $var "
|
|
|
|
|
|
|
|
for z in {0..15}
|
|
|
|
do
|
|
|
|
echo " "
|
|
|
|
echo "## $layerid z$z - $var "
|
|
|
|
|
2016-12-15 11:59:59 +00:00
|
|
|
SQL=$(docker run --rm -v $(pwd):/tileset openmaptiles/openmaptiles-tools generate-sqlquery layers/${layerid}/${layerid}.yaml $z )
|
2016-12-02 16:44:14 +00:00
|
|
|
|
2016-12-04 18:07:03 +00:00
|
|
|
SQLCODE=$(cat <<-END
|
|
|
|
SELECT
|
|
|
|
count($var) as count
|
|
|
|
,min($var) as min
|
|
|
|
,max($var) as max
|
|
|
|
,avg($var) as avg
|
|
|
|
,stddev($var) as stddev
|
|
|
|
,variance($var) as variance
|
|
|
|
FROM
|
2016-12-15 11:59:59 +00:00
|
|
|
( $SQL ) as t
|
2016-12-04 18:07:03 +00:00
|
|
|
;
|
|
|
|
END
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
#echo "\`\`\`sql"
|
2016-12-03 01:11:50 +00:00
|
|
|
#echo "$SQLCODE"
|
|
|
|
#echo "\`\`\`"
|
2016-12-02 16:44:14 +00:00
|
|
|
|
|
|
|
docker-compose run --rm import-osm /usr/src/app/psql.sh -q -P pager=off -P border=2 -P footer=off -P null='(null)' -c "$SQLCODE" \
|
|
|
|
| sed '1d;$d' | sed '$d' | sed 's/+--/|--/g' | sed 's/--+/--|/g'
|
|
|
|
|
|
|
|
done
|