File: osmcoastline_readmeta

package info (click to toggle)
osmcoastline 2.2.4-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 772 kB
  • sloc: cpp: 2,706; sh: 577; sql: 199; makefile: 13
file content (103 lines) | stat: -rwxr-xr-x 3,673 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#!/bin/sh
#
#  osmcoastline_readmeta [COASTLINEDB]
#

OSMCOASTLINE_VERSION=@OSMCOASTLINE_VERSION@

SQLEXEC="sqlite3"

if [ "x$1" = "x--help" -o "x$1" = "x-h" ]; then
    echo "Usage: osmcoastline_readmeta [COASTLINEDB]"
    exit 0
fi

if [ "x$1" = "x--version" -o "x$1" = "x-V" ]; then
    echo "osmcoastline_readmeta version $OSMCOASTLINE_VERSION"
    echo "Copyright (C) 2012-2019  Jochen Topf <jochen@topf.org>"
    echo "License: GNU GENERAL PUBLIC LICENSE Version 3 <https://gnu.org/licenses/gpl.html>."
    echo "This is free software: you are free to change and redistribute it."
    echo "There is NO WARRANTY, to the extent permitted by law.";
    exit 0
fi

if [ "x$1" = "x" ]; then
    DBFILE=testdata.db
else
    DBFILE=$1
fi

if [ ! -e $DBFILE ]; then
    echo "Can't open '$DBFILE'"
    exit 1
fi

echo "Options used to create this data:\n"

echo -n "  Overlap (--bbox-overlap/-b): "
$SQLEXEC $DBFILE "SELECT overlap FROM options;"

echo -n "  Close gaps in coastline smaller than (--close-distance/-c): "
$SQLEXEC $DBFILE "SELECT close_distance FROM options;"

echo -n "  Max points in polygons (--max-points/-m): "
$SQLEXEC $DBFILE "SELECT max_points_in_polygons FROM options;"

echo -n "  Split large polygons: "
$SQLEXEC $DBFILE "SELECT CASE split_large_polygons WHEN 0 THEN 'no' ELSE 'yes' END FROM options;"

echo -n "  Spatial reference system (--srid/-s): "
$SQLEXEC $DBFILE "SELECT CASE srid WHEN 4326 THEN '4326 (WGS84)' WHEN 3857 THEN '3857 (Mercator)' ELSE srid END FROM geometry_columns WHERE f_table_name='land_polygons';"

echo "\nMetadata:\n"

echo -n "  Database created at: "
$SQLEXEC $DBFILE "SELECT timestamp FROM meta;"

echo -n "  Runtime (minutes): "
$SQLEXEC $DBFILE "SELECT CAST(round(CAST(runtime AS REAL)/60) AS INT) FROM meta;"

echo -n "  Memory usage (MB): "
$SQLEXEC $DBFILE "SELECT memory_usage FROM meta;"

echo -n "  Ways tagged natural=coastline: "
$SQLEXEC $DBFILE "SELECT num_ways FROM meta;"

echo -n "  Number of nodes where coastline is not closed (before fixing): "
$SQLEXEC $DBFILE "SELECT num_unconnected_nodes FROM meta;"

echo -n "  Coastline rings: "
$SQLEXEC $DBFILE "SELECT num_rings FROM meta;"

echo -n "  Coastline rings created from a single way: "
$SQLEXEC $DBFILE "SELECT num_rings_from_single_way FROM meta;"

echo -n "  Coastline rings created from more then one way: "
$SQLEXEC $DBFILE "SELECT num_rings - num_rings_from_single_way FROM meta;"

echo -n "  Number of rings fixed (closed): "
$SQLEXEC $DBFILE "SELECT num_rings_fixed FROM meta;"

echo -n "  Number of rings turned around: "
$SQLEXEC $DBFILE "SELECT num_rings_turned_around FROM meta;"

echo -n "  Number of land polygons before split: "
$SQLEXEC $DBFILE "SELECT num_land_polygons_before_split FROM meta;"

echo -n "  Number of land polygons after split: "
$SQLEXEC $DBFILE "SELECT CASE num_land_polygons_after_split WHEN 0 THEN 'NOT SPLIT' ELSE num_land_polygons_after_split END FROM meta;"

echo "\nErrors/warnings (Points):\n"
echo ".width 3 20\nSELECT count(*), error FROM error_points GROUP BY error;" | $SQLEXEC -column $DBFILE | sed -e 's/^/  /'

echo "\nErrors/warnings (LineStrings):\n"
echo ".width 3 20\nSELECT count(*), error FROM error_lines GROUP BY error;" | $SQLEXEC -column $DBFILE | sed -e 's/^/  /'

echo "\nOutput:\n"
echo "SELECT count(*), 'land_polygons' FROM land_polygons;" | $SQLEXEC -column $DBFILE | sed -e 's/^/  /'
echo "SELECT count(*), 'water_polygons' FROM water_polygons;" | $SQLEXEC -column $DBFILE | sed -e 's/^/  /'
echo "SELECT count(*), 'lines' FROM lines;" | $SQLEXEC -column $DBFILE | sed -e 's/^/  /'
echo "SELECT count(*), 'rings' FROM rings;" | $SQLEXEC -column $DBFILE | sed -e 's/^/  /'

echo