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
|
|
|
|
classvar=$2
|
|
|
|
|
|
|
|
for z in {0..15}
|
|
|
|
do
|
|
|
|
echo " "
|
2016-12-03 01:11:50 +00:00
|
|
|
echo "## $layerid z$z max length ($classvar)"
|
2016-12-02 16:44:14 +00:00
|
|
|
|
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
|
2016-12-05 00:11:39 +00:00
|
|
|
SELECT DISTINCT $classvar , length( $classvar ) AS _length_ from
|
2016-12-15 11:59:59 +00:00
|
|
|
( $SQL ) as t
|
2016-12-04 18:07:03 +00:00
|
|
|
WHERE length( $classvar ) > 0
|
2016-12-05 00:11:39 +00:00
|
|
|
ORDER BY length( $classvar ) DESC NULLS LAST
|
2016-12-04 18:07:03 +00:00
|
|
|
LIMIT 30
|
|
|
|
;
|
|
|
|
END
|
|
|
|
)
|
2016-12-02 16:44:14 +00:00
|
|
|
|
2016-12-04 18:07:03 +00:00
|
|
|
#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" \
|
2016-12-04 18:07:03 +00:00
|
|
|
| sed '1d;$d' | sed '$d' | sed 's/+--/|--/g' | sed 's/--+/--|/g'
|
|
|
|
|
2016-12-02 16:44:14 +00:00
|
|
|
done
|
|
|
|
|