diff --git a/.gitignore b/.gitignore
index e15acc928..89ad16365 100644
--- a/.gitignore
+++ b/.gitignore
@@ -26,6 +26,7 @@ basemap/cache_*/
basemap/local.*
basemap/tiles.mbtiles
basemap/tiles/
+basemap/cache/
# Examples
examples/ip-to-location/archives/
diff --git a/.run/basemap-serve.run.xml b/.run/basemap-serve.run.xml
index a0e90fa38..d0a486ac1 100644
--- a/.run/basemap-serve.run.xml
+++ b/.run/basemap-serve.run.xml
@@ -2,7 +2,7 @@
-
+
diff --git a/baremaps-cli/src/main/java/org/apache/baremaps/cli/database/ImportOsm.java b/baremaps-cli/src/main/java/org/apache/baremaps/cli/database/ImportOsm.java
index e0a7ccc1d..a4e3ff69a 100644
--- a/baremaps-cli/src/main/java/org/apache/baremaps/cli/database/ImportOsm.java
+++ b/baremaps-cli/src/main/java/org/apache/baremaps/cli/database/ImportOsm.java
@@ -18,7 +18,6 @@
package org.apache.baremaps.cli.database;
-
import java.nio.file.Path;
import java.util.concurrent.Callable;
import org.apache.baremaps.cli.Options;
@@ -55,6 +54,7 @@ public Integer call() throws Exception {
file.toAbsolutePath(),
database,
srid,
+ true,
true).execute(new WorkflowContext());
return 0;
}
diff --git a/baremaps-core/src/main/java/org/apache/baremaps/tasks/ImportOsmPbf.java b/baremaps-core/src/main/java/org/apache/baremaps/tasks/ImportOsmPbf.java
index bc4e966f3..1545916d1 100644
--- a/baremaps-core/src/main/java/org/apache/baremaps/tasks/ImportOsmPbf.java
+++ b/baremaps-core/src/main/java/org/apache/baremaps/tasks/ImportOsmPbf.java
@@ -44,6 +44,7 @@ public class ImportOsmPbf implements Task {
private Object database;
private Integer databaseSrid;
private Boolean replaceExisting;
+ private Boolean truncateTables;
/**
* Constructs a {@code ImportOsmPbf}.
@@ -61,11 +62,12 @@ public ImportOsmPbf() {
* @param replaceExisting whether to replace the existing tables
*/
public ImportOsmPbf(Path file, Object database,
- Integer databaseSrid, Boolean replaceExisting) {
+ Integer databaseSrid, Boolean replaceExisting, Boolean truncateTables) {
this.file = file;
this.database = database;
this.databaseSrid = databaseSrid;
this.replaceExisting = replaceExisting;
+ this.truncateTables = truncateTables;
}
/**
@@ -82,8 +84,8 @@ public void execute(WorkflowContext context) throws Exception {
var wayRepository = new WayRepository(datasource);
var relationRepository = new RelationRepository(datasource);
+ // Drop the existing tables
if (TRUE.equals(replaceExisting)) {
- // Drop the existing tables
headerRepository.drop();
nodeRepository.drop();
wayRepository.drop();
@@ -96,6 +98,14 @@ public void execute(WorkflowContext context) throws Exception {
relationRepository.create();
}
+ // Truncate the existing tables
+ if (TRUE.equals(truncateTables)) {
+ headerRepository.truncate();
+ nodeRepository.truncate();
+ wayRepository.truncate();
+ relationRepository.truncate();
+ }
+
var coordinateMap = context.getCoordinateMap();
var referenceMap = context.getReferenceMap();
diff --git a/baremaps-core/src/test/java/org/apache/baremaps/workflow/ObjectMapperTest.java b/baremaps-core/src/test/java/org/apache/baremaps/workflow/ObjectMapperTest.java
index 0ce907c07..672210a24 100644
--- a/baremaps-core/src/test/java/org/apache/baremaps/workflow/ObjectMapperTest.java
+++ b/baremaps-core/src/test/java/org/apache/baremaps/workflow/ObjectMapperTest.java
@@ -43,7 +43,7 @@ public void test() throws IOException {
new Step("import", List.of("download"),
List.of(new ImportOsmPbf(Paths.get("liechtenstein-latest.osm.pbf"),
"jdbc:postgresql://localhost:5432/baremaps?&user=baremaps&password=baremaps",
- 3857, true)))));
+ 3857, true, true)))));
var json = mapper.writeValueAsString(workflow1);
assertTrue(json.contains(DownloadUrl.class.getSimpleName()));
assertTrue(json.contains(ImportOsmPbf.class.getSimpleName()));
diff --git a/baremaps-core/src/test/java/org/apache/baremaps/workflow/WorkflowTest.java b/baremaps-core/src/test/java/org/apache/baremaps/workflow/WorkflowTest.java
index 4bcd44d39..849b36a0d 100644
--- a/baremaps-core/src/test/java/org/apache/baremaps/workflow/WorkflowTest.java
+++ b/baremaps-core/src/test/java/org/apache/baremaps/workflow/WorkflowTest.java
@@ -103,7 +103,7 @@ void execute() {
new Step("import-osmpbf", List.of("fetch-osmpbf"),
List.of(new ImportOsmPbf(Paths.get("downloads/liechtenstein.osm.pbf"),
jdbcUrl(),
- 3857, true))),
+ 3857, true, true))),
new Step("fetch-shapefile", List.of(), List.of(new DownloadUrl(
"https://osmdata.openstreetmap.de/download/simplified-water-polygons-split-3857.zip",
Paths.get("downloads/simplified-water-polygons-split-3857.zip"), false))),
diff --git a/baremaps-postgres/src/main/java/org/apache/baremaps/postgres/openstreetmap/CoordinateMap.java b/baremaps-postgres/src/main/java/org/apache/baremaps/postgres/openstreetmap/CoordinateMap.java
index 820434673..56a76c327 100644
--- a/baremaps-postgres/src/main/java/org/apache/baremaps/postgres/openstreetmap/CoordinateMap.java
+++ b/baremaps-postgres/src/main/java/org/apache/baremaps/postgres/openstreetmap/CoordinateMap.java
@@ -53,7 +53,7 @@ public class CoordinateMap extends PostgresMap {
* Constructs a {@link CoordinateMap}.
*/
public CoordinateMap(DataSource dataSource) {
- this(dataSource, "public", "osm_nodes");
+ this(dataSource, "public", "osm_node");
}
/**
diff --git a/baremaps-postgres/src/main/java/org/apache/baremaps/postgres/openstreetmap/HeaderRepository.java b/baremaps-postgres/src/main/java/org/apache/baremaps/postgres/openstreetmap/HeaderRepository.java
index eada38ef7..6b569c428 100644
--- a/baremaps-postgres/src/main/java/org/apache/baremaps/postgres/openstreetmap/HeaderRepository.java
+++ b/baremaps-postgres/src/main/java/org/apache/baremaps/postgres/openstreetmap/HeaderRepository.java
@@ -67,7 +67,7 @@ public HeaderRepository(DataSource dataSource) {
this(
dataSource,
"public",
- "osm_headers",
+ "osm_header",
"replication_sequence_number",
"replication_timestamp",
"replication_url",
diff --git a/baremaps-postgres/src/main/java/org/apache/baremaps/postgres/openstreetmap/NodeRepository.java b/baremaps-postgres/src/main/java/org/apache/baremaps/postgres/openstreetmap/NodeRepository.java
index 613ec8053..4525f3f33 100644
--- a/baremaps-postgres/src/main/java/org/apache/baremaps/postgres/openstreetmap/NodeRepository.java
+++ b/baremaps-postgres/src/main/java/org/apache/baremaps/postgres/openstreetmap/NodeRepository.java
@@ -74,7 +74,7 @@ public NodeRepository(DataSource dataSource) {
this(
dataSource,
"public",
- "osm_nodes",
+ "osm_node",
"id",
"version",
"uid",
diff --git a/baremaps-postgres/src/main/java/org/apache/baremaps/postgres/openstreetmap/ReferenceMap.java b/baremaps-postgres/src/main/java/org/apache/baremaps/postgres/openstreetmap/ReferenceMap.java
index 406fe026d..93d333948 100644
--- a/baremaps-postgres/src/main/java/org/apache/baremaps/postgres/openstreetmap/ReferenceMap.java
+++ b/baremaps-postgres/src/main/java/org/apache/baremaps/postgres/openstreetmap/ReferenceMap.java
@@ -55,7 +55,7 @@ public class ReferenceMap extends PostgresMap> {
* Constructs a {@code PostgresReferenceMap}.
*/
public ReferenceMap(DataSource dataSource) {
- this(dataSource, "public", "osm_ways");
+ this(dataSource, "public", "osm_way");
}
/**
diff --git a/baremaps-postgres/src/main/java/org/apache/baremaps/postgres/openstreetmap/RelationRepository.java b/baremaps-postgres/src/main/java/org/apache/baremaps/postgres/openstreetmap/RelationRepository.java
index 362dc7a47..8b0c140f6 100644
--- a/baremaps-postgres/src/main/java/org/apache/baremaps/postgres/openstreetmap/RelationRepository.java
+++ b/baremaps-postgres/src/main/java/org/apache/baremaps/postgres/openstreetmap/RelationRepository.java
@@ -68,7 +68,7 @@ public RelationRepository(DataSource dataSource) {
this(
dataSource,
"public",
- "osm_relations",
+ "osm_relation",
"id",
"version",
"uid",
diff --git a/baremaps-postgres/src/main/java/org/apache/baremaps/postgres/openstreetmap/WayRepository.java b/baremaps-postgres/src/main/java/org/apache/baremaps/postgres/openstreetmap/WayRepository.java
index 754660d4d..d573dc9ca 100644
--- a/baremaps-postgres/src/main/java/org/apache/baremaps/postgres/openstreetmap/WayRepository.java
+++ b/baremaps-postgres/src/main/java/org/apache/baremaps/postgres/openstreetmap/WayRepository.java
@@ -76,7 +76,7 @@ public class WayRepository implements Repository {
public WayRepository(DataSource dataSource) {
this(dataSource,
"public",
- "osm_ways",
+ "osm_way",
"id",
"version",
"uid",
diff --git a/baremaps-postgres/src/main/java/org/apache/baremaps/postgres/store/PostgresDataStore.java b/baremaps-postgres/src/main/java/org/apache/baremaps/postgres/store/PostgresDataStore.java
index 4b5de4d0d..3e1170eaf 100644
--- a/baremaps-postgres/src/main/java/org/apache/baremaps/postgres/store/PostgresDataStore.java
+++ b/baremaps-postgres/src/main/java/org/apache/baremaps/postgres/store/PostgresDataStore.java
@@ -121,13 +121,6 @@ public void add(String name, DataTable table) {
var schema = new DataSchemaImpl(name, properties);
- // Drop the table if it exists
- var dropQuery = dropTable(schema);
- logger.debug(dropQuery);
- try (var dropStatement = connection.prepareStatement(dropQuery)) {
- dropStatement.execute();
- }
-
// Create the table
var createQuery = createTable(schema);
logger.debug(createQuery);
@@ -135,6 +128,13 @@ public void add(String name, DataTable table) {
createStatement.execute();
}
+ // Truncate the table
+ var truncateQuery = truncateTable(schema);
+ logger.debug(truncateQuery);
+ try (var truncateStatement = connection.prepareStatement(truncateQuery)) {
+ truncateStatement.execute();
+ }
+
// Copy the data
var pgConnection = connection.unwrap(PGConnection.class);
var copyQuery = copy(schema);
@@ -206,6 +206,16 @@ protected String dropTable(DataSchema schema) {
return String.format("DROP TABLE IF EXISTS \"%s\" CASCADE", schema.name());
}
+ /**
+ * Generate a truncate table query.
+ *
+ * @param schema the schema
+ * @return the query
+ */
+ protected String truncateTable(DataSchema schema) {
+ return String.format("TRUNCATE TABLE \"%s\" CASCADE", schema.name());
+ }
+
/**
* Generate a create table query.
*
@@ -214,7 +224,7 @@ protected String dropTable(DataSchema schema) {
*/
protected String createTable(DataSchema schema) {
StringBuilder builder = new StringBuilder();
- builder.append("CREATE TABLE \"");
+ builder.append("CREATE TABLE IF NOT EXISTS \"");
builder.append(schema.name());
builder.append("\" (");
builder.append(schema.columns().stream()
diff --git a/baremaps-postgres/src/test/java/org/apache/baremaps/postgres/metadata/PostgresMetadataTest.java b/baremaps-postgres/src/test/java/org/apache/baremaps/postgres/metadata/PostgresMetadataTest.java
index e3edee1f0..ce027a9cb 100644
--- a/baremaps-postgres/src/test/java/org/apache/baremaps/postgres/metadata/PostgresMetadataTest.java
+++ b/baremaps-postgres/src/test/java/org/apache/baremaps/postgres/metadata/PostgresMetadataTest.java
@@ -40,10 +40,10 @@ void resetDatabase() throws SQLException, IOException {
PostgresUtils.executeResource(connection, "queries/osm_drop_tables.sql");
PostgresUtils.executeResource(connection, "queries/osm_drop_tables.sql");
PostgresUtils.executeResource(connection, "queries/osm_create_tables.sql");
- assertTrue(tableExists("osm_headers"));
- assertTrue(tableExists("osm_nodes"));
- assertTrue(tableExists("osm_ways"));
- assertTrue(tableExists("osm_relations"));
+ assertTrue(tableExists("osm_header"));
+ assertTrue(tableExists("osm_node"));
+ assertTrue(tableExists("osm_way"));
+ assertTrue(tableExists("osm_relation"));
}
}
diff --git a/baremaps-postgres/src/test/resources/queries/hello-world.sql b/baremaps-postgres/src/test/resources/queries/hello-world.sql
index 73b3ad719..705a823e2 100644
--- a/baremaps-postgres/src/test/resources/queries/hello-world.sql
+++ b/baremaps-postgres/src/test/resources/queries/hello-world.sql
@@ -13,8 +13,5 @@
-- See the License for the specific language governing permissions and
-- limitations under the License.
-DO $$
- BEGIN
- PERFORM 'Hello, World!';
- END
-$$;
\ No newline at end of file
+DO $$ BEGIN PERFORM 'Hello, World!';
+END $$;
\ No newline at end of file
diff --git a/baremaps-postgres/src/test/resources/queries/osm_create_extensions.sql b/baremaps-postgres/src/test/resources/queries/osm_create_extensions.sql
index 832ea3021..b30919bde 100644
--- a/baremaps-postgres/src/test/resources/queries/osm_create_extensions.sql
+++ b/baremaps-postgres/src/test/resources/queries/osm_create_extensions.sql
@@ -12,5 +12,8 @@
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-CREATE EXTENSION IF NOT EXISTS hstore;
-CREATE EXTENSION IF NOT EXISTS postgis;
+CREATE
+ EXTENSION IF NOT EXISTS hstore;
+
+CREATE
+ EXTENSION IF NOT EXISTS postgis;
diff --git a/baremaps-postgres/src/test/resources/queries/osm_create_gin_indexes.sql b/baremaps-postgres/src/test/resources/queries/osm_create_gin_indexes.sql
index 940c47c26..90683ad70 100644
--- a/baremaps-postgres/src/test/resources/queries/osm_create_gin_indexes.sql
+++ b/baremaps-postgres/src/test/resources/queries/osm_create_gin_indexes.sql
@@ -12,5 +12,12 @@
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-CREATE INDEX CONCURRENTLY IF NOT EXISTS osm_ways_gin ON osm_ways USING gin (nodes);
-CREATE INDEX CONCURRENTLY IF NOT EXISTS osm_relations_gin ON osm_relations USING gin (member_refs);
+CREATE
+ INDEX IF NOT EXISTS osm_way_gin ON
+ osm_way
+ USING gin(nodes);
+
+CREATE
+ INDEX IF NOT EXISTS osm_relation_gin ON
+ osm_relation
+ USING gin(member_refs);
diff --git a/baremaps-postgres/src/test/resources/queries/osm_create_gist_indexes.sql b/baremaps-postgres/src/test/resources/queries/osm_create_gist_indexes.sql
index 3097e3779..03249ab6a 100644
--- a/baremaps-postgres/src/test/resources/queries/osm_create_gist_indexes.sql
+++ b/baremaps-postgres/src/test/resources/queries/osm_create_gist_indexes.sql
@@ -12,6 +12,17 @@
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-CREATE INDEX CONCURRENTLY IF NOT EXISTS osm_nodes_gix ON osm_nodes USING GIST (geom);
-CREATE INDEX CONCURRENTLY IF NOT EXISTS osm_ways_gix ON osm_ways USING GIST (geom);
-CREATE INDEX CONCURRENTLY IF NOT EXISTS osm_relations_gix ON osm_relations USING GIST (geom);
\ No newline at end of file
+CREATE
+ INDEX IF NOT EXISTS osm_node_gix ON
+ osm_node
+ USING GIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_way_gix ON
+ osm_way
+ USING GIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_relation_gix ON
+ osm_relation
+ USING GIST(geom);
\ No newline at end of file
diff --git a/baremaps-postgres/src/test/resources/queries/osm_create_spgist_indexes.sql b/baremaps-postgres/src/test/resources/queries/osm_create_spgist_indexes.sql
index e86ae44e0..0d03af7e3 100644
--- a/baremaps-postgres/src/test/resources/queries/osm_create_spgist_indexes.sql
+++ b/baremaps-postgres/src/test/resources/queries/osm_create_spgist_indexes.sql
@@ -12,6 +12,17 @@
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-CREATE INDEX CONCURRENTLY IF NOT EXISTS osm_nodes_gix ON osm_nodes USING SPGIST (geom);
-CREATE INDEX CONCURRENTLY IF NOT EXISTS osm_ways_gix ON osm_ways USING SPGIST (geom);
-CREATE INDEX CONCURRENTLY IF NOT EXISTS osm_relations_gix ON osm_relations USING SPGIST (geom);
\ No newline at end of file
+CREATE
+ INDEX IF NOT EXISTS osm_node_gix ON
+ osm_node
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_way_gix ON
+ osm_way
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_relation_gix ON
+ osm_relation
+ USING SPGIST(geom);
\ No newline at end of file
diff --git a/baremaps-postgres/src/test/resources/queries/osm_create_tables.sql b/baremaps-postgres/src/test/resources/queries/osm_create_tables.sql
index c39d6fb60..e783afd7f 100644
--- a/baremaps-postgres/src/test/resources/queries/osm_create_tables.sql
+++ b/baremaps-postgres/src/test/resources/queries/osm_create_tables.sql
@@ -12,47 +12,54 @@
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-CREATE TABLE IF NOT EXISTS osm_headers
-(
- replication_sequence_number bigint PRIMARY KEY,
- replication_timestamp timestamp without time zone,
- replication_url text,
- source text,
- writing_program text
-);
-CREATE TABLE osm_nodes
-(
- id bigint PRIMARY KEY,
- version int,
- uid int,
- timestamp timestamp without time zone,
- changeset bigint,
- tags jsonb,
- lon float,
- lat float,
- geom geometry(point)
-);
-CREATE TABLE osm_ways
-(
- id bigint PRIMARY KEY,
- version int,
- uid int,
- timestamp timestamp without time zone,
- changeset bigint,
- tags jsonb,
- nodes bigint[],
- geom geometry
-);
-CREATE TABLE osm_relations
-(
- id bigint PRIMARY KEY,
- version int,
- uid int,
- timestamp timestamp without time zone,
- changeset bigint,
- tags jsonb,
- member_refs bigint[],
- member_types int[],
- member_roles text[],
- geom geometry
-);
\ No newline at end of file
+CREATE
+ TABLE
+ IF NOT EXISTS osm_header(
+ replication_sequence_number BIGINT PRIMARY KEY,
+ replication_timestamp TIMESTAMP WITHOUT TIME ZONE,
+ replication_url text,
+ SOURCE text,
+ writing_program text
+ );
+
+CREATE
+ TABLE
+ osm_node(
+ id BIGINT PRIMARY KEY,
+ version INT,
+ uid INT,
+ TIMESTAMP TIMESTAMP WITHOUT TIME ZONE,
+ changeset BIGINT,
+ tags jsonb,
+ lon FLOAT,
+ lat FLOAT,
+ geom geometry(point)
+ );
+
+CREATE
+ TABLE
+ osm_way(
+ id BIGINT PRIMARY KEY,
+ version INT,
+ uid INT,
+ TIMESTAMP TIMESTAMP WITHOUT TIME ZONE,
+ changeset BIGINT,
+ tags jsonb,
+ nodes BIGINT [],
+ geom geometry
+ );
+
+CREATE
+ TABLE
+ osm_relation(
+ id BIGINT PRIMARY KEY,
+ version INT,
+ uid INT,
+ TIMESTAMP TIMESTAMP WITHOUT TIME ZONE,
+ changeset BIGINT,
+ tags jsonb,
+ member_refs BIGINT [],
+ member_types INT [],
+ member_roles text [],
+ geom geometry
+ );
\ No newline at end of file
diff --git a/baremaps-postgres/src/test/resources/queries/osm_drop_tables.sql b/baremaps-postgres/src/test/resources/queries/osm_drop_tables.sql
index 30483de2a..c6d84e2ce 100644
--- a/baremaps-postgres/src/test/resources/queries/osm_drop_tables.sql
+++ b/baremaps-postgres/src/test/resources/queries/osm_drop_tables.sql
@@ -12,7 +12,18 @@
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-DROP TABLE IF EXISTS osm_headers;
-DROP TABLE IF EXISTS osm_nodes;
-DROP TABLE IF EXISTS osm_ways;
-DROP TABLE IF EXISTS osm_relations;
\ No newline at end of file
+DROP
+ TABLE
+ IF EXISTS osm_header;
+
+DROP
+ TABLE
+ IF EXISTS osm_node;
+
+DROP
+ TABLE
+ IF EXISTS osm_way;
+
+DROP
+ TABLE
+ IF EXISTS osm_relation;
\ No newline at end of file
diff --git a/baremaps-postgres/src/test/resources/queries/osm_truncate_table.sql b/baremaps-postgres/src/test/resources/queries/osm_truncate_table.sql
index 9c7bba079..d2b29453c 100644
--- a/baremaps-postgres/src/test/resources/queries/osm_truncate_table.sql
+++ b/baremaps-postgres/src/test/resources/queries/osm_truncate_table.sql
@@ -12,7 +12,15 @@
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-TRUNCATE TABLE osm_headers;
-TRUNCATE TABLE osm_nodes;
-TRUNCATE TABLE osm_ways;
-TRUNCATE TABLE osm_relations;
\ No newline at end of file
+
+TRUNCATE TABLE
+ osm_header;
+
+TRUNCATE TABLE
+ osm_node;
+
+TRUNCATE TABLE
+ osm_way;
+
+TRUNCATE TABLE
+ osm_relation;
\ No newline at end of file
diff --git a/baremaps-postgres/src/test/resources/queries/queries.sql b/baremaps-postgres/src/test/resources/queries/queries.sql
index 3e27c46cc..362af69d7 100644
--- a/baremaps-postgres/src/test/resources/queries/queries.sql
+++ b/baremaps-postgres/src/test/resources/queries/queries.sql
@@ -12,9 +12,15 @@
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-
-- simple cases
-SELECT 1;
-SELECT 2;
-SELECT 3;
-SELECT 4;
\ No newline at end of file
+SELECT
+ 1;
+
+SELECT
+ 2;
+
+SELECT
+ 3;
+
+SELECT
+ 4;
\ No newline at end of file
diff --git a/baremaps-postgres/src/test/resources/queries/schema.sql b/baremaps-postgres/src/test/resources/queries/schema.sql
index 95145c88e..ddc3e1af4 100644
--- a/baremaps-postgres/src/test/resources/queries/schema.sql
+++ b/baremaps-postgres/src/test/resources/queries/schema.sql
@@ -1,5 +1,4 @@
-- mbtiles schema
-
-- Licensed to the Apache Software Foundation (ASF) under one or more
-- contributor license agreements. See the NOTICE file distributed with
-- this work for additional information regarding copyright ownership.
@@ -14,12 +13,41 @@
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-
BEGIN;
-CREATE TABLE indexdata (name text, value text);
-CREATE TABLE tiles (zoom_level integer, tile_column integer, tile_row integer, tile_data blob);
-CREATE TABLE grids (zoom_level integer, tile_column integer, tile_row integer, grid blob);
-CREATE TABLE grid_data (zoom_level integer, tile_column integer, tile_row integer, key_name text, key_json text);
+CREATE
+ TABLE
+ indexdata(
+ name text,
+ value text
+ );
+
+CREATE
+ TABLE
+ tiles(
+ zoom_level INTEGER,
+ tile_column INTEGER,
+ tile_row INTEGER,
+ tile_data BLOB
+ );
+
+CREATE
+ TABLE
+ grids(
+ zoom_level INTEGER,
+ tile_column INTEGER,
+ tile_row INTEGER,
+ grid BLOB
+ );
+
+CREATE
+ TABLE
+ grid_data(
+ zoom_level INTEGER,
+ tile_column INTEGER,
+ tile_row INTEGER,
+ key_name text,
+ key_json text
+ );
COMMIT;
\ No newline at end of file
diff --git a/baremaps-testing/data/tilesets/tileset.json b/baremaps-testing/data/tilesets/tileset.json
index 8d0c82382..b7b16fae5 100644
--- a/baremaps-testing/data/tilesets/tileset.json
+++ b/baremaps-testing/data/tilesets/tileset.json
@@ -24,17 +24,17 @@
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'aeroway'"
+ "sql": "SELECT id, tags, geom FROM osm_node WHERE tags ? 'aeroway'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_ways WHERE tags ? 'aeroway'"
+ "sql": "SELECT id, tags, geom FROM osm_way WHERE tags ? 'aeroway'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_relations WHERE tags ? 'aeroway' AND tags ->> 'type' = 'multipolygon'"
+ "sql": "SELECT id, tags, geom FROM osm_relation WHERE tags ? 'aeroway' AND tags ->> 'type' = 'multipolygon'"
}
]
},
@@ -44,17 +44,17 @@
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'waterway'"
+ "sql": "SELECT id, tags, geom FROM osm_node WHERE tags ? 'waterway'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_ways WHERE tags ? 'waterway'"
+ "sql": "SELECT id, tags, geom FROM osm_way WHERE tags ? 'waterway'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_relations WHERE tags ? 'waterway' AND tags ->> 'type' = 'multipolygon'"
+ "sql": "SELECT id, tags, geom FROM osm_relation WHERE tags ? 'waterway' AND tags ->> 'type' = 'multipolygon'"
}
]
},
@@ -64,17 +64,17 @@
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'landuse'"
+ "sql": "SELECT id, tags, geom FROM osm_node WHERE tags ? 'landuse'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_ways WHERE tags ? 'landuse'"
+ "sql": "SELECT id, tags, geom FROM osm_way WHERE tags ? 'landuse'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_relations WHERE tags ? 'landuse' AND tags ->> 'type' = 'multipolygon'"
+ "sql": "SELECT id, tags, geom FROM osm_relation WHERE tags ? 'landuse' AND tags ->> 'type' = 'multipolygon'"
}
]
},
@@ -84,17 +84,17 @@
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'railway'"
+ "sql": "SELECT id, tags, geom FROM osm_node WHERE tags ? 'railway'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_ways WHERE tags ? 'railway'"
+ "sql": "SELECT id, tags, geom FROM osm_way WHERE tags ? 'railway'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_relations WHERE tags ? 'railway' AND tags ->> 'type' = 'multipolygon'"
+ "sql": "SELECT id, tags, geom FROM osm_relation WHERE tags ? 'railway' AND tags ->> 'type' = 'multipolygon'"
}
]
},
@@ -104,17 +104,17 @@
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'highway'"
+ "sql": "SELECT id, tags, geom FROM osm_node WHERE tags ? 'highway'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_ways WHERE tags ? 'highway'"
+ "sql": "SELECT id, tags, geom FROM osm_way WHERE tags ? 'highway'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_relations WHERE tags ? 'highway' AND tags ->> 'type' = 'multipolygon'"
+ "sql": "SELECT id, tags, geom FROM osm_relation WHERE tags ? 'highway' AND tags ->> 'type' = 'multipolygon'"
}
]
},
@@ -124,17 +124,17 @@
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'public_transport'"
+ "sql": "SELECT id, tags, geom FROM osm_node WHERE tags ? 'public_transport'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_ways WHERE tags ? 'public_transport'"
+ "sql": "SELECT id, tags, geom FROM osm_way WHERE tags ? 'public_transport'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_relations WHERE tags ? 'public_transport' AND tags ->> 'type' = 'multipolygon'"
+ "sql": "SELECT id, tags, geom FROM osm_relation WHERE tags ? 'public_transport' AND tags ->> 'type' = 'multipolygon'"
}
]
},
@@ -144,17 +144,17 @@
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'aerialway'"
+ "sql": "SELECT id, tags, geom FROM osm_node WHERE tags ? 'aerialway'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_ways WHERE tags ? 'aerialway'"
+ "sql": "SELECT id, tags, geom FROM osm_way WHERE tags ? 'aerialway'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_relations WHERE tags ? 'aerialway' AND tags ->> 'type' = 'multipolygon'"
+ "sql": "SELECT id, tags, geom FROM osm_relation WHERE tags ? 'aerialway' AND tags ->> 'type' = 'multipolygon'"
}
]
},
@@ -164,17 +164,17 @@
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'geological'"
+ "sql": "SELECT id, tags, geom FROM osm_node WHERE tags ? 'geological'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_ways WHERE tags ? 'geological'"
+ "sql": "SELECT id, tags, geom FROM osm_way WHERE tags ? 'geological'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_relations WHERE tags ? 'geological' AND tags ->> 'type' = 'multipolygon'"
+ "sql": "SELECT id, tags, geom FROM osm_relation WHERE tags ? 'geological' AND tags ->> 'type' = 'multipolygon'"
}
]
},
@@ -184,17 +184,17 @@
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'building'"
+ "sql": "SELECT id, tags, geom FROM osm_node WHERE tags ? 'building'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_ways WHERE tags ? 'building'"
+ "sql": "SELECT id, tags, geom FROM osm_way WHERE tags ? 'building'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_relations WHERE tags ? 'building' AND tags ->> 'type' = 'multipolygon'"
+ "sql": "SELECT id, tags, geom FROM osm_relation WHERE tags ? 'building' AND tags ->> 'type' = 'multipolygon'"
}
]
},
@@ -204,17 +204,17 @@
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'amenity'"
+ "sql": "SELECT id, tags, geom FROM osm_node WHERE tags ? 'amenity'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_ways WHERE tags ? 'amenity'"
+ "sql": "SELECT id, tags, geom FROM osm_way WHERE tags ? 'amenity'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_relations WHERE tags ? 'amenity' AND tags ->> 'type' = 'multipolygon'"
+ "sql": "SELECT id, tags, geom FROM osm_relation WHERE tags ? 'amenity' AND tags ->> 'type' = 'multipolygon'"
}
]
},
@@ -224,17 +224,17 @@
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'craft'"
+ "sql": "SELECT id, tags, geom FROM osm_node WHERE tags ? 'craft'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_ways WHERE tags ? 'craft'"
+ "sql": "SELECT id, tags, geom FROM osm_way WHERE tags ? 'craft'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_relations WHERE tags ? 'craft' AND tags ->> 'type' = 'multipolygon'"
+ "sql": "SELECT id, tags, geom FROM osm_relation WHERE tags ? 'craft' AND tags ->> 'type' = 'multipolygon'"
}
]
},
@@ -244,17 +244,17 @@
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'emergency'"
+ "sql": "SELECT id, tags, geom FROM osm_node WHERE tags ? 'emergency'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_ways WHERE tags ? 'emergency'"
+ "sql": "SELECT id, tags, geom FROM osm_way WHERE tags ? 'emergency'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_relations WHERE tags ? 'emergency' AND tags ->> 'type' = 'multipolygon'"
+ "sql": "SELECT id, tags, geom FROM osm_relation WHERE tags ? 'emergency' AND tags ->> 'type' = 'multipolygon'"
}
]
},
@@ -264,17 +264,17 @@
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'historic'"
+ "sql": "SELECT id, tags, geom FROM osm_node WHERE tags ? 'historic'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_ways WHERE tags ? 'historic'"
+ "sql": "SELECT id, tags, geom FROM osm_way WHERE tags ? 'historic'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_relations WHERE tags ? 'historic' AND tags ->> 'type' = 'multipolygon'"
+ "sql": "SELECT id, tags, geom FROM osm_relation WHERE tags ? 'historic' AND tags ->> 'type' = 'multipolygon'"
}
]
},
@@ -284,17 +284,17 @@
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'leisure'"
+ "sql": "SELECT id, tags, geom FROM osm_node WHERE tags ? 'leisure'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_ways WHERE tags ? 'leisure'"
+ "sql": "SELECT id, tags, geom FROM osm_way WHERE tags ? 'leisure'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_relations WHERE tags ? 'leisure' AND tags ->> 'type' = 'multipolygon'"
+ "sql": "SELECT id, tags, geom FROM osm_relation WHERE tags ? 'leisure' AND tags ->> 'type' = 'multipolygon'"
}
]
},
@@ -304,17 +304,17 @@
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'man_made'"
+ "sql": "SELECT id, tags, geom FROM osm_node WHERE tags ? 'man_made'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_ways WHERE tags ? 'man_made'"
+ "sql": "SELECT id, tags, geom FROM osm_way WHERE tags ? 'man_made'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_relations WHERE tags ? 'man_made' AND tags ->> 'type' = 'multipolygon'"
+ "sql": "SELECT id, tags, geom FROM osm_relation WHERE tags ? 'man_made' AND tags ->> 'type' = 'multipolygon'"
}
]
},
@@ -324,17 +324,17 @@
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'military'"
+ "sql": "SELECT id, tags, geom FROM osm_node WHERE tags ? 'military'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_ways WHERE tags ? 'military'"
+ "sql": "SELECT id, tags, geom FROM osm_way WHERE tags ? 'military'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_relations WHERE tags ? 'military' AND tags ->> 'type' = 'multipolygon'"
+ "sql": "SELECT id, tags, geom FROM osm_relation WHERE tags ? 'military' AND tags ->> 'type' = 'multipolygon'"
}
]
},
@@ -344,17 +344,17 @@
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'natural'"
+ "sql": "SELECT id, tags, geom FROM osm_node WHERE tags ? 'natural'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_ways WHERE tags ? 'natural'"
+ "sql": "SELECT id, tags, geom FROM osm_way WHERE tags ? 'natural'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_relations WHERE tags ? 'natural' AND tags ->> 'type' = 'multipolygon'"
+ "sql": "SELECT id, tags, geom FROM osm_relation WHERE tags ? 'natural' AND tags ->> 'type' = 'multipolygon'"
}
]
},
@@ -364,17 +364,17 @@
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'office'"
+ "sql": "SELECT id, tags, geom FROM osm_node WHERE tags ? 'office'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_ways WHERE tags ? 'office'"
+ "sql": "SELECT id, tags, geom FROM osm_way WHERE tags ? 'office'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_relations WHERE tags ? 'office' AND tags ->> 'type' = 'multipolygon'"
+ "sql": "SELECT id, tags, geom FROM osm_relation WHERE tags ? 'office' AND tags ->> 'type' = 'multipolygon'"
}
]
},
@@ -384,17 +384,17 @@
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'place'"
+ "sql": "SELECT id, tags, geom FROM osm_node WHERE tags ? 'place'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_ways WHERE tags ? 'place'"
+ "sql": "SELECT id, tags, geom FROM osm_way WHERE tags ? 'place'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_relations WHERE tags ? 'place' AND tags ->> 'type' = 'multipolygon'"
+ "sql": "SELECT id, tags, geom FROM osm_relation WHERE tags ? 'place' AND tags ->> 'type' = 'multipolygon'"
}
]
},
@@ -404,17 +404,17 @@
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'power'"
+ "sql": "SELECT id, tags, geom FROM osm_node WHERE tags ? 'power'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_ways WHERE tags ? 'power'"
+ "sql": "SELECT id, tags, geom FROM osm_way WHERE tags ? 'power'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_relations WHERE tags ? 'power' AND tags ->> 'type' = 'multipolygon'"
+ "sql": "SELECT id, tags, geom FROM osm_relation WHERE tags ? 'power' AND tags ->> 'type' = 'multipolygon'"
}
]
},
@@ -424,17 +424,17 @@
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'route'"
+ "sql": "SELECT id, tags, geom FROM osm_node WHERE tags ? 'route'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_ways WHERE tags ? 'route'"
+ "sql": "SELECT id, tags, geom FROM osm_way WHERE tags ? 'route'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_relations WHERE tags ? 'route' AND tags ->> 'type' = 'multipolygon'"
+ "sql": "SELECT id, tags, geom FROM osm_relation WHERE tags ? 'route' AND tags ->> 'type' = 'multipolygon'"
}
]
},
@@ -444,17 +444,17 @@
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'shop'"
+ "sql": "SELECT id, tags, geom FROM osm_node WHERE tags ? 'shop'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_ways WHERE tags ? 'shop'"
+ "sql": "SELECT id, tags, geom FROM osm_way WHERE tags ? 'shop'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_relations WHERE tags ? 'shop' AND tags ->> 'type' = 'multipolygon'"
+ "sql": "SELECT id, tags, geom FROM osm_relation WHERE tags ? 'shop' AND tags ->> 'type' = 'multipolygon'"
}
]
},
@@ -464,17 +464,17 @@
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'sport'"
+ "sql": "SELECT id, tags, geom FROM osm_node WHERE tags ? 'sport'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_ways WHERE tags ? 'sport'"
+ "sql": "SELECT id, tags, geom FROM osm_way WHERE tags ? 'sport'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_relations WHERE tags ? 'sport' AND tags ->> 'type' = 'multipolygon'"
+ "sql": "SELECT id, tags, geom FROM osm_relation WHERE tags ? 'sport' AND tags ->> 'type' = 'multipolygon'"
}
]
},
@@ -484,17 +484,17 @@
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'telecom'"
+ "sql": "SELECT id, tags, geom FROM osm_node WHERE tags ? 'telecom'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_ways WHERE tags ? 'telecom'"
+ "sql": "SELECT id, tags, geom FROM osm_way WHERE tags ? 'telecom'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_relations WHERE tags ? 'telecom' AND tags ->> 'type' = 'multipolygon'"
+ "sql": "SELECT id, tags, geom FROM osm_relation WHERE tags ? 'telecom' AND tags ->> 'type' = 'multipolygon'"
}
]
},
@@ -504,17 +504,17 @@
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'tourism'"
+ "sql": "SELECT id, tags, geom FROM osm_node WHERE tags ? 'tourism'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_ways WHERE tags ? 'tourism'"
+ "sql": "SELECT id, tags, geom FROM osm_way WHERE tags ? 'tourism'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_relations WHERE tags ? 'tourism' AND tags ->> 'type' = 'multipolygon'"
+ "sql": "SELECT id, tags, geom FROM osm_relation WHERE tags ? 'tourism' AND tags ->> 'type' = 'multipolygon'"
}
]
}
diff --git a/basemap/README.md b/basemap/README.md
index f89e3f4f0..e4bb7404e 100644
--- a/basemap/README.md
+++ b/basemap/README.md
@@ -16,9 +16,7 @@ limitations under the License.
-->
# OpenStreetMap Vecto
-🚧 🚧 Work in progress 🚧 🚧
-
-This directory contains the configuration files for a general-purpose map.
+This directory contains the configuration files for a general-purpose map based on OpenStreetMap data.
It is used to generate vector tiles and to produce a Mapbox style inspired by [OpenStreetMap Carto](https://github.com/gravitystorm/openstreetmap-carto).
## Requirements
@@ -52,25 +50,39 @@ checkpoint_completion_target = 0.9
max_wal_senders = 0
```
-## Importing the data
+## Initializing the database
-Assuming that the necessary requirements have been installed, the database can be populated with the following command. The import workflow will download openstreetmap (osm.pbf) and other data sources into the database.
+Assuming that the necessary requirements have been installed, the database can be populated with the following commands.
```
+// This command creates the database schema
+baremaps workflow execute --file create.js
+
+// This command imports the data into the database
baremaps workflow execute --file import.js
+
+// This command refreshes the materialized views
+baremaps workflow execute --file refresh.js
```
-## Updating the data
+## Updating the database
-The data can periodically be updated with the following command. The update workflow will download the latest changes from OpenStreetMap (osc.xml) and apply them to the database.
+The database can periodically be updated with the following commands.
+The update workflow will download the latest changes from OpenStreetMap (osc.xml) and apply them to the database.
+Refreshing the materialized views is costly and only necessary if the low zoom levels need to be updated, therefore it is optional.
```
+// This command updates the database
baremaps workflow execute --file update.js
+
+// This command refreshes the materialized views (optional)
+baremaps workflow execute --file refresh.js
```
## Serving the tiles and the style in dev mode
The development server can be started with the following command.
+The dev mode automatically reloads the map when the configuration files are modified, which is useful for development and testing.
```
baremaps map dev --log-level DEBUG \
@@ -96,7 +108,7 @@ Simply put, it adds in the ability to describe the `vector_tiles` and their cont
{
"minzoom": 14,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_ways_z${zoom} WHERE tags ? 'aerialway'"
+ "sql": "SELECT id, tags, geom FROM osm_way_z${zoom} WHERE tags ? 'aerialway'"
}
]
}
@@ -106,8 +118,14 @@ Simply put, it adds in the ability to describe the `vector_tiles` and their cont
## Editing the style
-The configuration format used in the `line.js` file follows the [Mapbox style specification](https://github.com/mapbox/mapbox-gl-js).
-Baremaps integrates [Maputnik](https://maputnik.github.io/) and most of the modifications will take place in the browser.
+The configuration format used in the `style.js` file follows the [Mapbox style specification](https://github.com/mapbox/mapbox-gl-js).
+
+## JavaScript as a configuration language
+
+All the configuration files are written in JavaScript instead of JSON.
+This allows for more flexibility and the use of JavaScript functions to generate the configuration.
+Additionally, it allows for imports and comments, which are not supported in JSON.
+As the configuration files got bigger and more complex, this choice became more and more beneficial.
## Tools
diff --git a/basemap/create.js b/basemap/create.js
new file mode 100644
index 000000000..c2b85a335
--- /dev/null
+++ b/basemap/create.js
@@ -0,0 +1,65 @@
+/**
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ **/
+import config from "./config.js";
+
+export default {
+ "steps": [
+ {
+ "id": "openstreetmap-water-polygons",
+ "needs": [],
+ "tasks": [
+ // Initialization
+ "queries/initialize.sql",
+ "queries/functions.sql",
+
+ // OpenStreetMap
+ "layers/header/create.sql",
+ "layers/node/create.sql",
+ "layers/way/create.sql",
+ "layers/relation/create.sql",
+ "layers/member/create.sql",
+ "layers/linestring/create.sql",
+ "layers/polygon/create.sql",
+ "layers/aerialway/create.sql",
+ "layers/aeroway/create.sql",
+ "layers/amenity/create.sql",
+ "layers/attraction/create.sql",
+ "layers/barrier/create.sql",
+ "layers/boundary/create.sql",
+ "layers/building/create.sql",
+ "layers/highway/create.sql",
+ "layers/landuse/create.sql",
+ "layers/leisure/create.sql",
+ "layers/man_made/create.sql",
+ "layers/natural/create.sql",
+ "layers/point/create.sql",
+ "layers/power/create.sql",
+ "layers/railway/create.sql",
+ "layers/route/create.sql",
+ "layers/tourism/create.sql",
+ "layers/waterway/create.sql",
+ "layers/ocean/create.sql",
+ ].map(file => {
+ return {
+ "type": "ExecuteSqlScript",
+ "file": file,
+ "database": config.database,
+ }
+ })
+ },
+ ]
+}
diff --git a/basemap/import.js b/basemap/import.js
index f5490ae73..7256a535a 100644
--- a/basemap/import.js
+++ b/basemap/import.js
@@ -18,22 +18,6 @@ import config from "./config.js";
export default {
"steps": [
- {
- "id": "initialize-database",
- "needs": [],
- "tasks": [
- {
- "type": "ExecuteSqlScript",
- "file": "queries/assertions.sql",
- "database": config.database,
- },
- {
- "type": "ExecuteSqlScript",
- "file": "queries/functions.sql",
- "database": config.database,
- },
- ]
- },
{
"id": "openstreetmap-water-polygons",
"needs": [],
@@ -41,7 +25,8 @@ export default {
{
"type": "DownloadUrl",
"source": "https://osmdata.openstreetmap.de/download/water-polygons-split-3857.zip",
- "target": "data/water-polygons-split-3857.zip"
+ "target": "data/water-polygons-split-3857.zip",
+ "replaceExisting": false,
},
{
"type": "DecompressFile",
@@ -65,7 +50,8 @@ export default {
{
"type": "DownloadUrl",
"source": "https://osmdata.openstreetmap.de/download/simplified-water-polygons-split-3857.zip",
- "target": "data/simplified-water-polygons-split-3857.zip"
+ "target": "data/simplified-water-polygons-split-3857.zip",
+ "replaceExisting": false,
},
{
"type": "DecompressFile",
@@ -82,30 +68,6 @@ export default {
},
]
},
- {
- "id": "openstreetmap-ocean",
- "needs": [
- "openstreetmap-water-polygons",
- "openstreetmap-simplified-water-polygons",
- ],
- "tasks": [
- {
- "type": "ExecuteSql",
- "file": "layers/ocean/clean.sql",
- "database": config.database,
- },
- {
- "type": "ExecuteSql",
- "file": "layers/ocean/prepare.sql",
- "database": config.database,
- },
- {
- "type": "ExecuteSql",
- "file": "layers/ocean/index.sql",
- "database": config.database,
- },
- ]
- },
{
"id": "openstreetmap-data",
"needs": [],
@@ -113,352 +75,18 @@ export default {
{
"type": "DownloadUrl",
"source": config.osmPbfUrl,
- "target": "data/data.osm.pbf"
+ "target": "data/data.osm.pbf",
+ "replaceExisting": false,
},
{
"type": "ImportOsmPbf",
"file": "data/data.osm.pbf",
"database": config.database,
"databaseSrid": 3857,
- "replaceExisting": true,
- },
- {
- "type": "ExecuteSql",
- "file": "queries/osm_entities.sql",
- "database": config.database,
- "parallel": false,
- },
- ]
- },
- {
- "id": "openstreetmap-nodes",
- "needs": [
- "openstreetmap-data"
- ],
- "tasks": [
- {
- "type": "ExecuteSql",
- "file": "queries/osm_nodes.sql",
- "database": config.database,
- "parallel": true,
- },
- ]
- },
- {
- "id": "openstreetmap-ways",
- "needs": [
- "openstreetmap-data"
- ],
- "tasks": [
- {
- "type": "ExecuteSql",
- "file": "queries/osm_ways.sql",
- "database": config.database,
- "parallel": true,
- },
- ]
- },
- {
- "id": "openstreetmap-relations",
- "needs": [
- "openstreetmap-data"
- ],
- "tasks": [
- {
- "type": "ExecuteSql",
- "file": "queries/osm_relations.sql",
- "database": config.database,
- "parallel": true,
- },
- ]
- },
- {
- "id": "openstreetmap-member",
- "needs": [
- "openstreetmap-data"
- ],
- "tasks": [
- {
- "type": "ExecuteSql",
- "file": "layers/member/prepare.sql",
- "database": config.database,
- },
- ]
- },
- {
- "id": "openstreetmap-point",
- "needs": [
- "openstreetmap-nodes"
- ],
- "tasks": [
- {
- "type": "ExecuteSql",
- "file": "layers/point/clean.sql",
- "database": config.database,
- },
- {
- "type": "ExecuteSql",
- "file": "layers/point/simplify.sql",
- "database": config.database,
- "parallel": true,
- },
- {
- "type": "ExecuteSql",
- "file": "layers/point/index.sql",
- "database": config.database,
- "parallel": true,
- },
- ]
- },
- {
- "id": "openstreetmap-linestring",
- "needs": [
- "openstreetmap-member"
- ],
- "tasks": [
- {
- "type": "ExecuteSql",
- "file": "layers/linestring/clean.sql",
- "database": config.database,
- },
- {
- "type": "ExecuteSql",
- "file": "layers/linestring/prepare.sql",
- "database": config.database,
- },
- {
- "type": "ExecuteSql",
- "file": "layers/linestring/index.sql",
- "database": config.database,
- },
- ]
- },
- {
- "id": "openstreetmap-polygon",
- "needs": [
- "openstreetmap-member",
- ],
- "tasks": [
- {
- "type": "ExecuteSql",
- "file": "layers/polygon/clean.sql",
- "database": config.database,
- },
- {
- "type": "ExecuteSql",
- "file": "layers/polygon/prepare.sql",
- "database": config.database,
- },
- {
- "type": "ExecuteSql",
- "file": "layers/polygon/index.sql",
- "database": config.database,
- },
- ]
- },
- {
- "id": "openstreetmap-highway",
- "needs": [
- "openstreetmap-linestring"
- ],
- "tasks": [
- {
- "type": "ExecuteSql",
- "file": "layers/highway/clean.sql",
- "database": config.database,
- },
- {
- "type": "ExecuteSql",
- "file": "layers/highway/prepare.sql",
- "database": config.database,
- },
- {
- "type": "ExecuteSql",
- "file": "layers/highway/simplify.sql",
- "database": config.database,
- "parallel": true,
- },
- {
- "type": "ExecuteSql",
- "file": "layers/highway/index.sql",
- "database": config.database,
- "parallel": true,
- },
- ]
- },
- {
- "id": "openstreetmap-railway",
- "needs": ["openstreetmap-linestring"],
- "tasks": [
- {
- "type": "ExecuteSql",
- "file": "layers/railway/clean.sql",
- "database": config.database,
- },
- {
- "type": "ExecuteSql",
- "file": "layers/railway/prepare.sql",
- "database": config.database,
- },
- {
- "type": "ExecuteSql",
- "file": "layers/railway/simplify.sql",
- "database": config.database,
- "parallel": true,
- },
- {
- "type": "ExecuteSql",
- "file": "layers/railway/index.sql",
- "database": config.database,
- "parallel": true,
- },
- ]
- },
- {
- "id": "openstreetmap-route",
- "needs": ["openstreetmap-linestring"],
- "tasks": [
- {
- "type": "ExecuteSql",
- "file": "layers/route/clean.sql",
- "database": config.database,
- },
- {
- "type": "ExecuteSql",
- "file": "layers/route/prepare.sql",
- "database": config.database,
- },
- {
- "type": "ExecuteSql",
- "file": "layers/route/simplify.sql",
- "database": config.database,
- "parallel": true,
- },
- {
- "type": "ExecuteSql",
- "file": "layers/route/index.sql",
- "database": config.database,
- "parallel": true,
- },
- ]
- },
- {
- "id": "openstreetmap-waterway",
- "needs": [
- "openstreetmap-linestring"
- ],
- "tasks": [
- {
- "type": "ExecuteSql",
- "file": "layers/waterway/clean.sql",
- "database": config.database,
- },
- {
- "type": "ExecuteSql",
- "file": "layers/waterway/prepare.sql",
- "database": config.database,
- },
- {
- "type": "ExecuteSql",
- "file": "layers/waterway/simplify.sql",
- "database": config.database,
- "parallel": true,
- },
- {
- "type": "ExecuteSql",
- "file": "layers/waterway/index.sql",
- "database": config.database,
- "parallel": true
+ "replaceExisting": false,
+ "truncateExisting": true,
},
]
- },
- {
- "id": "openstreetmap-natural",
- "needs": ["openstreetmap-polygon"],
- "tasks": [
- {
- "type": "ExecuteSql",
- "file": "layers/natural/clean.sql",
- "database": config.database,
- },
- {
- "type": "ExecuteSql",
- "file": "layers/natural/prepare.sql",
- "database": config.database,
- },
- {
- "type": "ExecuteSql",
- "file": "layers/natural/simplify.sql",
- "database": config.database,
- "parallel": true,
- },
- {
- "type": "ExecuteSql",
- "file": "layers/natural/index.sql",
- "database": config.database,
- "parallel": true
- },
- ]
- },
- {
- "id": "openstreetmap-landuse",
- "needs": [
- "openstreetmap-polygon"
- ],
- "tasks": [
- {
- "type": "ExecuteSql",
- "file": "layers/landuse/clean.sql",
- "database": config.database,
- },
- {
- "type": "ExecuteSql",
- "file": "layers/landuse/prepare.sql",
- "database": config.database,
- },
- {
- "type": "ExecuteSql",
- "file": "layers/landuse/simplify.sql",
- "database": config.database,
- "parallel": true,
- },
- {
- "type": "ExecuteSql",
- "file": "layers/landuse/index.sql",
- "database": config.database,
- "parallel": true
- },
- ]
- },
- {
- "id": "openstreetmap-leisure",
- "needs": [
- "openstreetmap-polygon"
- ],
- "tasks": [
- {
- "type": "ExecuteSql",
- "file": "layers/leisure/clean.sql",
- "database": config.database,
- },
- {
- "type": "ExecuteSql",
- "file": "layers/leisure/prepare.sql",
- "database": config.database,
- },
- {
- "type": "ExecuteSql",
- "file": "layers/leisure/simplify.sql",
- "database": config.database,
- "parallel": true,
- },
- {
- "type": "ExecuteSql",
- "file": "layers/leisure/index.sql",
- "database": config.database,
- "parallel": true
- },
- ]
- },
+ }
]
}
diff --git a/basemap/layers/linestring/clean.sql b/basemap/layers/aerialway/create.sql
similarity index 81%
rename from basemap/layers/linestring/clean.sql
rename to basemap/layers/aerialway/create.sql
index a7a694506..7d8e68dc1 100644
--- a/basemap/layers/linestring/clean.sql
+++ b/basemap/layers/aerialway/create.sql
@@ -12,5 +12,13 @@
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-
-DROP MATERIALIZED VIEW IF EXISTS osm_linestring CASCADE;
+CREATE
+ OR REPLACE VIEW osm_aerialway AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_way
+ WHERE
+ geom IS NOT NULL
+ AND tags ? 'aerialway';
\ No newline at end of file
diff --git a/basemap/layers/aerialway/tileset.js b/basemap/layers/aerialway/tileset.js
index 2ae243c32..cc9dcbe59 100644
--- a/basemap/layers/aerialway/tileset.js
+++ b/basemap/layers/aerialway/tileset.js
@@ -21,7 +21,7 @@ export default {
minzoom: 13,
maxzoom: 20,
sql:
- "SELECT id, tags, geom FROM osm_ways WHERE tags ? 'aerialway'",
+ "SELECT id, tags, geom FROM osm_aerialway",
},
],
}
diff --git a/basemap/layers/polygon/clean.sql b/basemap/layers/aeroway/create.sql
similarity index 81%
rename from basemap/layers/polygon/clean.sql
rename to basemap/layers/aeroway/create.sql
index 39c16ff6e..a805d6b60 100644
--- a/basemap/layers/polygon/clean.sql
+++ b/basemap/layers/aeroway/create.sql
@@ -12,4 +12,13 @@
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-DROP MATERIALIZED VIEW IF EXISTS osm_polygon CASCADE;
+CREATE
+ OR REPLACE VIEW osm_aeroway AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_way
+ WHERE
+ geom IS NOT NULL
+ AND tags ? 'aeroway';
\ No newline at end of file
diff --git a/basemap/layers/aeroway/line.js b/basemap/layers/aeroway/line.js
index 21c4e812c..3807d1c07 100644
--- a/basemap/layers/aeroway/line.js
+++ b/basemap/layers/aeroway/line.js
@@ -22,13 +22,13 @@ let directives = [
{
'filter': ['==', ['get', 'aeroway'], 'runway'],
'line-color': theme.aerowayRunwayLineColor,
- 'line-width': 1,
+ 'line-width-stops': theme.aerowayRunwayLineWidth,
},
{
'filter': ['==', ['get', 'aeroway'], 'taxiway'],
'line-color': theme.aerowayTaxiwayLineColor,
- 'line-width': 1,
+ 'line-width-stops': theme.aerowayTaxiwayLineWidth,
},
];
diff --git a/basemap/layers/aeroway/tileset.js b/basemap/layers/aeroway/tileset.js
index 76d3ccef2..b6a570b3b 100644
--- a/basemap/layers/aeroway/tileset.js
+++ b/basemap/layers/aeroway/tileset.js
@@ -21,7 +21,7 @@ export default {
minzoom: 13,
maxzoom: 20,
sql:
- "SELECT id, tags, geom FROM osm_ways WHERE tags ? 'aeroway'",
+ "SELECT id, tags, geom FROM osm_aeroway",
},
],
}
diff --git a/basemap/layers/amenity/create.sql b/basemap/layers/amenity/create.sql
new file mode 100644
index 000000000..d3020cb4c
--- /dev/null
+++ b/basemap/layers/amenity/create.sql
@@ -0,0 +1,741 @@
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements. See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to you under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License. You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+-- Zoom levels 20 to 13
+CREATE
+ OR REPLACE VIEW osm_amenity AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_way
+ WHERE
+ tags ? 'amenity'
+UNION SELECT
+ id,
+ jsonb_build_object(
+ 'amenity',
+ tags -> 'amenity'
+ ) AS tags,
+ geom
+ FROM
+ osm_relation
+ WHERE
+ tags ? 'amenity';
+
+CREATE
+ OR REPLACE VIEW osm_amenity_z20 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_amenity;
+
+CREATE
+ OR REPLACE VIEW osm_amenity_z19 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_amenity;
+
+CREATE
+ OR REPLACE VIEW osm_amenity_z18 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_amenity;
+
+CREATE
+ OR REPLACE VIEW osm_amenity_z17 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_amenity;
+
+CREATE
+ OR REPLACE VIEW osm_amenity_z16 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_amenity;
+
+CREATE
+ OR REPLACE VIEW osm_amenity_z15 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_amenity;
+
+CREATE
+ OR REPLACE VIEW osm_amenity_z14 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_amenity;
+
+CREATE
+ OR REPLACE VIEW osm_amenity_z13 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_amenity;
+
+-- Zoom level 12
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_amenity_z12_filtered CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_amenity_z12_filtered AS SELECT
+ tags -> 'amenity' AS tag,
+ st_buffer(
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 12 )
+ ),
+ 78270 / POWER( 2, 12 )* 1.1,
+ 'join=mitre'
+ ) AS geom
+ FROM
+ osm_amenity
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 12 ), 2 )* 32 WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_amenity_z12 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_amenity_z12 AS WITH clustered AS(
+ SELECT
+ tag,
+ geom,
+ st_clusterdbscan(
+ geom,
+ 0,
+ 0
+ ) OVER(
+ PARTITION BY tag
+ ) AS cluster
+ FROM
+ osm_amenity_z12_filtered
+ ) SELECT
+ ROW_NUMBER() OVER() AS id,
+ jsonb_build_object(
+ 'amenity',
+ tag
+ ) AS tags,
+ st_simplifypreservetopology(
+ (
+ st_dump(
+ st_buffer(
+ st_collect(geom),
+ - 78270 / POWER( 2, 12 ),
+ 'join=mitre'
+ )
+ )
+ ).geom,
+ 78270 / POWER( 2, 12 )
+ ) AS geom
+ FROM
+ clustered
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 12 ), 2 )* 32
+ GROUP BY
+ tag,
+ cluster WITH NO DATA;
+
+-- Zoom level 11
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_amenity_z11_filtered CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_amenity_z11_filtered AS SELECT
+ tags -> 'amenity' AS tag,
+ st_buffer(
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 11 )
+ ),
+ 78270 / POWER( 2, 11 )* 1.1,
+ 'join=mitre'
+ ) AS geom
+ FROM
+ osm_amenity_z12
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 11 ), 2 )* 32 WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_amenity_z11 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_amenity_z11 AS WITH clustered AS(
+ SELECT
+ tag,
+ geom,
+ st_clusterdbscan(
+ geom,
+ 0,
+ 0
+ ) OVER(
+ PARTITION BY tag
+ ) AS cluster
+ FROM
+ osm_amenity_z11_filtered
+ ) SELECT
+ ROW_NUMBER() OVER() AS id,
+ jsonb_build_object(
+ 'amenity',
+ tag
+ ) AS tags,
+ st_simplifypreservetopology(
+ (
+ st_dump(
+ st_buffer(
+ st_collect(geom),
+ - 78270 / POWER( 2, 11 ),
+ 'join=mitre'
+ )
+ )
+ ).geom,
+ 78270 / POWER( 2, 11 )
+ ) AS geom
+ FROM
+ clustered
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 11 ), 2 )* 32
+ GROUP BY
+ tag,
+ cluster WITH NO DATA;
+
+-- Zoom level 10
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_amenity_z10_filtered CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_amenity_z10_filtered AS SELECT
+ tags -> 'amenity' AS tag,
+ st_buffer(
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 10 )
+ ),
+ 78270 / POWER( 2, 10 )* 1.1,
+ 'join=mitre'
+ ) AS geom
+ FROM
+ osm_amenity_z11
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 10 ), 2 )* 32 WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_amenity_z10 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_amenity_z10 AS WITH clustered AS(
+ SELECT
+ tag,
+ geom,
+ st_clusterdbscan(
+ geom,
+ 0,
+ 0
+ ) OVER(
+ PARTITION BY tag
+ ) AS cluster
+ FROM
+ osm_amenity_z10_filtered
+ ) SELECT
+ ROW_NUMBER() OVER() AS id,
+ jsonb_build_object(
+ 'amenity',
+ tag
+ ) AS tags,
+ st_simplifypreservetopology(
+ (
+ st_dump(
+ st_buffer(
+ st_collect(geom),
+ - 78270 / POWER( 2, 10 ),
+ 'join=mitre'
+ )
+ )
+ ).geom,
+ 78270 / POWER( 2, 10 )
+ ) AS geom
+ FROM
+ clustered
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 10 ), 2 )* 32
+ GROUP BY
+ tag,
+ cluster WITH NO DATA;
+
+-- Zoom level 9
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_amenity_z9 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_amenity_z9 AS WITH filtered AS(
+ SELECT
+ tags -> 'amenity' AS tag,
+ st_buffer(
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 9 )
+ ),
+ 78270 / POWER( 2, 9 )* 1.1,
+ 'join=mitre'
+ ) AS geom
+ FROM
+ osm_amenity_z10
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 9 ), 2 )* 32
+ ),
+ clustered AS(
+ SELECT
+ tag,
+ geom,
+ st_clusterdbscan(
+ geom,
+ 0,
+ 0
+ ) OVER(
+ PARTITION BY tag
+ ) AS cluster
+ FROM
+ filtered
+ ) SELECT
+ ROW_NUMBER() OVER() AS id,
+ jsonb_build_object(
+ 'amenity',
+ tag
+ ) AS tags,
+ st_simplifypreservetopology(
+ (
+ st_dump(
+ st_buffer(
+ st_collect(geom),
+ - 78270 / POWER( 2, 9 ),
+ 'join=mitre'
+ )
+ )
+ ).geom,
+ 78270 / POWER( 2, 9 )
+ ) AS geom
+ FROM
+ clustered
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 9 ), 2 )* 32
+ GROUP BY
+ tag,
+ cluster WITH NO DATA;
+
+-- Zoom level 8
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_amenity_z8 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_amenity_z8 AS WITH filtered AS(
+ SELECT
+ tags -> 'amenity' AS tag,
+ st_buffer(
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 8 )
+ ),
+ 78270 / POWER( 2, 8 )* 1.1,
+ 'join=mitre'
+ ) AS geom
+ FROM
+ osm_amenity_z9
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 8 ), 2 )* 32
+ ),
+ clustered AS(
+ SELECT
+ tag,
+ geom,
+ st_clusterdbscan(
+ geom,
+ 0,
+ 0
+ ) OVER(
+ PARTITION BY tag
+ ) AS cluster
+ FROM
+ filtered
+ ) SELECT
+ ROW_NUMBER() OVER() AS id,
+ jsonb_build_object(
+ 'amenity',
+ tag
+ ) AS tags,
+ st_simplifypreservetopology(
+ (
+ st_dump(
+ st_buffer(
+ st_collect(geom),
+ - 78270 / POWER( 2, 8 ),
+ 'join=mitre'
+ )
+ )
+ ).geom,
+ 78270 / POWER( 2, 8 )
+ ) AS geom
+ FROM
+ clustered
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 8 ), 2 )* 32
+ GROUP BY
+ tag,
+ cluster WITH NO DATA;
+
+-- Zoom level 7
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_amenity_z7 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_amenity_z7 AS WITH filtered AS(
+ SELECT
+ tags -> 'amenity' AS tag,
+ st_buffer(
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 7 )
+ ),
+ 78270 / POWER( 2, 7 )* 1.1,
+ 'join=mitre'
+ ) AS geom
+ FROM
+ osm_amenity_z8
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 7 ), 2 )* 32
+ ),
+ clustered AS(
+ SELECT
+ tag,
+ geom,
+ st_clusterdbscan(
+ geom,
+ 0,
+ 0
+ ) OVER(
+ PARTITION BY tag
+ ) AS cluster
+ FROM
+ filtered
+ ) SELECT
+ ROW_NUMBER() OVER() AS id,
+ jsonb_build_object(
+ 'amenity',
+ tag
+ ) AS tags,
+ st_simplifypreservetopology(
+ (
+ st_dump(
+ st_buffer(
+ st_collect(geom),
+ - 78270 / POWER( 2, 7 ),
+ 'join=mitre'
+ )
+ )
+ ).geom,
+ 78270 / POWER( 2, 7 )
+ ) AS geom
+ FROM
+ clustered
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 7 ), 2 )* 32
+ GROUP BY
+ tag,
+ cluster WITH NO DATA;
+
+-- Zoom level 6
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_amenity_z6 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_amenity_z6 AS WITH filtered AS(
+ SELECT
+ tags -> 'amenity' AS tag,
+ st_buffer(
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 6 )
+ ),
+ 78270 / POWER( 2, 6 )* 1.1,
+ 'join=mitre'
+ ) AS geom
+ FROM
+ osm_amenity_z7
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 6 ), 2 )* 32
+ ),
+ clustered AS(
+ SELECT
+ tag,
+ geom,
+ st_clusterdbscan(
+ geom,
+ 0,
+ 0
+ ) OVER(
+ PARTITION BY tag
+ ) AS cluster
+ FROM
+ filtered
+ ) SELECT
+ ROW_NUMBER() OVER() AS id,
+ jsonb_build_object(
+ 'amenity',
+ tag
+ ) AS tags,
+ st_simplifypreservetopology(
+ (
+ st_dump(
+ st_buffer(
+ st_collect(geom),
+ - 78270 / POWER( 2, 6 ),
+ 'join=mitre'
+ )
+ )
+ ).geom,
+ 78270 / POWER( 2, 6 )
+ ) AS geom
+ FROM
+ clustered
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 6 ), 2 )* 32
+ GROUP BY
+ tag,
+ cluster WITH NO DATA;
+
+-- Zoom level 5
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_amenity_z5 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_amenity_z5 AS WITH filtered AS(
+ SELECT
+ tags -> 'amenity' AS tag,
+ st_buffer(
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 5 )
+ ),
+ 78270 / POWER( 2, 5 )* 1.1,
+ 'join=mitre'
+ ) AS geom
+ FROM
+ osm_amenity_z6
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 5 ), 2 )* 32
+ ),
+ clustered AS(
+ SELECT
+ tag,
+ geom,
+ st_clusterdbscan(
+ geom,
+ 0,
+ 0
+ ) OVER(
+ PARTITION BY tag
+ ) AS cluster
+ FROM
+ filtered
+ ) SELECT
+ ROW_NUMBER() OVER() AS id,
+ jsonb_build_object(
+ 'amenity',
+ tag
+ ) AS tags,
+ st_simplifypreservetopology(
+ (
+ st_dump(
+ st_buffer(
+ st_collect(geom),
+ - 78270 / POWER( 2, 5 ),
+ 'join=mitre'
+ )
+ )
+ ).geom,
+ 78270 / POWER( 2, 5 )
+ ) AS geom
+ FROM
+ clustered
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 5 ), 2 )* 32
+ GROUP BY
+ tag,
+ cluster WITH NO DATA;
+
+-- Zoom level 4
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_amenity_z4 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_amenity_z4 AS WITH filtered AS(
+ SELECT
+ tags -> 'amenity' AS tag,
+ st_buffer(
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 4 )
+ ),
+ 78270 / POWER( 2, 4 )* 1.1,
+ 'join=mitre'
+ ) AS geom
+ FROM
+ osm_amenity_z6
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 4 ), 2 )* 32
+ ),
+ clustered AS(
+ SELECT
+ tag,
+ geom,
+ st_clusterdbscan(
+ geom,
+ 0,
+ 0
+ ) OVER(
+ PARTITION BY tag
+ ) AS cluster
+ FROM
+ filtered
+ ) SELECT
+ ROW_NUMBER() OVER() AS id,
+ jsonb_build_object(
+ 'amenity',
+ tag
+ ) AS tags,
+ st_simplifypreservetopology(
+ (
+ st_dump(
+ st_buffer(
+ st_collect(geom),
+ - 78270 / POWER( 2, 4 ),
+ 'join=mitre'
+ )
+ )
+ ).geom,
+ 78270 / POWER( 2, 4 )
+ ) AS geom
+ FROM
+ clustered
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 4 ), 2 )* 32
+ GROUP BY
+ tag,
+ cluster WITH NO DATA;
+
+-- Zoom level 3
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_amenity_z3 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_amenity_z3 AS SELECT
+ id,
+ tags,
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 3 )
+ ) AS geom
+ FROM
+ osm_amenity_z4
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 3 ), 2 )* 16 WITH NO DATA;
+
+-- Zoom level 2
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_amenity_z2 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_amenity_z2 AS SELECT
+ id,
+ tags,
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 2 )
+ ) AS geom
+ FROM
+ osm_amenity_z4
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 2 ), 2 )* 16 WITH NO DATA;
+
+-- Zoom level 1
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_amenity_z1 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_amenity_z1 AS SELECT
+ id,
+ tags,
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 1 )
+ ) AS geom
+ FROM
+ osm_amenity_z4
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 1 ), 2 )* 16 WITH NO DATA;
diff --git a/basemap/layers/amenity/icon.js b/basemap/layers/amenity/icon.js
deleted file mode 100644
index 14ec646c4..000000000
--- a/basemap/layers/amenity/icon.js
+++ /dev/null
@@ -1,2066 +0,0 @@
-/**
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to you under the Apache License, Version 2.0
- (the 'License'); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an 'AS IS' BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- **/
-import {asLayerObject, withSortKeys} from '../../utils/utils.js';
-import theme from '../../theme.js';
-
-/**
- * These directives are based on the following source:
- * https://wiki.openstreetmap.org/wiki/OpenStreetMap_Carto/Symbols
- */
-let directives = [
-
- // Gastronomy
- {
- 'filter': [
- 'all',
- ['==', ['get', 'amenity'], 'restaurant'],
- ['==', ['get', 'amenity'], 'food_court']
- ],
- 'icon-image': 'restaurant',
- 'icon-color': theme.gastronomyIconColor,
- 'text-color': theme.gastronomyIconColor
- },
- {
- 'filter': ['==', ['get', 'amenity'], 'cafe'],
- 'icon-image': 'cafe',
- 'icon-color': theme.gastronomyIconColor,
- 'text-color': theme.gastronomyIconColor
- },
- {
- 'filter': ['==', ['get', 'amenity'], 'fast_food'],
- 'icon-image': 'fast_food',
- 'icon-color': theme.gastronomyIconColor,
- 'text-color': theme.gastronomyIconColor
- },
- {
- 'filter': ['==', ['get', 'amenity'], 'bar'],
- 'icon-image': 'bar',
- 'icon-color': theme.gastronomyIconColor,
- 'text-color': theme.gastronomyIconColor
- },
- {
- 'filter': ['==', ['get', 'amenity'], 'pub'],
- 'icon-image': 'pub',
- 'icon-color': theme.gastronomyIconColor,
- 'text-color': theme.gastronomyIconColor
- },
- {
- 'filter': ['==', ['get', 'amenity'], 'ice_cream'],
- 'icon-image': 'ice_cream',
- 'icon-color': theme.gastronomyIconColor,
- 'text-color': theme.gastronomyIconColor
- },
- {
- 'filter': ['==', ['get', 'amenity'], 'biergarten'],
- 'icon-image': 'biergarten',
- 'icon-color': theme.gastronomyIconColor,
- 'text-color': theme.gastronomyIconColor
- },
- {
- 'filter': ['==', ['get', 'leisure'], 'outdoor_seating'],
- 'icon-image': 'outdoor_seating',
- 'icon-color': theme.leisureIconColor,
- 'text-color': theme.leisureIconColor,
- },
-
- // Culture, entertainment, and arts
- {
- 'filter': ['==', ['get', 'tourism'], 'artwork'],
- 'icon-image': 'artwork',
- 'icon-color': theme.amenityIconColor,
- 'text-color': theme.amenityIconColor
- },
- {
- 'filter': ['==', ['get', 'amenity'], 'community_centre'],
- 'icon-image': 'community_centre',
- 'icon-color': theme.amenityIconColor,
- 'text-color': theme.amenityIconColor
- },
- {
- 'filter': ['==', ['get', 'amenity'], 'library'],
- 'icon-image': 'library',
- 'icon-color': theme.amenityIconColor,
- 'text-color': theme.amenityIconColor
- },
- {
- 'filter': ['==', ['get', 'tourism'], 'museum'],
- 'icon-image': 'museum',
- 'icon-color': theme.amenityIconColor,
- 'text-color': theme.amenityIconColor
- },
- {
- 'filter': ['==', ['get', 'amenity'], 'theatre'],
- 'icon-image': 'theatre',
- 'icon-color': theme.amenityIconColor,
- 'text-color': theme.amenityIconColor
- },
- {
- 'filter': ['==', ['get', 'amenity'], 'cinema'],
- 'icon-image': 'cinema',
- 'icon-color': theme.amenityIconColor,
- 'text-color': theme.amenityIconColor
- },
- {
- 'filter': ['==', ['get', 'amenity'], 'nightclub'],
- 'icon-image': 'nightclub',
- 'icon-color': theme.amenityIconColor,
- 'text-color': theme.amenityIconColor
- },
- {
- 'filter': ['==', ['get', 'amenity'], 'arts_centre'],
- 'icon-image': 'arts_centre',
- 'icon-color': theme.amenityIconColor,
- 'text-color': theme.amenityIconColor
- },
- {
- 'filter': ['==', ['get', 'tourism'], 'gallery'],
- 'icon-image': 'art',
- 'icon-color': theme.amenityIconColor,
- 'text-color': theme.amenityIconColor
- },
- {
- 'filter': ['==', ['get', 'amenity'], 'internet_cafe'],
- 'icon-image': 'internet_cafe',
- 'icon-color': theme.amenityIconColor,
- 'text-color': theme.amenityIconColor
- },
- {
- 'filter': ['==', ['get', 'amenity'], 'casino'],
- 'icon-image': 'casino',
- 'icon-color': theme.amenityIconColor,
- 'text-color': theme.amenityIconColor
- },
- {
- 'filter': ['==', ['get', 'amenity'], 'public_bookcase'],
- 'icon-image': 'public_bookcase',
- 'icon-color': theme.amenityIconColor,
- 'text-color': theme.amenityIconColor
- },
- {
- 'filter': ['==', ['get', 'leisure'], 'amusement_arcade'],
- 'icon-image': 'amusement_arcade',
- 'icon-color': theme.leisureIconColor,
- 'text-color': theme.leisureIconColor,
- },
-
- // Historical objects
- {
- 'filter': ['==', ['get', 'historic'], 'memorial'],
- 'icon-image': 'memorial',
- 'icon-color': theme.historyIconColor,
- 'text-color': theme.historyIconColor
- },
- {
- 'filter': ['==', ['get', 'historic'], 'archaeological_site'],
- 'icon-image': 'archaeological_site',
- 'icon-color': theme.historyIconColor,
- 'text-color': theme.historyIconColor
- },
- {
- 'filter': ['==', ['get', 'historic'], 'wayside_shrine'],
- 'icon-image': 'wayside_shrine',
- 'icon-color': theme.historyIconColor,
- 'text-color': theme.historyIconColor
- },
- {
- 'filter': ['==', ['get', 'historic'], 'monument'],
- 'icon-image': 'monument',
- 'icon-color': theme.historyIconColor,
- 'text-color': theme.historyIconColor
- },
- {
- 'filter': ['==', ['get', 'historic'], 'castle'],
- 'icon-image': 'castle',
- 'icon-color': theme.historyIconColor,
- 'text-color': theme.historyIconColor
- },
- {
- 'filter': [
- 'any',
- [
- 'all',
- ['==', ['get', 'historic'], 'memorial'],
- ['==', ['get', 'memorial'], 'plaque']
- ],
- [
- 'all',
- ['==', ['get', 'historic'], 'memorial'],
- ['==', ['get', 'memorial'], 'blue_plaque']
- ]
- ],
- 'icon-image': 'plaque',
- 'icon-color': theme.historyIconColor,
- 'text-color': theme.historyIconColor
- },
- {
- 'filter': [
- 'any',
- [
- 'all',
- ['==', ['get', 'historic'], 'memorial'],
- ['==', ['get', 'memorial'], 'statue']
- ],
- [
- 'all',
- ['==', ['get', 'tourism'], 'artwork'],
- ['==', ['get', 'artwork_type'], 'statue']
- ]
- ],
- 'icon-image': 'statue',
- 'icon-color': theme.historyIconColor,
- 'text-color': theme.historyIconColor
- },
- {
- 'filter': [
- 'any',
- ['==', ['get', 'historic'], 'memorial'],
- ['==', ['get', 'memorial'], 'stone']
- ],
- 'icon-image': 'stone',
- 'icon-color': theme.historyIconColor,
- 'text-color': theme.historyIconColor
- },
- {
- 'filter': [
- 'any',
- [
- 'all',
- ['==', ['get', 'historic'], 'castle'],
- ['==', ['get', 'castle_type'], 'palace']
- ],
- [
- 'all',
- ['==', ['get', 'historic'], 'castle'],
- ['==', ['get', 'castle_type'], 'stately']
- ]
- ],
- 'icon-image': 'palace',
- 'icon-color': theme.historyIconColor,
- 'text-color': theme.historyIconColor
- },
- // {
- // 'filter': ['==', ['get', 'historic'], 'castle'], =>defensive / =>fortress / =>castrum / =>shiro / =>kremlin
- // 'icon-image': 'fortress',
- // 'icon-color': theme.historyIconColor,
- // 'text-color': theme.historyIconColor
- // },
- {
- 'filter': ['==', ['get', 'historic'], 'fort'],
- 'icon-image': 'historic_fort',
- 'icon-color': theme.historyIconColor,
- 'text-color': theme.historyIconColor
- },
- {
- 'filter': [
- 'any',
- [
- 'all',
- ['==', ['get', 'historic'], 'memorial'],
- ['==', ['get', 'memorial'], 'bust']
- ],
- [
- 'all',
- ['==', ['get', 'tourism'], 'artwork'],
- ['==', ['get', 'artwork_type'], 'bust']
- ]
- ],
- 'icon-image': 'bust',
- 'icon-color': theme.historyIconColor,
- 'text-color': theme.historyIconColor
- },
- {
- 'filter': ['==', ['get', 'historic'], 'city_gate'],
- 'icon-image': 'city_gate',
- 'icon-color': theme.historyIconColor,
- 'text-color': theme.historyIconColor
- },
- {
- 'filter': [
- 'any',
- ['==', ['get', 'historic'], 'manor'],
- [
- 'all',
- ['==', ['get', 'historic'], 'castle'],
- ['==', ['get', 'castle_type'], 'manor']
- ]
- ],
- 'icon-image': 'manor',
- 'icon-color': theme.historyIconColor,
- 'text-color': theme.historyIconColor
- },
- {
- 'filter': ['==', ['get', 'man_made'], 'obelisk'],
- 'icon-image': 'obelisk',
- 'icon-color': theme.historyIconColor,
- 'text-color': theme.historyIconColor
- },
-
- // Leisure, recreation, and sport
- {
- 'filter': ['==', ['get', 'leisure'], 'playground'],
- 'icon-image': 'playground',
- 'icon-color': theme.leisureIconColor,
- 'text-color': theme.leisureIconColor,
- },
- {
- 'filter': [
- 'any',
- ['==', ['get', 'leisure'], 'fitness_centre'],
- ['==', ['get', 'leisure'], 'fitness_station']
- ],
- 'icon-image': 'fitness',
- 'icon-color': theme.leisureIconColor,
- 'text-color': theme.leisureIconColor,
- },
- {
- 'filter': ['==', ['get', 'leisure'], 'golf_course'],
- 'icon-image': 'golf',
- 'icon-color': theme.leisureIconColor,
- 'text-color': theme.leisureIconColor,
- },
- {
- 'filter': [
- 'any',
- ['==', ['get', 'leisure'], 'water_park'],
- ['==', ['get', 'leisure'], 'swimming_area'],
- [
- 'all',
- ['==', ['get', 'leisure'], 'sports_centre'],
- ['==', ['get', 'sport'], 'swimming']
- ]
- ],
- 'icon-image': 'water_park',
- 'icon-color': theme.leisureIconColor,
- 'text-color': theme.leisureIconColor,
- },
- {
- 'filter': ['==', ['get', 'shop'], 'massage'],
- 'icon-image': 'massage',
- 'icon-color': theme.leisureIconColor,
- 'text-color': theme.leisureIconColor,
- },
- {
- 'filter': ['==', ['get', 'leisure'], 'sauna'],
- 'icon-image': 'sauna',
- 'icon-color': theme.leisureIconColor,
- 'text-color': theme.leisureIconColor,
- },
- {
- 'filter': ['==', ['get', 'amenity'], 'public_bath'],
- 'icon-image': 'public_bath',
- 'icon-color': theme.pointIconPublicBathIconColor,
- 'text-color': theme.pointIconPublicBathTextColor
- },
- {
- 'filter': ['==', ['get', 'leisure'], 'miniature_golf'],
- 'icon-image': 'miniature_golf',
- 'icon-color': theme.leisureIconColor,
- 'text-color': theme.leisureIconColor,
- },
- {
- 'filter': ['==', ['get', 'leisure'], 'beach_resort'],
- 'icon-image': 'beach_resort',
- 'icon-color': theme.leisureIconColor,
- 'text-color': theme.leisureIconColor,
- },
- {
- 'filter': ['==', ['get', 'leisure'], 'fishing'],
- 'icon-image': 'fishing',
- 'icon-color': theme.leisureIconColor,
- 'text-color': theme.leisureIconColor,
- },
- {
- 'filter': ['==', ['get', 'leisure'], 'bowling_alley'],
- 'icon-image': 'bowling_alley',
- 'icon-color': theme.leisureIconColor,
- 'text-color': theme.leisureIconColor,
- },
- {
- 'filter': ['==', ['get', 'leisure'], 'dog_park'],
- 'icon-image': 'dog_park',
- 'icon-color': theme.leisureIconColor,
- 'text-color': theme.leisureIconColor,
- },
- {
- 'filter': ['==', ['get', 'golf'], 'pin'],
- 'icon-image': 'leisure_golf_pin',
- 'icon-color': theme.leisureIconColor,
- 'text-color': theme.leisureIconColor,
- },
-
- // Waste management
- {
- 'filter': ['==', ['get', 'amenity'], 'toilets'],
- 'icon-image': 'toilets',
- 'icon-color': theme.amenityIconColor,
- 'text-color': theme.amenityIconColor
- },
- {
- 'filter': ['==', ['get', 'amenity'], 'recycling'],
- 'icon-image': 'recycling',
- 'icon-color': theme.amenityIconColor,
- 'text-color': theme.amenityIconColor
- },
- {
- 'filter': ['==', ['get', 'amenity'], 'waste_basket'],
- 'icon-image': 'waste_basket',
- 'icon-color': theme.amenityIconColor,
- 'text-color': theme.amenityIconColor
- },
- {
- 'filter': ['==', ['get', 'amenity'], 'waste_disposal'],
- 'icon-image': 'waste_disposal',
- 'icon-color': theme.amenityIconColor,
- 'text-color': theme.amenityIconColor
- },
- {
- 'filter': [
- 'all',
- ['==', ['get', 'amenity'], 'vending_machine'],
- ['==', ['get', 'vending'], 'excrement_bags']
- ],
- 'icon-image': 'excrement_bags',
- 'icon-color': theme.amenityIconColor,
- 'text-color': theme.amenityIconColor
- },
-
- // Outdoor
- {
- 'filter': ['==', ['get', 'amenity'], 'bench'],
- 'icon-image': 'bench',
- 'icon-color': theme.defaultIconColor,
- 'text-color': theme.defaultIconColor
- },
- {
- 'filter': ['==', ['get', 'amenity'], 'shelter'],
- 'icon-image': 'shelter',
- 'icon-color': theme.defaultIconColor,
- 'text-color': theme.defaultIconColor
- },
- {
- 'filter': ['==', ['get', 'amenity'], 'drinking_water'],
- 'icon-image': 'drinking_water',
- 'icon-color': theme.amenityIconColor,
- 'text-color': theme.amenityIconColor
- },
- {
- 'filter': ['==', ['get', 'tourism'], 'picnic_site'],
- 'icon-image': 'picnic',
- 'icon-color': theme.leisureIconColor,
- 'text-color': theme.leisureIconColor
- },
- {
- 'filter': ['==', ['get', 'amenity'], 'fountain'],
- 'icon-image': 'fountain',
- 'icon-color': theme.waterIconColor,
- 'text-color': theme.waterIconColor
- },
- {
- 'filter': ['==', ['get', 'tourism'], 'camp_site'],
- 'icon-image': 'camping',
- 'icon-color': theme.accommodationIconColor,
- 'text-color': theme.accommodationIconColor
- },
- {
- 'filter': ['==', ['get', 'leisure'], 'picnic_table'],
- 'icon-image': 'picnic',
- 'icon-color': theme.defaultIconColor,
- 'text-color': theme.defaultIconColor,
- },
- {
- 'filter': ['==', ['get', 'tourism'], 'caravan_site'],
- 'icon-image': 'caravan_park',
- 'icon-color': theme.accommodationIconColor,
- 'text-color': theme.accommodationIconColor
- },
- {
- 'filter': ['==', ['get', 'amenity'], 'bbq'],
- 'icon-image': 'bbq',
- 'icon-color': theme.amenityIconColor,
- 'text-color': theme.amenityIconColor
- },
- {
- 'filter': ['==', ['get', 'amenity'], 'shower'],
- 'icon-image': 'shower',
- 'icon-color': theme.amenityIconColor,
- 'text-color': theme.amenityIconColor
- },
- {
- 'filter': ['==', ['get', 'leisure'], 'firepit'],
- 'icon-image': 'firepit',
- 'icon-color': theme.amenityIconColor,
- 'text-color': theme.amenityIconColor,
- },
- {
- 'filter': ['==', ['get', 'leisure'], 'bird_hide'],
- 'icon-image': 'bird_hide',
- 'icon-color': theme.leisureIconColor,
- 'text-color': theme.leisureIconColor,
- },
-
- // Tourism and accommodation
- {
- 'filter': [
- 'all',
- ['==', ['get', 'tourism'], 'information'],
- ['==', ['get', 'information'], 'guidepost']
- ],
- 'icon-image': 'guidepost',
- 'icon-color': theme.defaultIconColor,
- 'text-color': theme.defaultIconColor
- },
- {
- 'filter': [
- 'all',
- ['==', ['get', 'tourism'], 'information'],
- ['==', ['get', 'information'], 'board']
- ],
- 'icon-image': 'board',
- 'icon-color': theme.defaultIconColor,
- 'text-color': theme.defaultIconColor
- },
- {
- 'filter': [
- 'any',
- [
- 'all',
- ['==', ['get', 'tourism'], 'information'],
- ['==', ['get', 'information'], 'map']
- ],
- [
- 'all',
- ['==', ['get', 'tourism'], 'information'],
- ['==', ['get', 'information'], 'tactile_map']
- ]
- ],
- 'icon-image': 'map',
- 'icon-color': theme.defaultIconColor,
- 'text-color': theme.defaultIconColor
- },
- {
- 'filter': [
- 'any',
- ['==', ['get', 'tourism'], 'information'],
- ['==', ['get', 'information'], 'office']
- ],
- 'icon-image': 'office',
- 'icon-color': theme.amenityIconColor,
- 'text-color': theme.amenityIconColor
- },
- {
- 'filter': [
- 'any',
- ['==', ['get', 'tourism'], 'information'],
- ['==', ['get', 'information'], 'terminal']
- ],
- 'icon-image': 'terminal',
- 'icon-color': theme.defaultIconColor,
- 'text-color': theme.defaultIconColor
- },
- {
- 'filter': [
- 'any',
- ['==', ['get', 'tourism'], 'information'],
- ['==', ['get', 'information'], 'audioguide']
- ],
- 'icon-image': 'audioguide',
- 'icon-color': theme.defaultIconColor,
- 'text-color': theme.defaultIconColor
- },
- {
- 'filter': ['==', ['get', 'tourism'], 'viewpoint'],
- 'icon-image': 'viewpoint',
- 'icon-color': theme.amenityIconColor,
- 'text-color': theme.amenityIconColor
- },
- {
- 'filter': ['==', ['get', 'tourism'], 'hotel'],
- 'icon-image': 'hotel',
- 'icon-color': theme.accommodationIconColor,
- 'text-color': theme.accommodationIconColor
- },
- {
- 'filter': ['==', ['get', 'tourism'], 'guest_house'],
- 'icon-image': 'guest_house',
- 'icon-color': theme.accommodationIconColor,
- 'text-color': theme.accommodationIconColor
- },
- {
- 'filter': ['==', ['get', 'tourism'], 'hostel'],
- 'icon-image': 'hostel',
- 'icon-color': theme.accommodationIconColor,
- 'text-color': theme.accommodationIconColor
- },
- {
- 'filter': ['==', ['get', 'tourism'], 'chalet'],
- 'icon-image': 'chalet',
- 'icon-color': theme.accommodationIconColor,
- 'text-color': theme.accommodationIconColor
- },
- {
- 'filter': ['==', ['get', 'tourism'], 'motel'],
- 'icon-image': 'motel',
- 'icon-color': theme.accommodationIconColor,
- 'text-color': theme.accommodationIconColor
- },
- {
- 'filter': ['==', ['get', 'tourism'], 'apartment'],
- 'icon-image': 'apartment',
- 'icon-color': theme.accommodationIconColor,
- 'text-color': theme.accommodationIconColor
- },
- {
- 'filter': ['==', ['get', 'tourism'], 'alpine_hut'],
- 'icon-image': 'alpinehut',
- 'icon-color': theme.accommodationIconColor,
- 'text-color': theme.accommodationIconColor
- },
- {
- 'filter': ['==', ['get', 'tourism'], 'wilderness_hut'],
- 'icon-image': 'wilderness_hut',
- 'icon-color': theme.accommodationIconColor,
- 'text-color': theme.accommodationIconColor
- },
-
- // Finance
- {
- 'filter': ['==', ['get', 'amenity'], 'bank'],
- 'icon-image': 'bank',
- 'icon-color': theme.amenityIconColor,
- 'text-color': theme.amenityIconColor
- },
- {
- 'filter': ['==', ['get', 'amenity'], 'atm'],
- 'icon-image': 'atm',
- 'icon-color': theme.amenityIconColor,
- 'text-color': theme.amenityIconColor
- },
- {
- 'filter': ['==', ['get', 'amenity'], 'bureau_de_change'],
- 'icon-image': 'bureau_de_change',
- 'icon-color': theme.amenityIconColor,
- 'text-color': theme.amenityIconColor
- },
-
- // Healthcare
- {
- 'filter': ['==', ['get', 'amenity'], 'pharmacy'],
- 'icon-image': 'pharmacy',
- 'icon-color': theme.healthIconColor,
- 'text-color': theme.healthIconColor
- },
- {
- 'filter': ['==', ['get', 'amenity'], 'hospital'],
- 'icon-image': 'hospital',
- 'icon-color': theme.healthIconColor,
- 'text-color': theme.healthIconColor
- },
- {
- 'filter': [
- 'any',
- ['==', ['get', 'amenity'], 'clinic'],
- ['==', ['get', 'amenity'], 'doctors']
- ],
- 'icon-image': 'doctors',
- 'icon-color': theme.healthIconColor,
- 'text-color': theme.healthIconColor
- },
- {
- 'filter': ['==', ['get', 'amenity'], 'dentist'],
- 'icon-image': 'dentist',
- 'icon-color': theme.healthIconColor,
- 'text-color': theme.healthIconColor
- },
- {
- 'filter': ['==', ['get', 'amenity'], 'veterinary'],
- 'icon-image': 'veterinary',
- 'icon-color': theme.healthIconColor,
- 'text-color': theme.healthIconColor
- },
-
- // Communication
- {
- 'filter': ['==', ['get', 'amenity'], 'post_box'],
- 'icon-image': 'post_box',
- 'icon-color': theme.amenityIconColor,
- 'text-color': theme.amenityIconColor
- },
- {
- 'filter': ['==', ['get', 'amenity'], 'post_office'],
- 'icon-image': 'post_office',
- 'icon-color': theme.amenityIconColor,
- 'text-color': theme.amenityIconColor
- },
- // {
- // 'filter': ['==', ['get', 'amenity'], 'parcel_locker'],
- // 'icon-image': 'parcel_locker',
- // 'icon-color': theme.amenityIconColor,
- // 'text-color': theme.amenityIconColor
- // },
- {
- 'filter': ['==', ['get', 'amenity'], 'telephone'],
- 'icon-image': 'telephone',
- 'icon-color': theme.amenityIconColor,
- 'text-color': theme.amenityIconColor
- },
- {
- 'filter': ['==', ['get', 'emergency'], 'phone'],
- 'icon-image': 'emergency_phone',
- 'icon-color': theme.amenityIconColor,
- 'text-color': theme.amenityIconColor
- },
-
- // Transportation
- {
- 'filter': ['==', ['get', 'amenity'], 'parking'],
- 'icon-image': 'parking',
- 'icon-color': theme.transportationIconColor,
- 'text-color': theme.transportationIconColor
- },
- {
- 'filter': [
- 'any',
- ['all',
- ['==', ['get', 'amenity'], 'parking'],
- ['==', ['get', 'parking'], 'lane'],
- ],
- ['all',
- ['==', ['get', 'amenity'], 'parking'],
- ['==', ['get', 'parking'], 'street_side']
- ]
- ],
- 'icon-image': 'parking_subtle',
- 'icon-color': theme.transportationIconColor,
- 'text-color': theme.transportationIconColor
- },
- {
- 'filter': ['==', ['get', 'highway'], 'bus_stop'],
- 'icon-image': 'bus_stop',
- 'icon-color': theme.transportationIconColor,
- 'text-color': theme.transportationIconColor
- },
- {
- 'filter': ['==', ['get', 'amenity'], 'fuel'],
- 'icon-image': 'fuel',
- 'icon-color': theme.transportationIconColor,
- 'text-color': theme.transportationIconColor
- },
- {
- 'filter': ['==', ['get', 'amenity'], 'bicycle_parking'],
- 'icon-image': 'bicycle_parking',
- 'icon-color': theme.transportationIconColor,
- 'text-color': theme.transportationIconColor
- },
- {
- 'filter': [
- 'any',
- ['==', ['get', 'railway'], 'station'],
- ['==', ['get', 'railway'], 'halt'],
- ['==', ['get', 'railway'], 'tram_stop']
- ],
- 'icon-image': 'place-6',
- 'icon-color': theme.transportationIconColor,
- 'text-color': theme.transportationIconColor
- },
- {
- 'filter': ['==', ['get', 'amenity'], 'bus_station'],
- 'icon-image': 'bus_station',
- 'icon-color': theme.transportationIconColor,
- 'text-color': theme.transportationIconColor
- },
- {
- 'filter': ['==', ['get', 'aeroway'], 'helipad'],
- 'icon-image': 'helipad',
- 'icon-color': theme.transportDefaultIconColor,
- 'text-color': theme.transportDefaultIconColor
- },
- {
- 'filter': ['==', ['get', 'aeroway'], 'aerodrome'],
- 'icon-image': 'aerodrome',
- 'icon-color': theme.transportDefaultIconColor,
- 'text-color': theme.transportDefaultIconColor
- },
- {
- 'filter': ['==', ['get', 'amenity'], 'bicycle_rental'],
- 'icon-image': 'rental_bicycle',
- 'icon-color': theme.transportationIconColor,
- 'text-color': theme.transportationIconColor
- },
- {
- 'filter': ['==', ['get', 'leisure'], 'slipway'],
- 'icon-image': 'slipway',
- 'icon-color': theme.transportationIconColor,
- 'text-color': theme.transportationIconColor
- },
- {
- 'filter': ['==', ['get', 'amenity'], 'taxi'],
- 'icon-image': 'taxi',
- 'icon-color': theme.transportationIconColor,
- 'text-color': theme.transportationIconColor
- },
- {
- 'filter': [
- 'all',
- ['==', ['get', 'amenity'], 'vending_machine'],
- ['==', ['get', 'vending'], 'parking_tickets']
- ],
- 'icon-image': 'parking_tickets',
- 'icon-color': theme.amenityIconColor,
- 'text-color': theme.amenityIconColor
- },
- {
- 'filter': ['==', ['get', 'railway'], 'subway_entrance'],
- 'icon-image': 'entrance',
- 'icon-color': theme.transportationIconColor,
- 'text-color': theme.transportationIconColor
- },
- {
- 'filter': ['==', ['get', 'amenity'], 'charging_station'],
- 'icon-image': 'charging_station',
- 'icon-color': theme.transportationIconColor,
- 'text-color': theme.transportationIconColor
- },
- {
- 'filter': ['==', ['get', 'highway'], 'elevator'],
- 'icon-image': 'elevator',
- 'icon-color': theme.transportationIconColor,
- 'text-color': theme.transportationIconColor
- },
- {
- 'filter': ['==', ['get', 'amenity'], 'car_rental'],
- 'icon-image': 'rental_car',
- 'icon-color': theme.transportationIconColor,
- 'text-color': theme.transportationIconColor
- },
- {
- 'filter': [
- 'all',
- ['==', ['get', 'amenity'], 'parking_entrance'],
- ['==', ['get', 'parking'], 'underground']
- ],
- 'icon-image': 'parking_entrance_underground',
- 'icon-color': theme.transportationIconColor,
- 'text-color': theme.transportationIconColor
- },
- {
- 'filter': [
- 'all',
- ['==', ['get', 'amenity'], 'vending_machine'],
- ['==', ['get', 'vending'], 'public_transport_tickets']
- ],
- 'icon-image': 'public_transport_tickets',
- 'icon-color': theme.amenityIconColor,
- 'text-color': theme.amenityIconColor
- },
- {
- 'filter': ['==', ['get', 'amenity'], 'ferry_terminal'],
- 'icon-image': 'ferry',
- 'icon-color': theme.transportDefaultIconColor,
- 'text-color': theme.transportDefaultIconColor
- },
- {
- 'filter': ['==', ['get', 'amenity'], 'motorcycle_parking'],
- 'icon-image': 'motorcycle_parking',
- 'icon-color': theme.transportationIconColor,
- 'text-color': theme.transportationIconColor
- },
- {
- 'filter': ['==', ['get', 'amenity'], 'bicycle_repair_station'],
- 'icon-image': 'bicycle_repair_station',
- 'icon-color': theme.amenityIconColor,
- 'text-color': theme.amenityIconColor
- },
- {
- 'filter': ['==', ['get', 'amenity'], 'boat_rental'],
- 'icon-image': 'boat_rental',
- 'icon-color': theme.transportationIconColor,
- 'text-color': theme.transportationIconColor
- },
- {
- 'filter': [
- 'all',
- ['==', ['get', 'amenity'], 'parking_entrance'],
- ['==', ['get', 'parking'], 'multi-storey']
- ],
- 'icon-image': 'parking_entrance_multistorey',
- 'icon-color': theme.transportationIconColor,
- 'text-color': theme.transportationIconColor
- },
-
- // Road features
- // {
- // 'filter': ['==', ['get', 'oneway'], 'yes'],
- // 'icon-image': 'oneway',
- // 'icon-color': theme.defaultIconColor,
- // 'text-color': theme.defaultIconColor
- // },
- {
- 'filter': ['==', ['get', 'barrier'], 'gate'],
- 'icon-image': 'gate',
- 'icon-color': theme.defaultIconColor,
- 'text-color': theme.defaultIconColor
- },
- {
- 'filter': ['==', ['get', 'highway'], 'traffic_signals'],
- 'icon-image': 'traffic_light',
- 'icon-color': theme.defaultIconColor,
- 'text-color': theme.defaultIconColor
- },
- // {
- // 'filter': [
- // 'any',
- // ['==', ['get', 'railway'], 'level_crossing'],
- // ['==', ['get', 'railway'], 'crossing']
- // ],
- // 'icon-image': 'level_crossing2',
- // 'icon-color': theme.defaultIconColor,
- // 'text-color': theme.defaultIconColor
- // },
- {
- 'filter': [
- 'any',
- ['==', ['get', 'railway'], 'level_crossing'],
- ['==', ['get', 'railway'], 'crossing']
- ],
- 'icon-image': 'level_crossing',
- 'icon-color': theme.defaultIconColor,
- 'text-color': theme.defaultIconColor
- },
- {
- 'filter': [
- 'any',
- ['==', ['get', 'barrier'], 'bollard'],
- ['==', ['get', 'barrier'], 'block'],
- ['==', ['get', 'barrier'], 'turnstile'],
- ['==', ['get', 'barrier'], 'log']
- ],
- 'icon-image': 'gate',
- 'icon-color': theme.defaultIconColor,
- 'text-color': theme.defaultIconColor
- },
- {
- 'filter': [
- 'any',
- ['==', ['get', 'barrier'], 'lift_gate'],
- ['==', ['get', 'barrier'], 'swing_gate']
- ],
- 'icon-image': 'lift_gate',
- 'icon-color': theme.defaultIconColor,
- 'text-color': theme.defaultIconColor
- },
- {
- 'filter': ['==', ['get', 'barrier'], 'cycle_barrier'],
- 'icon-image': 'cycle_barrier',
- 'icon-color': theme.defaultIconColor,
- 'text-color': theme.defaultIconColor
- },
- {
- 'filter': ['==', ['get', 'barrier'], 'stile'],
- 'icon-image': 'stile',
- 'icon-color': theme.defaultIconColor,
- 'text-color': theme.defaultIconColor
- },
- // {
- // 'filter': ['==', ['get', 'highway'], 'mini_roundabout'],
- // 'icon-image': 'highway_mini_roundabout',
- // 'icon-color': theme.defaultIconColor,
- // 'text-color': theme.defaultIconColor
- // },
- {
- 'filter': ['==', ['get', 'barrier'], 'toll_booth'],
- 'icon-image': 'toll_booth',
- 'icon-color': theme.accommodationIconColor,
- 'text-color': theme.accommodationIconColor
- },
- {
- 'filter': ['==', ['get', 'barrier'], 'cattle_grid'],
- 'icon-image': 'barrier_cattle_grid',
- 'icon-color': theme.defaultIconColor,
- 'text-color': theme.defaultIconColor
- },
- {
- 'filter': ['==', ['get', 'barrier'], 'kissing_gate'],
- 'icon-image': 'kissing_gate',
- 'icon-color': theme.defaultIconColor,
- 'text-color': theme.defaultIconColor
- },
- {
- 'filter': ['==', ['get', 'barrier'], 'full-height_turnstile'],
- 'icon-image': 'full-height_turnstile',
- 'icon-color': theme.defaultIconColor,
- 'text-color': theme.defaultIconColor
- },
- {
- 'filter': ['==', ['get', 'barrier'], 'motorcycle_barrier'],
- 'icon-image': 'motorcycle_barrier',
- 'icon-color': theme.defaultIconColor,
- 'text-color': theme.defaultIconColor
- },
- {
- 'filter': [
- 'any',
- ['==', ['get', 'ford'], 'yes'],
- ['==', ['get', 'ford'], 'stepping_stones']
- ],
- 'icon-image': 'ford',
- 'icon-color': theme.waterIconColor,
- 'text-color': theme.waterwayTextColor
- },
- // {
- // 'filter': ['==', ['get', 'mountain_pass'], 'yes'],
- // 'icon-image': 'mountain_pass',
- // 'icon-color': theme.transportationIconColor,
- // 'text-color': theme.transportationIconColor
- // },
- {
- 'filter': ['==', ['get', 'waterway'], 'dam'],
- 'icon-image': 'place-6',
- 'icon-color': theme.waterIconColor,
- 'text-color': theme.waterTextColor
- },
- {
- 'filter': ['==', ['get', 'waterway'], 'weir'],
- 'icon-image': 'place-6',
- 'icon-color': theme.defaultIconColor,
- 'text-color': theme.defaultIconColor
- },
- {
- 'filter': ['==', ['get', 'waterway'], 'lock_gate'],
- 'icon-image': 'place-6',
- 'icon-color': theme.defaultIconColor,
- 'text-color': theme.defaultIconColor
- },
- // {
- // 'filter': ['==', ['get', 'Node with highway'], 'turning_circle at way with highway'],
- // 'icon-image': 'turning_circle_on_highway_track',
- // 'icon-color': theme.defaultIconColor,
- // 'text-color': theme.defaultIconColor
- // },
-
- // Nature
- {
- 'filter': ['==', ['get', 'natural'], 'peak'],
- 'icon-image': 'peak',
- 'icon-color': theme.defaultIconColor,
- 'text-color': theme.defaultIconColor
- },
- {
- 'filter': ['==', ['get', 'natural'], 'spring'],
- 'icon-image': 'spring',
- 'icon-color': theme.waterIconColor,
- 'text-color': theme.waterIconColor
- },
- {
- 'filter': ['==', ['get', 'natural'], 'cave_entrance'],
- 'icon-image': 'cave',
- 'icon-color': theme.defaultIconColor,
- 'text-color': theme.defaultIconColor
- },
- {
- 'filter': ['==', ['get', 'waterway'], 'waterfall'],
- 'icon-image': 'waterfall',
- 'icon-color': theme.waterIconColor,
- 'text-color': theme.waterIconColor
- },
- {
- 'filter': ['==', ['get', 'natural'], 'saddle'],
- 'icon-image': 'saddle',
- 'icon-color': theme.defaultIconColor,
- 'text-color': theme.defaultIconColor
- },
- {
- 'filter': ['==', ['get', 'natural'], 'volcano'],
- 'icon-image': 'peak',
- 'icon-color': theme.defaultIconColor,
- 'text-color': theme.defaultIconColor
- },
-
- // Administrative facilities
- {
- 'filter': ['==', ['get', 'amenity'], 'police'],
- 'icon-image': 'police',
- 'icon-color': theme.amenityIconColor,
- 'text-color': theme.amenityIconColor
- },
- {
- 'filter': ['==', ['get', 'amenity'], 'townhall'],
- 'icon-image': 'town_hall',
- 'icon-color': theme.amenityIconColor,
- 'text-color': theme.amenityIconColor
- },
- {
- 'filter': ['==', ['get', 'amenity'], 'fire_station'],
- 'icon-image': 'firestation',
- 'icon-color': theme.amenityIconColor,
- 'text-color': theme.amenityIconColor
- },
- {
- 'filter': ['==', ['get', 'amenity'], 'social_facility'],
- 'icon-image': 'social_facility',
- 'icon-color': theme.amenityIconColor,
- 'text-color': theme.amenityIconColor
- },
- {
- 'filter': ['==', ['get', 'amenity'], 'courthouse'],
- 'icon-image': 'courthouse',
- 'icon-color': theme.amenityIconColor,
- 'text-color': theme.amenityIconColor
- },
- {
- 'filter': [
- 'all',
- ['==', ['get', 'office'], 'diplomatic'],
- ['==', ['get', 'diplomatic'], 'embassy']
- ],
- 'icon-image': 'diplomatic',
- 'icon-color': theme.officeIconColor,
- 'text-color': theme.officeIconColor
- },
- {
- 'filter': [
- 'all',
- ['==', ['get', 'office'], 'diplomatic'],
- ['==', ['get', 'diplomatic'], 'consulate']
- ],
- 'icon-image': 'consulate',
- 'icon-color': theme.officeIconColor,
- 'text-color': theme.officeIconColor
- },
- {
- 'filter': ['==', ['get', 'amenity'], 'prison'],
- 'icon-image': 'prison',
- 'icon-color': theme.amenityIconColor,
- 'text-color': theme.amenityIconColor
- },
-
- // Religious place
- {
- 'filter': [
- 'all',
- ['==', ['get', 'amenity'], 'place_of_worship'],
- ['==', ['get', 'religion'], 'christian']
- ],
- 'icon-image': 'christian',
- 'icon-color': theme.religionIconColor,
- 'text-color': theme.religionIconColor
- },
- {
- 'filter': [
- 'all',
- ['==', ['get', 'amenity'], 'place_of_worship'],
- ['==', ['get', 'religion'], 'jewish']
- ],
- 'icon-image': 'jewish',
- 'icon-color': theme.religionIconColor,
- 'text-color': theme.religionIconColor
- },
- {
- 'filter': [
- 'all',
- ['==', ['get', 'amenity'], 'place_of_worship'],
- ['==', ['get', 'religion'], 'muslim']
- ],
- 'icon-image': 'muslim',
- 'icon-color': theme.religionIconColor,
- 'text-color': theme.religionIconColor
- },
- {
- 'filter': [
- 'all',
- ['==', ['get', 'amenity'], 'place_of_worship'],
- ['==', ['get', 'religion'], 'taoist']
- ],
- 'icon-image': 'taoist',
- 'icon-color': theme.religionIconColor,
- 'text-color': theme.religionIconColor
- },
- {
- 'filter': [
- 'all',
- ['==', ['get', 'amenity'], 'place_of_worship'],
- ['==', ['get', 'religion'], 'hindu']
- ],
- 'icon-image': 'hinduist',
- 'icon-color': theme.religionIconColor,
- 'text-color': theme.religionIconColor
- },
- {
- 'filter': [
- 'all',
- ['==', ['get', 'amenity'], 'place_of_worship'],
- ['==', ['get', 'religion'], 'buddhist']
- ],
- 'icon-image': 'buddhist',
- 'icon-color': theme.religionIconColor,
- 'text-color': theme.religionIconColor
- },
- {
- 'filter': [
- 'all',
- ['==', ['get', 'amenity'], 'place_of_worship'],
- ['==', ['get', 'religion'], 'shinto']
- ],
- 'icon-image': 'shintoist',
- 'icon-color': theme.religionIconColor,
- 'text-color': theme.religionIconColor
- },
- {
- 'filter': [
- 'all',
- ['==', ['get', 'amenity'], 'place_of_worship'],
- ['==', ['get', 'religion'], 'sikh']
- ],
- 'icon-image': 'sikhist',
- 'icon-color': theme.religionIconColor,
- 'text-color': theme.religionIconColor
- },
- // {
- // 'filter': [
- // 'all',
- // ['==', ['get', 'amenity'], 'place_of_worship'],
- // ['==', ['get', 'without or other religion'], '* value']
- // ],
- // 'icon-image': 'place_of_worship',
- // 'icon-color': theme.religionIconColor,
- // 'text-color': theme.religionIconColor
- // },
-
- // Shop and services
- {
- 'filter': ['==', ['get', 'amenity'], 'marketplace'],
- 'icon-image': 'marketplace',
- 'icon-color': theme.shopIconColor,
- 'text-color': theme.shopIconColor
- },
- {
- 'filter': ['==', ['get', 'shop'], 'convenience'],
- 'icon-image': 'convenience',
- 'icon-color': theme.shopIconColor,
- 'text-color': theme.shopIconColor,
- },
- {
- 'filter': ['==', ['get', 'shop'], 'supermarket'],
- 'icon-image': 'supermarket',
- 'icon-color': theme.shopIconColor,
- 'text-color': theme.shopIconColor,
- },
- {
- 'filter': [
- 'any',
- ['==', ['get', 'shop'], 'clothes'],
- ['==', ['get', 'shop'], 'fashion']
- ],
- 'icon-image': 'clothes',
- 'icon-color': theme.shopIconColor,
- 'text-color': theme.shopIconColor,
- },
- {
- 'filter': ['==', ['get', 'shop'], 'hairdresser'],
- 'icon-image': 'hairdresser',
- 'icon-color': theme.shopIconColor,
- 'text-color': theme.shopIconColor,
- },
- {
- 'filter': ['==', ['get', 'shop'], 'bakery'],
- 'icon-image': 'bakery',
- 'icon-color': theme.shopIconColor,
- 'text-color': theme.shopIconColor,
- },
- {
- 'filter': ['==', ['get', 'shop'], 'car_repair'],
- 'icon-image': 'car_repair',
- 'icon-color': theme.shopIconColor,
- 'text-color': theme.shopIconColor,
- },
- {
- 'filter': ['any',
- ['==', ['get', 'shop'], 'doityourself'],
- ['==', ['get', 'shop'], 'hardware']
- ],
- 'icon-image': 'diy',
- 'icon-color': theme.shopIconColor,
- 'text-color': theme.shopIconColor,
- },
- {
- 'filter': ['==', ['get', 'shop'], 'car'],
- 'icon-image': 'car',
- 'icon-color': theme.shopIconColor,
- 'text-color': theme.shopIconColor,
- },
- {
- 'filter': ['any',
- ['==', ['get', 'shop'], 'kiosk'],
- ['==', ['get', 'shop'], 'newsagent']
- ],
- 'icon-image': 'newsagent',
- 'icon-color': theme.shopIconColor,
- 'text-color': theme.shopIconColor,
- },
- {
- 'filter': ['==', ['get', 'shop'], 'beauty'],
- 'icon-image': 'beauty',
- 'icon-color': theme.shopIconColor,
- 'text-color': theme.shopIconColor,
- },
- {
- 'filter': ['==', ['get', 'amenity'], 'car_wash'],
- 'icon-image': 'car_wash',
- 'icon-color': theme.amenityIconColor,
- 'text-color': theme.amenityIconColor,
- },
- {
- 'filter': ['==', ['get', 'shop'], 'butcher'],
- 'icon-image': 'butcher',
- 'icon-color': theme.shopIconColor,
- 'text-color': theme.shopIconColor,
- },
- {
- 'filter': ['any',
- ['==', ['get', 'shop'], 'alcohol'],
- ['==', ['get', 'shop'], 'wine']
- ],
- 'icon-image': 'alcohol',
- 'icon-color': theme.shopIconColor,
- 'text-color': theme.shopIconColor,
- },
- {
- 'filter': ['==', ['get', 'shop'], 'furniture'],
- 'icon-image': 'furniture',
- 'icon-color': theme.shopIconColor,
- 'text-color': theme.shopIconColor,
- },
- {
- 'filter': ['==', ['get', 'shop'], 'florist'],
- 'icon-image': 'florist',
- 'icon-color': theme.shopIconColor,
- 'text-color': theme.shopIconColor,
- },
- {
- 'filter': ['==', ['get', 'shop'], 'mobile_phone'],
- 'icon-image': 'mobile_phone',
- 'icon-color': theme.shopIconColor,
- 'text-color': theme.shopIconColor,
- },
- {
- 'filter': ['==', ['get', 'shop'], 'electronics'],
- 'icon-image': 'electronics',
- 'icon-color': theme.shopIconColor,
- 'text-color': theme.shopIconColor,
- },
- {
- 'filter': ['==', ['get', 'shop'], 'shoes'],
- 'icon-image': 'shoes',
- 'icon-color': theme.shopIconColor,
- 'text-color': theme.shopIconColor,
- },
- {
- 'filter': ['==', ['get', 'shop'], 'car_parts'],
- 'icon-image': 'car_parts',
- 'icon-color': theme.shopIconColor,
- 'text-color': theme.shopIconColor,
- },
- {
- 'filter': [
- 'any',
- ['==', ['get', 'shop'], 'greengrocer'],
- ['==', ['get', 'shop'], 'farm']
- ],
- 'icon-image': 'greengrocer',
- 'icon-color': theme.shopIconColor,
- 'text-color': theme.shopIconColor,
- },
- {
- 'filter': [
- 'any',
- ['==', ['get', 'shop'], 'laundry'],
- ['==', ['get', 'shop'], 'dry_cleaning']
- ],
- 'icon-image': 'laundry',
- 'icon-color': theme.shopIconColor,
- 'text-color': theme.shopIconColor,
- },
- {
- 'filter': ['==', ['get', 'shop'], 'optician'],
- 'icon-image': 'optician',
- 'icon-color': theme.shopIconColor,
- 'text-color': theme.shopIconColor,
- },
- {
- 'filter': [
- 'any',
- ['==', ['get', 'shop'], 'jewelry'],
- ['==', ['get', 'shop'], 'jewellery']
- ],
- 'icon-image': 'jewelry',
- 'icon-color': theme.shopIconColor,
- 'text-color': theme.shopIconColor,
- },
- {
- 'filter': ['==', ['get', 'shop'], 'books'],
- 'icon-image': 'library',
- 'icon-color': theme.shopIconColor,
- 'text-color': theme.shopIconColor,
- },
- {
- 'filter': ['==', ['get', 'shop'], 'gift'],
- 'icon-image': 'gift',
- 'icon-color': theme.shopIconColor,
- 'text-color': theme.shopIconColor,
- },
- {
- 'filter': ['==', ['get', 'shop'], 'department_store'],
- 'icon-image': 'department_store',
- 'icon-color': theme.shopIconColor,
- 'text-color': theme.shopIconColor,
- },
- {
- 'filter': ['==', ['get', 'shop'], 'bicycle'],
- 'icon-image': 'bicycle',
- 'icon-color': theme.shopIconColor,
- 'text-color': theme.shopIconColor,
- },
- {
- 'filter': [
- 'any',
- ['==', ['get', 'shop'], 'confectionery'],
- ['==', ['get', 'shop'], 'chocolate'],
- ['==', ['get', 'shop'], 'pastry']
- ],
- 'icon-image': 'confectionery',
- 'icon-color': theme.shopIconColor,
- 'text-color': theme.shopIconColor,
- },
- {
- 'filter': ['==', ['get', 'shop'], 'variety_store'],
- 'icon-image': 'variety_store',
- 'icon-color': theme.shopIconColor,
- 'text-color': theme.shopIconColor,
- },
- {
- 'filter': ['==', ['get', 'shop'], 'travel_agency'],
- 'icon-image': 'travel_agency',
- 'icon-color': theme.shopIconColor,
- 'text-color': theme.shopIconColor,
- },
- {
- 'filter': ['==', ['get', 'shop'], 'sports'],
- 'icon-image': 'sports',
- 'icon-color': theme.shopIconColor,
- 'text-color': theme.shopIconColor,
- },
- {
- 'filter': ['==', ['get', 'shop'], 'chemist'],
- 'icon-image': 'chemist',
- 'icon-color': theme.shopIconColor,
- 'text-color': theme.shopIconColor,
- },
- {
- 'filter': ['==', ['get', 'shop'], 'computer'],
- 'icon-image': 'computer',
- 'icon-color': theme.shopIconColor,
- 'text-color': theme.shopIconColor,
- },
- {
- 'filter': ['==', ['get', 'shop'], 'stationery'],
- 'icon-image': 'stationery',
- 'icon-color': theme.shopIconColor,
- 'text-color': theme.shopIconColor,
- },
- {
- 'filter': ['==', ['get', 'shop'], 'pet'],
- 'icon-image': 'pet',
- 'icon-color': theme.shopIconColor,
- 'text-color': theme.shopIconColor,
- },
- {
- 'filter': ['==', ['get', 'shop'], 'beverages'],
- 'icon-image': 'beverages',
- 'icon-color': theme.shopIconColor,
- 'text-color': theme.shopIconColor,
- },
- {
- 'filter': [
- 'any',
- ['==', ['get', 'shop'], 'cosmetics'],
- ['==', ['get', 'shop'], 'perfumery']
- ],
- 'icon-image': 'perfumery',
- 'icon-color': theme.shopIconColor,
- 'text-color': theme.shopIconColor,
- },
- {
- 'filter': ['==', ['get', 'shop'], 'tyres'],
- 'icon-image': 'tyres',
- 'icon-color': theme.shopIconColor,
- 'text-color': theme.shopIconColor,
- },
- {
- 'filter': ['==', ['get', 'shop'], 'motorcycle'],
- 'icon-image': 'motorcycle',
- 'icon-color': theme.shopIconColor,
- 'text-color': theme.shopIconColor,
- },
- {
- 'filter': ['==', ['get', 'shop'], 'garden_centre'],
- 'icon-image': 'garden_centre',
- 'icon-color': theme.shopIconColor,
- 'text-color': theme.shopIconColor,
- },
- {
- 'filter': ['==', ['get', 'shop'], 'copyshop'],
- 'icon-image': 'copyshop',
- 'icon-color': theme.shopIconColor,
- 'text-color': theme.shopIconColor,
- },
- {
- 'filter': ['==', ['get', 'shop'], 'toys'],
- 'icon-image': 'toys',
- 'icon-color': theme.shopIconColor,
- 'text-color': theme.shopIconColor,
- },
- {
- 'filter': ['==', ['get', 'shop'], 'deli'],
- 'icon-image': 'deli',
- 'icon-color': theme.shopIconColor,
- 'text-color': theme.shopIconColor,
- },
- {
- 'filter': ['==', ['get', 'shop'], 'tobacco'],
- 'icon-image': 'tobacco',
- 'icon-color': theme.shopIconColor,
- 'text-color': theme.shopIconColor,
- },
- {
- 'filter': ['==', ['get', 'shop'], 'seafood'],
- 'icon-image': 'seafood',
- 'icon-color': theme.shopIconColor,
- 'text-color': theme.shopIconColor,
- },
- {
- 'filter': ['==', ['get', 'shop'], 'interior_decoration'],
- 'icon-image': 'interior_decoration',
- 'icon-color': theme.shopIconColor,
- 'text-color': theme.shopIconColor,
- },
- {
- 'filter': ['==', ['get', 'shop'], 'ticket'],
- 'icon-image': 'ticket',
- 'icon-color': theme.shopIconColor,
- 'text-color': theme.shopIconColor,
- },
- {
- 'filter': [
- 'any',
- ['==', ['get', 'shop'], 'photo'],
- ['==', ['get', 'shop'], 'photo_studio'],
- ['==', ['get', 'shop'], 'photography']
- ],
- 'icon-image': 'photo',
- 'icon-color': theme.shopIconColor,
- 'text-color': theme.shopIconColor,
- },
- {
- 'filter': [
- 'any',
- ['==', ['get', 'shop'], 'trade'],
- ['==', ['get', 'shop'], 'wholesale']
- ],
- 'icon-image': 'trade',
- 'icon-color': theme.shopIconColor,
- 'text-color': theme.shopIconColor,
- },
- {
- 'filter': ['==', ['get', 'shop'], 'outdoor'],
- 'icon-image': 'outdoor',
- 'icon-color': theme.shopIconColor,
- 'text-color': theme.shopIconColor,
- },
- {
- 'filter': ['==', ['get', 'shop'], 'houseware'],
- 'icon-image': 'houseware',
- 'icon-color': theme.shopIconColor,
- 'text-color': theme.shopIconColor,
- },
- {
- 'filter': ['==', ['get', 'shop'], 'art'],
- 'icon-image': 'art',
- 'icon-color': theme.shopIconColor,
- 'text-color': theme.shopIconColor,
- },
- {
- 'filter': ['==', ['get', 'shop'], 'paint'],
- 'icon-image': 'paint',
- 'icon-color': theme.shopIconColor,
- 'text-color': theme.shopIconColor,
- },
- {
- 'filter': ['==', ['get', 'shop'], 'fabric'],
- 'icon-image': 'fabric',
- 'icon-color': theme.shopIconColor,
- 'text-color': theme.shopIconColor,
- },
- {
- 'filter': ['==', ['get', 'shop'], 'bookmaker'],
- 'icon-image': 'bookmaker',
- 'icon-color': theme.shopIconColor,
- 'text-color': theme.shopIconColor,
- },
- {
- 'filter': ['==', ['get', 'shop'], 'second_hand'],
- 'icon-image': 'second_hand',
- 'icon-color': theme.shopIconColor,
- 'text-color': theme.shopIconColor,
- },
- {
- 'filter': ['==', ['get', 'shop'], 'charity'],
- 'icon-image': 'charity',
- 'icon-color': theme.shopIconColor,
- 'text-color': theme.shopIconColor,
- },
- {
- 'filter': ['==', ['get', 'shop'], 'bed'],
- 'icon-image': 'bed',
- 'icon-color': theme.shopIconColor,
- 'text-color': theme.shopIconColor,
- },
- {
- 'filter': ['==', ['get', 'shop'], 'medical_supply'],
- 'icon-image': 'medical_supply',
- 'icon-color': theme.shopIconColor,
- 'text-color': theme.shopIconColor,
- },
- {
- 'filter': ['==', ['get', 'shop'], 'hifi'],
- 'icon-image': 'hifi',
- 'icon-color': theme.shopIconColor,
- 'text-color': theme.shopIconColor,
- },
- {
- 'filter': ['==', ['get', 'shop'], 'music'],
- 'icon-image': 'music',
- 'icon-color': theme.shopIconColor,
- 'text-color': theme.shopIconColor,
- },
- {
- 'filter': ['==', ['get', 'shop'], 'coffee'],
- 'icon-image': 'coffee',
- 'icon-color': theme.shopIconColor,
- 'text-color': theme.shopIconColor,
- },
- {
- 'filter': ['==', ['get', 'shop'], 'musical_instrument'],
- 'icon-image': 'musical_instrument',
- 'icon-color': theme.shopIconColor,
- 'text-color': theme.shopIconColor,
- },
- {
- 'filter': ['==', ['get', 'shop'], 'tea'],
- 'icon-image': 'tea',
- 'icon-color': theme.shopIconColor,
- 'text-color': theme.shopIconColor,
- },
- {
- 'filter': ['==', ['get', 'shop'], 'video'],
- 'icon-image': 'video',
- 'icon-color': theme.shopIconColor,
- 'text-color': theme.shopIconColor,
- },
- {
- 'filter': ['==', ['get', 'shop'], 'bag'],
- 'icon-image': 'bag',
- 'icon-color': theme.shopIconColor,
- 'text-color': theme.shopIconColor,
- },
- {
- 'filter': ['==', ['get', 'shop'], 'carpet'],
- 'icon-image': 'carpet',
- 'icon-color': theme.shopIconColor,
- 'text-color': theme.shopIconColor,
- },
- {
- 'filter': ['==', ['get', 'shop'], 'video_games'],
- 'icon-image': 'video_games',
- 'icon-color': theme.shopIconColor,
- 'text-color': theme.shopIconColor,
- },
- {
- 'filter': ['==', ['get', 'amenity'], 'vehicle_inspection'],
- 'icon-image': 'vehicle_inspection',
- 'icon-color': theme.shopIconColor,
- 'text-color': theme.shopIconColor,
- },
- {
- 'filter': ['==', ['get', 'shop'], 'dairy'],
- 'icon-image': 'dairy',
- 'icon-color': theme.shopIconColor,
- 'text-color': theme.shopIconColor,
- },
- // {
- // 'filter': ['!=', ['get', 'shop'], 'yes'],
- // 'icon-image': 'place-4',
- // 'icon-color': theme.shopIconColor,
- // 'text-color': theme.shopIconColor,
- // },
- {
- 'filter': ['==', ['get', 'office'], '*'],
- 'icon-image': 'office',
- 'icon-color': theme.defaultIconColor,
- 'text-color': theme.defaultIconColor
- },
- {
- 'filter': [
- 'any',
- ['==', ['get', 'amenity'], 'nursing_home'],
- ['==', ['get', 'amenity'], 'childcare']
- ],
- 'icon-image': 'place-6',
- 'icon-color': theme.defaultIconColor,
- 'text-color': theme.defaultIconColor
- },
-
- // Landmarks, man-made infrastructure, masts and towers
- {
- 'filter': ['any', ['==', ['get', 'man_made'], 'storage_tank'], ['==', ['get', 'man_made'], 'silo']],
- 'icon-image': 'storage_tank',
- 'icon-color': theme.manMadeIconColor,
- 'text-color': theme.manMadeIconColor,
- },
- {
- 'filter': ['==', ['get', 'man_made'], 'tower'],
- 'icon-image': 'tower_generic',
- 'icon-color': theme.manMadeIconColor,
- 'text-color': theme.manMadeIconColor,
- },
- {
- 'filter': ['all', ['==', ['get', 'man_made'], 'tower'], ['==', ['get', 'tower:type'], 'communication']],
- 'icon-image': 'tower_cantilever_communication',
- 'icon-color': theme.manMadeIconColor,
- 'text-color': theme.manMadeIconColor,
- },
- {
- 'filter': [
- 'all',
- ['==', ['get', 'power'], 'generator'],
- ['any',
- ['==', ['get', 'generator:source'], 'wind'],
- ['==', ['get', 'generator:method'], 'wind_turbine)']
- ]
- ],
- 'icon-image': 'generator_wind',
- 'icon-color': theme.manMadeIconColor,
- 'text-color': theme.manMadeIconColor,
- },
- {
- 'filter': ['==', ['get', 'amenity'], 'hunting_stand'],
- 'icon-image': 'hunting_stand',
- 'icon-color': theme.manMadeIconColor,
- 'text-color': theme.manMadeIconColor,
- },
- {
- 'filter': ['any', ['==', ['get', 'historic'], 'wayside_cross'], ['==', ['get', 'man_made'], 'cross']],
- 'icon-image': 'christian',
- 'icon-color': theme.manMadeIconColor,
- 'text-color': theme.manMadeIconColor,
- },
- {
- 'filter': ['==', ['get', 'man_made'], 'water_tower'],
- 'icon-image': 'water_tower',
- 'icon-color': theme.manMadeIconColor,
- 'text-color': theme.manMadeIconColor,
- },
- {
- 'filter': ['==', ['get', 'man_made'], 'mast'],
- 'icon-image': 'mast',
- 'icon-color': theme.manMadeIconColor,
- 'text-color': theme.manMadeIconColor,
- },
- {
- filter: ['==', ['get', 'military'], 'bunker'],
- 'icon-image': 'bunker',
- 'icon-color': theme.manMadeIconColor,
- 'text-color': theme.manMadeIconColor,
- },
- {
- 'filter': ['==', ['get', 'man_made'], 'chimney'],
- 'icon-image': 'chimney',
- 'icon-color': theme.manMadeIconColor,
- 'text-color': theme.manMadeIconColor,
- },
- {
- 'filter': [
- 'any',
- [
- 'all',
- ['==', ['get', 'man_made'], 'tower'],
- ['==', ['get', 'tower:type'], 'observation']
- ],
- [
- 'all',
- ['==', ['get', 'man_made'], 'tower'],
- ['==', ['get', 'tower:type'], 'watchtower']
- ]
- ],
- 'icon-image': 'tower_observation',
- 'icon-color': theme.manMadeIconColor,
- 'text-color': theme.manMadeIconColor,
- },
- {
- 'filter': [
- 'all',
- ['==', ['get', 'man_made'], 'tower'],
- ['==', ['get', 'tower:type'], 'bell_tower']
- ],
- 'icon-image': 'tower_bell_tower',
- 'icon-color': theme.manMadeIconColor,
- 'text-color': theme.manMadeIconColor,
- },
- {
- 'filter': [
- 'all',
- ['==', ['get', 'man_made'], 'tower'],
- ['==', ['get', 'tower:type'], 'lighting']
- ],
- 'icon-image': 'tower_lighting',
- 'icon-color': theme.manMadeIconColor,
- 'text-color': theme.manMadeIconColor,
- },
- {
- 'filter': ['==', ['get', 'man_made'], 'lighthouse'],
- 'icon-image': 'lighthouse',
- 'icon-color': theme.manMadeIconColor,
- 'text-color': theme.manMadeIconColor,
- },
- {
- 'filter': ['==', ['get', 'advertising'], 'column'],
- 'icon-image': 'column',
- 'icon-color': theme.manMadeIconColor,
- 'text-color': theme.manMadeIconColor,
- },
- {
- 'filter': ['==', ['get', 'man_made'], 'crane'],
- 'icon-image': 'crane',
- 'icon-color': theme.manMadeIconColor,
- 'text-color': theme.manMadeIconColor,
- },
- {
- 'filter': ['==', ['get', 'man_made'], 'windmill'],
- 'icon-image': 'windmill',
- 'icon-color': theme.manMadeIconColor,
- 'text-color': theme.manMadeIconColor,
- },
- {
- 'filter': [
- 'all',
- ['==', ['get', 'man_made'], 'tower'],
- ['==', ['get', 'tower:type'], 'communication'],
- ['==', ['get', 'tower:construction'], 'lattice']
- ],
- 'icon-image': 'tower_lattice_communication',
- 'icon-color': theme.manMadeIconColor,
- 'text-color': theme.manMadeIconColor,
- },
- {
- 'filter': [
- 'all',
- ['==', ['get', 'man_made'], 'mast'],
- ['==', ['get', 'tower:type'], 'lighting']
- ],
- 'icon-image': 'mast_lighting',
- 'icon-color': theme.manMadeIconColor,
- 'text-color': theme.manMadeIconColor,
- },
- {
- 'filter': [
- 'all',
- ['==', ['get', 'man_made'], 'mast'],
- ['==', ['get', 'tower:type'], 'communication']
- ],
- 'icon-image': 'mast_communications',
- 'icon-color': theme.manMadeIconColor,
- 'text-color': theme.manMadeIconColor,
- },
- {
- 'filter': ['==', ['get', 'man_made'], 'communications_tower'],
- 'icon-image': 'communication_tower',
- 'icon-color': theme.manMadeIconColor,
- 'text-color': theme.manMadeIconColor,
- },
- {
- 'filter': [
- 'all',
- ['==', ['get', 'man_made'], 'tower'],
- ['==', ['get', 'tower:type'], 'defensive']
- ],
- 'icon-image': 'tower_defensive',
- 'icon-color': theme.manMadeIconColor,
- 'text-color': theme.manMadeIconColor,
- },
- {
- 'filter': [
- 'all',
- ['==', ['get', 'man_made'], 'tower'],
- ['==', ['get', 'tower:type'], 'cooling']
- ],
- 'icon-image': 'tower_cooling',
- 'icon-color': theme.manMadeIconColor,
- 'text-color': theme.manMadeIconColor,
- },
- {
- 'filter': [
- 'all',
- ['==', ['get', 'man_made'], 'tower'],
- ['==', ['get', 'tower:construction'], 'lattice']
- ],
- 'icon-image': 'tower_lattice',
- 'icon-color': theme.manMadeIconColor,
- 'text-color': theme.manMadeIconColor,
- },
- {
- 'filter': [
- 'all',
- ['==', ['get', 'man_made'], 'tower'],
- ['==', ['get', 'tower:type'], 'lighting'],
- ['==', ['get', 'tower:construction'], 'lattice']
- ],
- 'icon-image': 'tower_lattice_lighting',
- 'icon-color': theme.manMadeIconColor,
- 'text-color': theme.manMadeIconColor,
- },
- {
- 'filter': [
- 'all',
- ['==', ['get', 'man_made'], 'tower'],
- ['==', ['get', 'tower:construction'], 'dish']
- ],
- 'icon-image': 'tower_dish',
- 'icon-color': theme.manMadeIconColor,
- 'text-color': theme.manMadeIconColor,
- },
- {
- 'filter': [
- 'all',
- ['==', ['get', 'man_made'], 'tower'],
- ['==', ['get', 'tower:construction'], 'dome']
- ],
- 'icon-image': 'tower_dome',
- 'icon-color': theme.manMadeIconColor,
- 'text-color': theme.manMadeIconColor,
- },
- {
- 'filter': [
- 'all',
- ['==', ['get', 'man_made'], 'telescope'],
- ['==', ['get', 'telescope:type'], 'radio']
- ],
- 'icon-image': 'telescope_dish',
- 'icon-color': theme.manMadeIconColor,
- 'text-color': theme.manMadeIconColor,
- },
- {
- 'filter': [
- 'all',
- ['==', ['get', 'man_made'], 'telescope'],
- ['==', ['get', 'telescope:type'], 'optical']
- ],
- 'icon-image': 'telescope_dome',
- 'icon-color': theme.manMadeIconColor,
- 'text-color': theme.manMadeIconColor,
- },
-
- // Electricity
- // {
- // 'filter': ['==', ['get', 'power'], 'tower'],
- // 'icon-image': 'power_tower',
- // 'icon-color': theme.powerIconColor,
- // 'text-color': theme.powerIconColor,
- // },
- // {
- // 'filter': ['==', ['get', 'power'], 'pole'],
- // 'icon-image': 'place-6',
- // 'icon-color': theme.powerIconColor,
- // 'text-color': theme.powerIconColor,
- // },
-
- // Places
- {
- 'filter': ['==', ['get', 'place'], 'city'],
- 'icon-image': 'place-6',
- 'icon-color': theme.defaultIconColor,
- 'text-color': theme.defaultIconColor,
- },
- // {
- // 'filter': ['has', 'capital'],
- // 'icon-image': 'place_capital',
- // 'icon-color': theme.defaultIconColor,
- // 'text-color': theme.defaultIconColor,
- // },
- // {
- // 'filter': ['==', ['get', 'entrance'], 'yes'],
- // 'icon-image': 'entrance',
- // 'icon-color': theme.defaultIconColor,
- // 'text-color': theme.defaultIconColor,
- // },
- // {
- // 'filter': ['==', ['get', 'entrance'], 'main'],
- // 'icon-image': 'entrance',
- // 'icon-color': theme.defaultIconColor,
- // 'text-color': theme.defaultIconColor,
- // },
- // {
- // 'filter': ['==', ['get', 'entrance'], 'service'],
- // 'icon-image': 'entrance',
- // 'icon-color': theme.defaultIconColor,
- // 'text-color': theme.defaultIconColor,
- // },
- {
- 'filter': [
- 'all',
- ['has', 'entrance'],
- ['==', ['get', 'access'], 'no']
- ],
- 'icon-image': 'entrance',
- 'icon-color': theme.defaultIconColor,
- 'text-color': theme.defaultIconColor,
- },
-];
-
-export default asLayerObject(withSortKeys(directives), {
- id: 'icon',
- type: 'symbol',
- source: 'baremaps',
- 'source-layer': 'point',
- 'minzoom': 14,
- layout: {
- visibility: 'visible',
- 'icon-size': 1,
- 'icon-anchor': 'bottom',
- 'text-font': ['Noto Sans Regular'],
- 'text-size': 11,
- 'text-field': ['get', 'name'],
- 'text-anchor': 'top',
- 'text-optional': true,
- 'text-max-width': 5,
- },
- paint: {
- 'icon-opacity': 1,
- 'icon-translate-anchor': 'map',
- 'icon-halo-color': theme.pointIconLayerIconHaloColor,
- 'icon-halo-width': 1,
- 'text-halo-width': 1,
- 'text-halo-color': theme.pointIconLayerTextHaloColor,
- },
-});
\ No newline at end of file
diff --git a/basemap/layers/amenity/overlay.js b/basemap/layers/amenity/overlay.js
index 699960b56..cb3150a6c 100644
--- a/basemap/layers/amenity/overlay.js
+++ b/basemap/layers/amenity/overlay.js
@@ -25,12 +25,19 @@ let directives = [
['any',
['==', ['get', 'amenity'], 'bicycle_parking'],
['==', ['get', 'amenity'], 'motorcycle_parking'],
- ['==', ['get', 'amenity'], 'parking_space'],
['==', ['get', 'amenity'], 'parking'],
],
],
'fill-color': theme.amenityParkingOverlayFillColor,
- 'fill-outline-color': theme.amenityParkingOverlayOutlineColor
+ },
+ {
+ filter: [
+ 'all',
+ ['!=', ['get', 'layer'], '-1'],
+ ['==', ['get', 'amenity'], 'parking_space'],
+ ],
+ 'fill-color': theme.amenityParkingOverlayFillColor,
+ 'fill-outline-color': theme.amenityParkingOverlayOutlineColor,
},
];
diff --git a/basemap/layers/amenity/refresh.sql b/basemap/layers/amenity/refresh.sql
new file mode 100644
index 000000000..c3a4b305e
--- /dev/null
+++ b/basemap/layers/amenity/refresh.sql
@@ -0,0 +1,292 @@
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements. See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to you under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License. You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+-- Zoom level 12
+DROP
+ INDEX IF EXISTS osm_amenity_z12_filtered_geom_idx;
+
+DROP
+ INDEX IF EXISTS osm_amenity_z12_filtered_tags_idx;
+
+REFRESH MATERIALIZED VIEW osm_amenity_z12_filtered;
+
+CREATE
+ INDEX IF NOT EXISTS osm_amenity_z12_filtered_geom_idx ON
+ osm_amenity_z12_filtered
+ USING GIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_amenity_z12_filtered_tags_idx ON
+ osm_amenity_z12_filtered(tag);
+
+DROP
+ INDEX IF EXISTS osm_amenity_z12_geom_idx;
+
+DROP
+ INDEX IF EXISTS osm_amenity_z12_tags_idx;
+
+REFRESH MATERIALIZED VIEW osm_amenity_z12;
+
+CREATE
+ INDEX IF NOT EXISTS osm_amenity_z12_geom_idx ON
+ osm_amenity_z12
+ USING GIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_amenity_z12_tags_idx ON
+ osm_amenity_z12
+ USING GIN(tags);
+
+-- Zoom level 11
+DROP
+ INDEX IF EXISTS osm_amenity_z11_filtered_geom_idx;
+
+DROP
+ INDEX IF EXISTS osm_amenity_z11_filtered_tags_idx;
+
+REFRESH MATERIALIZED VIEW osm_amenity_z11_filtered;
+
+CREATE
+ INDEX IF NOT EXISTS osm_amenity_z11_filtered_geom_idx ON
+ osm_amenity_z11_filtered
+ USING GIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_amenity_z11_filtered_tags_idx ON
+ osm_amenity_z11_filtered(tag);
+
+DROP
+ INDEX IF EXISTS osm_amenity_z11_geom_idx;
+
+DROP
+ INDEX IF EXISTS osm_amenity_z11_tags_idx;
+
+REFRESH MATERIALIZED VIEW osm_amenity_z11;
+
+CREATE
+ INDEX IF NOT EXISTS osm_amenity_z11_geom_idx ON
+ osm_amenity_z11
+ USING GIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_amenity_z11_tags_idx ON
+ osm_amenity_z11
+ USING GIN(tags);
+
+-- Zoom level 10
+DROP
+ INDEX IF EXISTS osm_amenity_z10_filtered_geom_idx;
+
+DROP
+ INDEX IF EXISTS osm_amenity_z10_filtered_tags_idx;
+
+REFRESH MATERIALIZED VIEW osm_amenity_z10_filtered;
+
+CREATE
+ INDEX IF NOT EXISTS osm_amenity_z10_filtered_geom_idx ON
+ osm_amenity_z10_filtered
+ USING GIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_amenity_z10_filtered_tags_idx ON
+ osm_amenity_z10_filtered(tag);
+
+DROP
+ INDEX IF EXISTS osm_amenity_z10_geom_idx;
+
+DROP
+ INDEX IF EXISTS osm_amenity_z10_tags_idx;
+
+REFRESH MATERIALIZED VIEW osm_amenity_z10;
+
+CREATE
+ INDEX IF NOT EXISTS osm_amenity_z10_geom_idx ON
+ osm_amenity_z10
+ USING GIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_amenity_z10_tags_idx ON
+ osm_amenity_z10
+ USING GIN(tags);
+
+-- Zoom level 9
+DROP
+ INDEX IF EXISTS osm_amenity_z9_geom_idx;
+
+DROP
+ INDEX IF EXISTS osm_amenity_z9_tags_idx;
+
+REFRESH MATERIALIZED VIEW osm_amenity_z9;
+
+CREATE
+ INDEX IF NOT EXISTS osm_amenity_z9_geom_idx ON
+ osm_amenity_z9
+ USING GIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_amenity_z9_tags_idx ON
+ osm_amenity_z9
+ USING GIN(tags);
+
+-- Zoom level 8
+DROP
+ INDEX IF EXISTS osm_amenity_z8_geom_idx;
+
+DROP
+ INDEX IF EXISTS osm_amenity_z8_tags_idx;
+
+REFRESH MATERIALIZED VIEW osm_amenity_z8;
+
+CREATE
+ INDEX IF NOT EXISTS osm_amenity_z8_geom_idx ON
+ osm_amenity_z8
+ USING GIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_amenity_z8_tags_idx ON
+ osm_amenity_z8
+ USING GIN(tags);
+
+-- Zoom level 7
+DROP
+ INDEX IF EXISTS osm_amenity_z7_geom_idx;
+
+DROP
+ INDEX IF EXISTS osm_amenity_z7_tags_idx;
+
+REFRESH MATERIALIZED VIEW osm_amenity_z7;
+
+CREATE
+ INDEX IF NOT EXISTS osm_amenity_z7_geom_idx ON
+ osm_amenity_z7
+ USING GIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_amenity_z7_tags_idx ON
+ osm_amenity_z7
+ USING GIN(tags);
+
+-- Zoom level 6
+DROP
+ INDEX IF EXISTS osm_amenity_z6_geom_idx;
+
+DROP
+ INDEX IF EXISTS osm_amenity_z6_tags_idx;
+
+REFRESH MATERIALIZED VIEW osm_amenity_z6;
+
+CREATE
+ INDEX IF NOT EXISTS osm_amenity_z6_geom_idx ON
+ osm_amenity_z6
+ USING GIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_amenity_z6_tags_idx ON
+ osm_amenity_z6
+ USING GIN(tags);
+
+-- Zoom level 5
+DROP
+ INDEX IF EXISTS osm_amenity_z5_geom_idx;
+
+DROP
+ INDEX IF EXISTS osm_amenity_z5_tags_idx;
+
+REFRESH MATERIALIZED VIEW osm_amenity_z5;
+
+CREATE
+ INDEX IF NOT EXISTS osm_amenity_z5_geom_idx ON
+ osm_amenity_z5
+ USING GIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_amenity_z5_tags_idx ON
+ osm_amenity_z5
+ USING GIN(tags);
+
+-- Zoom level 4
+DROP
+ INDEX IF EXISTS osm_amenity_z4_geom_idx;
+
+DROP
+ INDEX IF EXISTS osm_amenity_z4_tags_idx;
+
+REFRESH MATERIALIZED VIEW osm_amenity_z4;
+
+CREATE
+ INDEX IF NOT EXISTS osm_amenity_z4_geom_idx ON
+ osm_amenity_z4
+ USING GIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_amenity_z4_tags_idx ON
+ osm_amenity_z4
+ USING GIN(tags);
+
+-- Zoom level 3
+DROP
+ INDEX IF EXISTS osm_amenity_z3_geom_idx;
+
+DROP
+ INDEX IF EXISTS osm_amenity_z3_tags_idx;
+
+REFRESH MATERIALIZED VIEW osm_amenity_z3;
+
+CREATE
+ INDEX IF NOT EXISTS osm_amenity_z3_geom_idx ON
+ osm_amenity_z3
+ USING GIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_amenity_z3_tags_idx ON
+ osm_amenity_z3
+ USING GIN(tags);
+
+-- Zoom level 2
+DROP
+ INDEX IF EXISTS osm_amenity_z2_geom_idx;
+
+DROP
+ INDEX IF EXISTS osm_amenity_z2_tags_idx;
+
+REFRESH MATERIALIZED VIEW osm_amenity_z2;
+
+CREATE
+ INDEX IF NOT EXISTS osm_amenity_z2_geom_idx ON
+ osm_amenity_z2
+ USING GIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_amenity_z2_tags_idx ON
+ osm_amenity_z2
+ USING GIN(tags);
+
+-- Zoom level 1
+DROP
+ INDEX IF EXISTS osm_amenity_z1_geom_idx;
+
+DROP
+ INDEX IF EXISTS osm_amenity_z1_tags_idx;
+
+REFRESH MATERIALIZED VIEW osm_amenity_z1;
+
+CREATE
+ INDEX IF NOT EXISTS osm_amenity_z1_geom_idx ON
+ osm_amenity_z1
+ USING GIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_amenity_z1_tags_idx ON
+ osm_amenity_z1
+ USING GIN(tags);
diff --git a/basemap/layers/amenity/tileset.js b/basemap/layers/amenity/tileset.js
index 2c374af46..1fda5dc63 100644
--- a/basemap/layers/amenity/tileset.js
+++ b/basemap/layers/amenity/tileset.js
@@ -18,9 +18,9 @@ export default {
id: 'amenity',
queries: [
{
- minzoom: 13,
+ minzoom: 1,
maxzoom: 20,
- sql: "SELECT id, tags, geom FROM osm_ways WHERE tags ? 'amenity'",
+ sql: "SELECT id, tags, geom FROM osm_amenity_z$zoom",
},
],
}
diff --git a/basemap/layers/attraction/create.sql b/basemap/layers/attraction/create.sql
new file mode 100644
index 000000000..f55843cd0
--- /dev/null
+++ b/basemap/layers/attraction/create.sql
@@ -0,0 +1,24 @@
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements. See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to you under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License. You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+CREATE
+ OR REPLACE VIEW osm_attraction AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_way
+ WHERE
+ geom IS NOT NULL
+ AND tags ? 'attraction';
\ No newline at end of file
diff --git a/basemap/layers/attraction/tileset.js b/basemap/layers/attraction/tileset.js
index 18179ab43..25ece39c9 100644
--- a/basemap/layers/attraction/tileset.js
+++ b/basemap/layers/attraction/tileset.js
@@ -20,7 +20,7 @@ export default {
{
minzoom: 13,
maxzoom: 20,
- sql: "SELECT id, tags, geom FROM osm_ways WHERE tags ? 'attraction'",
+ sql: "SELECT id, tags, geom FROM osm_attraction",
},
],
}
diff --git a/basemap/layers/linestring/refresh.sql b/basemap/layers/barrier/create.sql
similarity index 81%
rename from basemap/layers/linestring/refresh.sql
rename to basemap/layers/barrier/create.sql
index f665292ea..9f78f474f 100644
--- a/basemap/layers/linestring/refresh.sql
+++ b/basemap/layers/barrier/create.sql
@@ -12,5 +12,13 @@
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-
-REFRESH MATERIALIZED VIEW osm_linestring;
+CREATE
+ OR REPLACE VIEW osm_barrier AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_way
+ WHERE
+ geom IS NOT NULL
+ AND tags ? 'barrier';
\ No newline at end of file
diff --git a/basemap/layers/barrier/tileset.js b/basemap/layers/barrier/tileset.js
index 06c567a19..d2fe107f3 100644
--- a/basemap/layers/barrier/tileset.js
+++ b/basemap/layers/barrier/tileset.js
@@ -21,7 +21,7 @@ export default {
minzoom: 14,
maxzoom: 20,
sql:
- "SELECT id, tags, geom FROM osm_ways WHERE tags ? 'barrier'",
+ "SELECT id, tags, geom FROM osm_barrier",
},
],
}
diff --git a/basemap/layers/linestring/index.sql b/basemap/layers/boundary/create.sql
similarity index 81%
rename from basemap/layers/linestring/index.sql
rename to basemap/layers/boundary/create.sql
index 6c82ea122..bf455b1d0 100644
--- a/basemap/layers/linestring/index.sql
+++ b/basemap/layers/boundary/create.sql
@@ -12,6 +12,13 @@
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-
-CREATE INDEX IF NOT EXISTS osm_linestring_tags_index ON osm_linestring USING gin (tags);
-CREATE INDEX IF NOT EXISTS osm_linestring_geom_index ON osm_linestring USING gist (geom);
\ No newline at end of file
+CREATE
+ OR REPLACE VIEW osm_boundary AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_way
+ WHERE
+ geom IS NOT NULL
+ AND tags ? 'boundary';
\ No newline at end of file
diff --git a/basemap/layers/boundary/tileset.js b/basemap/layers/boundary/tileset.js
index ad3eb3c5f..66a990ca2 100644
--- a/basemap/layers/boundary/tileset.js
+++ b/basemap/layers/boundary/tileset.js
@@ -21,7 +21,7 @@ export default {
minzoom: 13,
maxzoom: 20,
sql:
- "SELECT id, tags, geom FROM osm_ways WHERE tags ? 'boundary'",
+ "SELECT id, tags, geom FROM osm_boundary",
},
],
}
diff --git a/basemap/layers/building/create.sql b/basemap/layers/building/create.sql
new file mode 100644
index 000000000..935c77033
--- /dev/null
+++ b/basemap/layers/building/create.sql
@@ -0,0 +1,121 @@
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements. See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to you under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License. You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+CREATE
+ OR REPLACE VIEW osm_building AS SELECT
+ id,
+ tags || jsonb_build_object(
+ 'extrusion:base',
+ CASE
+ WHEN tags ? 'min_height' THEN convert_to_number(
+ tags ->> 'min_height',
+ 0
+ )
+ WHEN tags ? 'building:min_height' THEN convert_to_number(
+ tags ->> 'building:min_height',
+ 0
+ )
+ WHEN tags ? 'building:min_level' THEN convert_to_number(
+ tags ->> 'building:min_level',
+ 0
+ )* 3
+ ELSE 0
+ END,
+ 'extrusion:height',
+ CASE
+ WHEN tags ? 'height' THEN convert_to_number(
+ tags ->> 'height',
+ 6
+ )
+ WHEN tags ? 'building:height' THEN convert_to_number(
+ tags ->> 'building:height',
+ 6
+ )
+ WHEN tags ? 'building:levels' THEN convert_to_number(
+ tags ->> 'building:levels',
+ 2
+ )* 3
+ ELSE 6
+ END
+ ) AS tags,
+ geom
+ FROM
+ osm_way
+ WHERE
+ (
+ tags ? 'building'
+ OR tags ? 'building:part'
+ )
+ AND(
+ (
+ NOT tags ? 'layer'
+ )
+ OR convert_to_number(
+ tags ->> 'layer',
+ 0
+ )>= 0
+ )
+UNION SELECT
+ id,
+ tags || jsonb_build_object(
+ 'extrusion:base',
+ CASE
+ WHEN tags ? 'min_height' THEN convert_to_number(
+ tags ->> 'min_height',
+ 0
+ )
+ WHEN tags ? 'building:min_height' THEN convert_to_number(
+ tags ->> 'building:min_height',
+ 0
+ )
+ WHEN tags ? 'building:min_level' THEN convert_to_number(
+ tags ->> 'building:min_level',
+ 0
+ )* 3
+ ELSE 0
+ END,
+ 'extrusion:height',
+ CASE
+ WHEN tags ? 'height' THEN convert_to_number(
+ tags ->> 'height',
+ 6
+ )
+ WHEN tags ? 'building:height' THEN convert_to_number(
+ tags ->> 'building:height',
+ 6
+ )
+ WHEN tags ? 'building:levels' THEN convert_to_number(
+ tags ->> 'building:levels',
+ 2
+ )* 3
+ ELSE 6
+ END
+ ) AS tags,
+ geom
+ FROM
+ osm_relation
+ WHERE
+ (
+ tags ? 'building'
+ OR tags ? 'building:part'
+ )
+ AND(
+ (
+ NOT tags ? 'layer'
+ )
+ OR convert_to_number(
+ tags ->> 'layer',
+ 0
+ )>= 0
+ )
diff --git a/basemap/layers/building/tileset.js b/basemap/layers/building/tileset.js
index b57e588bb..c55173d80 100644
--- a/basemap/layers/building/tileset.js
+++ b/basemap/layers/building/tileset.js
@@ -21,64 +21,7 @@ export default {
{
minzoom: 13,
maxzoom: 20,
- sql: `
- SELECT
- id,
- tags
- || jsonb_build_object('extrusion:base',
- CASE
- WHEN tags ? 'min_height'
- THEN convert_to_number(tags ->> 'min_height', 0)
- WHEN tags ? 'building:min_height'
- THEN convert_to_number(tags ->> 'building:min_height', 0)
- WHEN tags ? 'building:min_level'
- THEN convert_to_number(tags ->> 'building:min_level', 0) * 3
- ELSE 0
- END)
- || jsonb_build_object('extrusion:height',
- CASE
- WHEN tags ? 'height'
- THEN convert_to_number(tags ->> 'height', 6)
- WHEN tags ? 'building:height'
- THEN convert_to_number(tags ->> 'building:height', 6)
- WHEN tags ? 'building:levels'
- THEN convert_to_number(tags ->> 'building:levels', 2) * 3
- ELSE 6
- END) as tags,
- geom
- FROM osm_ways
- WHERE (tags ? 'building' OR tags ? 'building:part') AND ((NOT tags ? 'layer') OR convert_to_number(tags ->> 'layer', 0) >= 0)`,
- },
- {
- minzoom: 13,
- maxzoom: 20,
- sql: `
- SELECT
- id,
- tags
- || jsonb_build_object('extrusion:base',
- CASE
- WHEN tags ? 'min_height'
- THEN convert_to_number(tags ->> 'min_height', 0)
- WHEN tags ? 'building:min_height'
- THEN convert_to_number(tags ->> 'building:min_height', 0)
- WHEN tags ? 'building:min_level'
- THEN convert_to_number(tags ->> 'building:min_level', 0) * 3
- ELSE 0
- END)
- || jsonb_build_object('extrusion:height',
- CASE
- WHEN tags ? 'height'
- THEN convert_to_number(tags ->> 'height', 6)
- WHEN tags ? 'building:height'
- THEN convert_to_number(tags ->> 'building:height', 6)
- WHEN tags ? 'building:levels'
- THEN convert_to_number(tags ->> 'building:levels', 2) * 3
- ELSE 6
- END) as tags,
- geom
- FROM osm_relations
- WHERE (tags ? 'building' OR tags ? 'building:part') AND ((NOT tags ? 'layer') OR convert_to_number(tags ->> 'layer', 0) >= 0)`,
+ sql: `SELECT id, tags, geom FROM osm_building`,
},
],
}
diff --git a/basemap/layers/header/create.sql b/basemap/layers/header/create.sql
new file mode 100644
index 000000000..c19b277e0
--- /dev/null
+++ b/basemap/layers/header/create.sql
@@ -0,0 +1,27 @@
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements. See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to you under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License. You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+DROP
+ TABLE
+ IF EXISTS osm_header;
+
+CREATE
+ TABLE
+ IF NOT EXISTS osm_header(
+ replication_sequence_number BIGINT PRIMARY KEY,
+ replication_timestamp TIMESTAMP WITHOUT TIME ZONE,
+ replication_url text,
+ SOURCE text,
+ writing_program text
+ );
\ No newline at end of file
diff --git a/basemap/layers/highway/clean.sql b/basemap/layers/highway/clean.sql
deleted file mode 100644
index d8c26559b..000000000
--- a/basemap/layers/highway/clean.sql
+++ /dev/null
@@ -1,38 +0,0 @@
--- Licensed to the Apache Software Foundation (ASF) under one or more
--- contributor license agreements. See the NOTICE file distributed with
--- this work for additional information regarding copyright ownership.
--- The ASF licenses this file to you under the Apache License, Version 2.0
--- (the "License"); you may not use this file except in compliance with
--- the License. You may obtain a copy of the License at
---
--- http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing, software
--- distributed under the License is distributed on an "AS IS" BASIS,
--- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--- See the License for the specific language governing permissions and
--- limitations under the License.
-
-DROP MATERIALIZED VIEW IF EXISTS osm_highway CASCADE;
-
-DROP VIEW IF EXISTS osm_highway_z20 CASCADE;
-DROP VIEW IF EXISTS osm_highway_z19 CASCADE;
-DROP VIEW IF EXISTS osm_highway_z18 CASCADE;
-DROP VIEW IF EXISTS osm_highway_z17 CASCADE;
-DROP VIEW IF EXISTS osm_highway_z16 CASCADE;
-DROP VIEW IF EXISTS osm_highway_z15 CASCADE;
-DROP VIEW IF EXISTS osm_highway_z14 CASCADE;
-DROP VIEW IF EXISTS osm_highway_z13 CASCADE;
-
-DROP MATERIALIZED VIEW IF EXISTS osm_highway_z12 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_highway_z11 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_highway_z10 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_highway_z9 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_highway_z8 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_highway_z7 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_highway_z6 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_highway_z5 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_highway_z4 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_highway_z3 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_highway_z2 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_highway_z1 CASCADE;
diff --git a/basemap/layers/highway/create.sql b/basemap/layers/highway/create.sql
new file mode 100644
index 000000000..42d85abce
--- /dev/null
+++ b/basemap/layers/highway/create.sql
@@ -0,0 +1,500 @@
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements. See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to you under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License. You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+-- Zoom levels 20-13
+CREATE
+ OR REPLACE VIEW osm_highway AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_way
+ WHERE
+ osm_way.geom IS NOT NULL
+ AND tags ? 'highway';
+
+CREATE
+ OR REPLACE VIEW osm_highway_z20 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_highway;
+
+CREATE
+ OR REPLACE VIEW osm_highway_z19 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_highway;
+
+CREATE
+ OR REPLACE VIEW osm_highway_z18 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_highway;
+
+CREATE
+ OR REPLACE VIEW osm_highway_z17 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_highway;
+
+CREATE
+ OR REPLACE VIEW osm_highway_z16 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_highway;
+
+CREATE
+ OR REPLACE VIEW osm_highway_z15 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_highway;
+
+CREATE
+ OR REPLACE VIEW osm_highway_z14 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_highway;
+
+CREATE
+ OR REPLACE VIEW osm_highway_z13 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_highway
+ WHERE
+ tags ->> 'highway' IN(
+ 'motorway',
+ 'motorway_link',
+ 'trunk',
+ 'trunk_link',
+ 'primary',
+ 'primary_link',
+ 'secondary',
+ 'secondary_link',
+ 'tertiary',
+ 'tertiary_link',
+ 'unclassified',
+ 'residential'
+ );
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_highway_filtered CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_highway_filtered AS SELECT
+ tags -> 'highway' AS highway,
+ geom AS geom
+ FROM
+ osm_highway
+ WHERE
+ tags ->> 'highway' IN(
+ 'motorway',
+ 'motorway_link',
+ 'trunk',
+ 'trunk_link',
+ 'primary',
+ 'primary_link',
+ 'secondary',
+ 'secondary_link',
+ 'tertiary',
+ 'tertiary_link',
+ 'unclassified',
+ 'residential'
+ ) WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_highway_clustered CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_highway_clustered AS SELECT
+ highway AS highway,
+ geom AS geom,
+ ST_ClusterDBSCAN(
+ geom,
+ 0,
+ 1
+ ) OVER(
+ PARTITION BY highway
+ ) AS cluster
+ FROM
+ osm_highway_filtered WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_highway_simplified CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_highway_simplified AS WITH merged AS(
+ SELECT
+ highway AS highway,
+ ST_LineMerge(
+ ST_Collect(geom)
+ ) AS geom
+ FROM
+ osm_highway_clustered
+ GROUP BY
+ highway,
+ cluster
+ ),
+ exploded AS(
+ SELECT
+ highway AS highway,
+ (
+ ST_Dump(geom)
+ ).geom AS geom
+ FROM
+ merged
+ ) SELECT
+ ROW_NUMBER() OVER() AS id,
+ jsonb_build_object(
+ 'highway',
+ highway
+ ) AS tags,
+ geom AS geom
+ FROM
+ exploded WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_highway_z12 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_highway_z12 AS SELECT
+ id,
+ tags,
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 12 )
+ ) AS geom
+ FROM
+ osm_highway_simplified
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND(
+ st_area(
+ st_envelope(geom)
+ )> POWER(( 78270 / POWER( 2, 12 )), 2 )
+ ) WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_highway_z11 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_highway_z11 AS SELECT
+ id,
+ tags,
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 11 )
+ ) AS geom
+ FROM
+ osm_highway_simplified
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND(
+ st_area(
+ st_envelope(geom)
+ )> POWER(( 78270 / POWER( 2, 11 )), 2 )
+ )
+ AND tags ->> 'highway' IN(
+ 'motorway',
+ 'motorway_link',
+ 'trunk',
+ 'trunk_link',
+ 'primary',
+ 'primary_link',
+ 'secondary',
+ 'secondary_link',
+ 'tertiary',
+ 'tertiary_link',
+ 'unclassified',
+ 'residential'
+ ) WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_highway_z10 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_highway_z10 AS SELECT
+ id,
+ tags,
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 10 )
+ ) AS geom
+ FROM
+ osm_highway_simplified
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND(
+ st_area(
+ st_envelope(geom)
+ )> POWER(( 78270 / POWER( 2, 10 )), 2 )
+ )
+ AND tags ->> 'highway' IN(
+ 'motorway',
+ 'motorway_link',
+ 'trunk',
+ 'trunk_link',
+ 'primary',
+ 'primary_link',
+ 'secondary',
+ 'secondary_link',
+ 'tertiary',
+ 'tertiary_link'
+ ) WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_highway_z9 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_highway_z9 AS SELECT
+ id,
+ tags,
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 9 )
+ ) AS geom
+ FROM
+ osm_highway_simplified
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND(
+ st_area(
+ st_envelope(geom)
+ )> POWER(( 78270 / POWER( 2, 9 )), 2 )
+ )
+ AND tags ->> 'highway' IN(
+ 'motorway',
+ 'motorway_link',
+ 'trunk',
+ 'trunk_link',
+ 'primary',
+ 'primary_link',
+ 'secondary',
+ 'secondary_link'
+ ) WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_highway_z8 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_highway_z8 AS SELECT
+ id,
+ tags,
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 8 )
+ ) AS geom
+ FROM
+ osm_highway_simplified
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND(
+ st_area(
+ st_envelope(geom)
+ )> POWER(( 78270 / POWER( 2, 8 )), 2 )
+ )
+ AND tags ->> 'highway' IN(
+ 'motorway',
+ 'trunk',
+ 'primary'
+ ) WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_highway_z7 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_highway_z7 AS SELECT
+ id,
+ tags,
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 7 )
+ ) AS geom
+ FROM
+ osm_highway_simplified
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND(
+ st_area(
+ st_envelope(geom)
+ )> POWER(( 78270 / POWER( 2, 7 )), 2 )
+ )
+ AND tags ->> 'highway' IN(
+ 'motorway',
+ 'trunk',
+ 'primary'
+ ) WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_highway_z6 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_highway_z6 AS SELECT
+ id,
+ tags,
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 6 )
+ ) AS geom
+ FROM
+ osm_highway_simplified
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND(
+ st_area(
+ st_envelope(geom)
+ )> POWER(( 78270 / POWER( 2, 6 )), 2 )
+ )
+ AND tags ->> 'highway' IN(
+ 'motorway',
+ 'trunk',
+ 'primary'
+ ) WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_highway_z5 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_highway_z5 AS SELECT
+ id,
+ tags,
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 5 )
+ ) AS geom
+ FROM
+ osm_highway_simplified
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND(
+ st_area(
+ st_envelope(geom)
+ )> POWER(( 78270 / POWER( 2, 5 )), 2 )
+ )
+ AND tags ->> 'highway' IN('motorway') WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_highway_z4 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_highway_z4 AS SELECT
+ id,
+ tags,
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 4 )
+ ) AS geom
+ FROM
+ osm_highway_simplified
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND(
+ st_area(
+ st_envelope(geom)
+ )> POWER(( 78270 / POWER( 2, 4 )), 2 )
+ )
+ AND tags ->> 'highway' IN('motorway') WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_highway_z3 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_highway_z3 AS SELECT
+ id,
+ tags,
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 3 )
+ ) AS geom
+ FROM
+ osm_highway_simplified
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND(
+ st_area(
+ st_envelope(geom)
+ )> POWER(( 78270 / POWER( 2, 3 )), 2 )
+ )
+ AND tags ->> 'highway' IN('motorway') WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_highway_z2 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_highway_z2 AS SELECT
+ id,
+ tags,
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 2 )
+ ) AS geom
+ FROM
+ osm_highway_simplified
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND(
+ st_area(
+ st_envelope(geom)
+ )> POWER(( 78270 / POWER( 2, 2 )), 2 )
+ )
+ AND tags ->> 'highway' IN('motorway') WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_highway_z1 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_highway_z1 AS SELECT
+ id,
+ tags,
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 1 )
+ ) AS geom
+ FROM
+ osm_highway_simplified
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND(
+ st_area(
+ st_envelope(geom)
+ )> POWER(( 78270 / POWER( 2, 1 )), 2 )
+ )
+ AND tags ->> 'highway' IN('motorway') WITH NO DATA;
diff --git a/basemap/layers/highway/index.sql b/basemap/layers/highway/index.sql
deleted file mode 100644
index 979ea722d..000000000
--- a/basemap/layers/highway/index.sql
+++ /dev/null
@@ -1,26 +0,0 @@
--- Licensed to the Apache Software Foundation (ASF) under one or more
--- contributor license agreements. See the NOTICE file distributed with
--- this work for additional information regarding copyright ownership.
--- The ASF licenses this file to you under the Apache License, Version 2.0
--- (the "License"); you may not use this file except in compliance with
--- the License. You may obtain a copy of the License at
---
--- http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing, software
--- distributed under the License is distributed on an "AS IS" BASIS,
--- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--- See the License for the specific language governing permissions and
--- limitations under the License.
-CREATE INDEX IF NOT EXISTS osm_highway_geom_z1_index ON osm_highway_z1 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_highway_geom_z2_index ON osm_highway_z2 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_highway_geom_z3_index ON osm_highway_z3 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_highway_geom_z4_index ON osm_highway_z4 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_highway_geom_z5_index ON osm_highway_z5 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_highway_geom_z6_index ON osm_highway_z6 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_highway_geom_z7_index ON osm_highway_z7 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_highway_geom_z8_index ON osm_highway_z8 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_highway_geom_z9_index ON osm_highway_z9 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_highway_geom_z10_index ON osm_highway_z10 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_highway_geom_z11_index ON osm_highway_z11 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_highway_geom_z12_index ON osm_highway_z12 USING SPGIST (geom);
diff --git a/basemap/layers/highway/prepare.sql b/basemap/layers/highway/prepare.sql
deleted file mode 100644
index b29d130d3..000000000
--- a/basemap/layers/highway/prepare.sql
+++ /dev/null
@@ -1,62 +0,0 @@
--- Licensed to the Apache Software Foundation (ASF) under one or more
--- contributor license agreements. See the NOTICE file distributed with
--- this work for additional information regarding copyright ownership.
--- The ASF licenses this file to you under the Apache License, Version 2.0
--- (the "License"); you may not use this file except in compliance with
--- the License. You may obtain a copy of the License at
---
--- http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing, software
--- distributed under the License is distributed on an "AS IS" BASIS,
--- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--- See the License for the specific language governing permissions and
--- limitations under the License.
-CREATE MATERIALIZED VIEW osm_highway AS
-WITH
- -- Filter the linestrings
- filtered AS (
- SELECT
- tags -> 'highway' AS highway,
- tags -> 'construction' AS construction,
- geom AS geom
- FROM osm_linestring
- WHERE tags ->> 'highway' IN ('motorway', 'motorway_link', 'trunk', 'trunk_link', 'primary', 'primary_link', 'secondary', 'secondary_link', 'tertiary', 'tertiary_link', 'unclassified', 'residential', 'construction')
- ),
- -- Cluster the linestrings by highway type
- clustered AS (
- SELECT
- highway AS highway,
- construction AS construction,
- geom as geom,
- ST_ClusterDBSCAN(geom, 0, 1) OVER (PARTITION BY highway) AS cluster
- FROM
- filtered
- ),
- -- Merge the linestrings into a single geometry per cluster
- merged AS (
- SELECT
- highway AS highway,
- construction AS construction,
- ST_LineMerge(ST_Collect(geom)) AS geom
- FROM
- clustered
- GROUP BY
- highway, construction, cluster
- ),
- -- Explode the merged linestrings into individual linestrings
- exploded AS (
- SELECT
- highway AS highway,
- construction AS construction,
- (ST_Dump(geom)).geom AS geom
- FROM
- merged
- )
-SELECT
- row_number() OVER () AS id,
- jsonb_build_object('highway', highway, 'construction', construction) AS tags,
- geom AS geom
-FROM exploded;
-
-CREATE INDEX IF NOT EXISTS osm_highway_geom_index ON osm_highway USING SPGIST (geom);
diff --git a/basemap/layers/highway/refresh.sql b/basemap/layers/highway/refresh.sql
index cfb9bc4a2..38e7e4e20 100644
--- a/basemap/layers/highway/refresh.sql
+++ b/basemap/layers/highway/refresh.sql
@@ -12,18 +12,152 @@
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
+DROP
+ INDEX IF EXISTS osm_highway_filtered_geom;
-REFRESH MATERIALIZED VIEW osm_highway;
+REFRESH MATERIALIZED VIEW osm_highway_filtered;
+
+CREATE
+ INDEX IF NOT EXISTS osm_highway_filtered_geom ON
+ osm_highway_filtered
+ USING GIST(geom);
+
+DROP
+ INDEX IF EXISTS osm_highway_clustered_geom;
+
+REFRESH MATERIALIZED VIEW osm_highway_clustered;
+
+CREATE
+ INDEX IF NOT EXISTS osm_highway_clustered_geom ON
+ osm_highway_clustered
+ USING GIST(geom);
+
+DROP
+ INDEX IF EXISTS osm_highway_simplified_geom;
+
+REFRESH MATERIALIZED VIEW osm_highway_simplified;
+
+CREATE
+ INDEX IF NOT EXISTS osm_highway_simplified_geom ON
+ osm_highway_simplified
+ USING GIST(geom);
+
+DROP
+ INDEX IF EXISTS osm_highway_z12_geom_idx;
REFRESH MATERIALIZED VIEW osm_highway_z12;
+
+CREATE
+ INDEX IF NOT EXISTS osm_highway_z12_geom_idx ON
+ osm_highway_z12
+ USING GIST(geom);
+
+DROP
+ INDEX IF EXISTS osm_highway_z11_geom_idx;
+
REFRESH MATERIALIZED VIEW osm_highway_z11;
+
+CREATE
+ INDEX IF NOT EXISTS osm_highway_z11_geom_idx ON
+ osm_highway_z11
+ USING GIST(geom);
+
+DROP
+ INDEX IF EXISTS osm_highway_z10_geom_idx;
+
REFRESH MATERIALIZED VIEW osm_highway_z10;
+
+CREATE
+ INDEX IF NOT EXISTS osm_highway_z10_geom_idx ON
+ osm_highway_z10
+ USING GIST(geom);
+
+DROP
+ INDEX IF EXISTS osm_highway_z9_geom_idx;
+
REFRESH MATERIALIZED VIEW osm_highway_z9;
+
+CREATE
+ INDEX IF NOT EXISTS osm_highway_z9_geom_idx ON
+ osm_highway_z9
+ USING GIST(geom);
+
+DROP
+ INDEX IF EXISTS osm_highway_z8_geom_idx;
+
REFRESH MATERIALIZED VIEW osm_highway_z8;
+
+CREATE
+ INDEX IF NOT EXISTS osm_highway_z8_geom_idx ON
+ osm_highway_z8
+ USING GIST(geom);
+
+DROP
+ INDEX IF EXISTS osm_highway_z7_geom_idx;
+
REFRESH MATERIALIZED VIEW osm_highway_z7;
+
+CREATE
+ INDEX IF NOT EXISTS osm_highway_z7_geom_idx ON
+ osm_highway_z7
+ USING GIST(geom);
+
+DROP
+ INDEX IF EXISTS osm_highway_z6_geom_idx;
+
REFRESH MATERIALIZED VIEW osm_highway_z6;
+
+CREATE
+ INDEX IF NOT EXISTS osm_highway_z6_geom_idx ON
+ osm_highway_z6
+ USING GIST(geom);
+
+DROP
+ INDEX IF EXISTS osm_highway_z5_geom_idx;
+
REFRESH MATERIALIZED VIEW osm_highway_z5;
+
+CREATE
+ INDEX IF NOT EXISTS osm_highway_z5_geom_idx ON
+ osm_highway_z5
+ USING GIST(geom);
+
+DROP
+ INDEX IF EXISTS osm_highway_z4_geom_idx;
+
REFRESH MATERIALIZED VIEW osm_highway_z4;
+
+CREATE
+ INDEX IF NOT EXISTS osm_highway_z4_geom_idx ON
+ osm_highway_z4
+ USING GIST(geom);
+
+DROP
+ INDEX IF EXISTS osm_highway_z3_geom_idx;
+
REFRESH MATERIALIZED VIEW osm_highway_z3;
+
+CREATE
+ INDEX IF NOT EXISTS osm_highway_z3_geom_idx ON
+ osm_highway_z3
+ USING GIST(geom);
+
+DROP
+ INDEX IF EXISTS osm_highway_z2_geom_idx;
+
REFRESH MATERIALIZED VIEW osm_highway_z2;
-REFRESH MATERIALIZED VIEW osm_highway_z1;
\ No newline at end of file
+
+CREATE
+ INDEX IF NOT EXISTS osm_highway_z2_geom_idx ON
+ osm_highway_z2
+ USING GIST(geom);
+
+DROP
+ INDEX IF EXISTS osm_highway_z1_geom_idx;
+
+REFRESH MATERIALIZED VIEW osm_highway_z1;
+
+CREATE
+ INDEX IF NOT EXISTS osm_highway_z1_geom_idx ON
+ osm_highway_z1
+ USING GIST(geom);
diff --git a/basemap/layers/highway/simplify.sql b/basemap/layers/highway/simplify.sql
deleted file mode 100644
index faeb24f42..000000000
--- a/basemap/layers/highway/simplify.sql
+++ /dev/null
@@ -1,110 +0,0 @@
--- Licensed to the Apache Software Foundation (ASF) under one or more
--- contributor license agreements. See the NOTICE file distributed with
--- this work for additional information regarding copyright ownership.
--- The ASF licenses this file to you under the Apache License, Version 2.0
--- (the "License"); you may not use this file except in compliance with
--- the License. You may obtain a copy of the License at
---
--- http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing, software
--- distributed under the License is distributed on an "AS IS" BASIS,
--- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--- See the License for the specific language governing permissions and
--- limitations under the License.
-
-CREATE VIEW osm_highway_z20 AS
-SELECT id, tags, geom FROM osm_highway;
-
-CREATE VIEW osm_highway_z19 AS
-SELECT id, tags, geom FROM osm_highway;
-
-CREATE VIEW osm_highway_z18 AS
-SELECT id, tags, geom FROM osm_highway;
-
-CREATE VIEW osm_highway_z17 AS
-SELECT id, tags, geom FROM osm_highway;
-
-CREATE VIEW osm_highway_z16 AS
-SELECT id, tags, geom FROM osm_highway;
-
-CREATE VIEW osm_highway_z15 AS
-SELECT id, tags, geom FROM osm_highway;
-
-CREATE VIEW osm_highway_z14 AS
-SELECT id, tags, geom FROM osm_highway;
-
-CREATE VIEW osm_highway_z13 AS
-SELECT id, tags, geom FROM osm_highway;
-
-CREATE MATERIALIZED VIEW osm_highway_z12 AS
-SELECT id, tags, geom
-FROM (SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 12)) AS geom FROM osm_highway) AS osm_highway
-WHERE geom IS NOT NULL AND (st_area(st_envelope(geom)) > power((78270 / power(2, 12)), 2))
- AND tags ->> 'highway' IN ( 'motorway', 'motorway_link', 'trunk', 'trunk_link', 'primary', 'primary_link', 'secondary', 'secondary_link', 'tertiary', 'tertiary_link', 'unclassified', 'residential', 'construction');
-
-CREATE MATERIALIZED VIEW osm_highway_z11 AS
-SELECT id, tags, geom
-FROM (SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 11)) AS geom FROM osm_highway) AS osm_highway
-WHERE geom IS NOT NULL AND (st_area(st_envelope(geom)) > power((78270 / power(2, 11)), 2))
- AND tags ->> 'highway' IN ( 'motorway', 'motorway_link', 'trunk', 'trunk_link', 'primary', 'primary_link', 'secondary', 'secondary_link', 'tertiary', 'tertiary_link', 'unclassified', 'residential');
-
-CREATE MATERIALIZED VIEW osm_highway_z10 AS
-SELECT id, tags, geom
-FROM (SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 10)) AS geom FROM osm_highway) AS osm_highway
-WHERE geom IS NOT NULL AND (st_area(st_envelope(geom)) > power((78270 / power(2, 10)), 2))
- AND tags ->> 'highway' IN ( 'motorway', 'motorway_link', 'trunk', 'trunk_link', 'primary', 'primary_link', 'secondary', 'secondary_link', 'tertiary', 'tertiary_link');
-
-CREATE MATERIALIZED VIEW osm_highway_z9 AS
-SELECT id, tags, geom
-FROM (SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 9)) AS geom FROM osm_highway) AS osm_highway
-WHERE geom IS NOT NULL AND (st_area(st_envelope(geom)) > power((78270 / power(2, 9)), 2))
- AND tags ->> 'highway' IN ( 'motorway', 'motorway_link', 'trunk', 'trunk_link', 'primary', 'primary_link', 'secondary', 'secondary_link');
-
-CREATE MATERIALIZED VIEW osm_highway_z8 AS
-SELECT id, tags, geom
-FROM (SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 8)) AS geom FROM osm_highway) AS osm_highway
-WHERE geom IS NOT NULL AND (st_area(st_envelope(geom)) > power((78270 / power(2, 8)), 2))
- AND tags ->> 'highway' IN ( 'motorway', 'trunk', 'primary');
-
-CREATE MATERIALIZED VIEW osm_highway_z7 AS
-SELECT id, tags, geom
-FROM (SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 7)) AS geom FROM osm_highway) AS osm_highway
-WHERE geom IS NOT NULL AND (st_area(st_envelope(geom)) > power((78270 / power(2, 7)), 2))
- AND tags ->> 'highway' IN ( 'motorway', 'trunk', 'primary');
-
-CREATE MATERIALIZED VIEW osm_highway_z6 AS
-SELECT id, tags, geom
-FROM (SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 6)) AS geom FROM osm_highway) AS osm_highway
-WHERE geom IS NOT NULL AND (st_area(st_envelope(geom)) > power((78270 / power(2, 6)), 2))
- AND tags ->> 'highway' IN ( 'motorway', 'trunk', 'primary');
-
-CREATE MATERIALIZED VIEW osm_highway_z5 AS
-SELECT id, tags, geom
-FROM (SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 5)) AS geom FROM osm_highway) AS osm_highway
-WHERE geom IS NOT NULL AND (st_area(st_envelope(geom)) > power((78270 / power(2, 5)), 2))
- AND tags ->> 'highway' IN ( 'motorway');
-
-CREATE MATERIALIZED VIEW osm_highway_z4 AS
-SELECT id, tags, geom
-FROM (SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 4)) AS geom FROM osm_highway) AS osm_highway
-WHERE geom IS NOT NULL AND (st_area(st_envelope(geom)) > power((78270 / power(2, 4)), 2))
- AND tags ->> 'highway' IN ( 'motorway');
-
-CREATE MATERIALIZED VIEW osm_highway_z3 AS
-SELECT id, tags, geom
-FROM (SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 3)) AS geom FROM osm_highway) AS osm_highway
-WHERE geom IS NOT NULL AND (st_area(st_envelope(geom)) > power((78270 / power(2, 3)), 2))
- AND tags ->> 'highway' IN ( 'motorway');
-
-CREATE MATERIALIZED VIEW osm_highway_z2 AS
-SELECT id, tags, geom
-FROM (SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 2)) AS geom FROM osm_highway) AS osm_highway
-WHERE geom IS NOT NULL AND (st_area(st_envelope(geom)) > power((78270 / power(2, 2)), 2))
- AND tags ->> 'highway' IN ( 'motorway');
-
-CREATE MATERIALIZED VIEW osm_highway_z1 AS
-SELECT id, tags, geom
-FROM (SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 1)) AS geom FROM osm_highway) AS osm_highway
-WHERE geom IS NOT NULL AND (st_area(st_envelope(geom)) > power((78270 / power(2, 1)), 2))
- AND tags ->> 'highway' IN ( 'motorway');
diff --git a/basemap/layers/highway/tileset.js b/basemap/layers/highway/tileset.js
index c29abd69f..48d8090a1 100644
--- a/basemap/layers/highway/tileset.js
+++ b/basemap/layers/highway/tileset.js
@@ -20,15 +20,9 @@ export default {
queries: [
{
minzoom: 4,
- maxzoom: 14,
- sql:
- "SELECT id, tags, geom FROM osm_highway_z$zoom",
- },
- {
- minzoom: 14,
maxzoom: 20,
sql:
- "SELECT id, tags, geom FROM osm_ways WHERE tags ? 'highway'",
+ "SELECT id, tags, geom FROM osm_highway_z$zoom",
},
],
}
diff --git a/basemap/layers/landuse/clean.sql b/basemap/layers/landuse/clean.sql
deleted file mode 100644
index 1032d5c6a..000000000
--- a/basemap/layers/landuse/clean.sql
+++ /dev/null
@@ -1,72 +0,0 @@
--- Licensed to the Apache Software Foundation (ASF) under one or more
--- contributor license agreements. See the NOTICE file distributed with
--- this work for additional information regarding copyright ownership.
--- The ASF licenses this file to you under the Apache License, Version 2.0
--- (the "License"); you may not use this file except in compliance with
--- the License. You may obtain a copy of the License at
---
--- http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing, software
--- distributed under the License is distributed on an "AS IS" BASIS,
--- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--- See the License for the specific language governing permissions and
--- limitations under the License.
-
-DROP MATERIALIZED VIEW IF EXISTS osm_landuse_filtered CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_landuse_clustered CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_landuse_grouped CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_landuse_buffered CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_landuse_exploded CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_landuse CASCADE;
-
-DROP MATERIALIZED VIEW IF EXISTS osm_landuse_xl_filtered CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_landuse_xl_clustered CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_landuse_xl_grouped CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_landuse_xl_buffered CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_landuse_xl_exploded CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_landuse_xl CASCADE;
-
-DROP MATERIALIZED VIEW IF EXISTS osm_landuse_l_filtered CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_landuse_l_clustered CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_landuse_l_grouped CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_landuse_l_buffered CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_landuse_l_exploded CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_landuse_l CASCADE;
-
-DROP MATERIALIZED VIEW IF EXISTS osm_landuse_m_filtered CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_landuse_m_clustered CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_landuse_m_grouped CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_landuse_m_buffered CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_landuse_m_exploded CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_landuse_m CASCADE;
-
-DROP MATERIALIZED VIEW IF EXISTS osm_landuse_s_filtered CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_landuse_s_clustered CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_landuse_s_grouped CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_landuse_s_buffered CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_landuse_s_exploded CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_landuse_s CASCADE;
-
-DROP VIEW IF EXISTS osm_landuse_z20 CASCADE;
-DROP VIEW IF EXISTS osm_landuse_z19 CASCADE;
-DROP VIEW IF EXISTS osm_landuse_z18 CASCADE;
-DROP VIEW IF EXISTS osm_landuse_z17 CASCADE;
-DROP VIEW IF EXISTS osm_landuse_z16 CASCADE;
-DROP VIEW IF EXISTS osm_landuse_z15 CASCADE;
-DROP VIEW IF EXISTS osm_landuse_z14 CASCADE;
-DROP VIEW IF EXISTS osm_landuse_z13 CASCADE;
-
-DROP MATERIALIZED VIEW IF EXISTS osm_landuse_z12 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_landuse_z11 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_landuse_z10 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_landuse_z9 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_landuse_z8 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_landuse_z7 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_landuse_z6 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_landuse_z5 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_landuse_z4 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_landuse_z3 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_landuse_z2 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_landuse_z1 CASCADE;
-
diff --git a/basemap/layers/landuse/create.sql b/basemap/layers/landuse/create.sql
new file mode 100644
index 000000000..b7ebf65ee
--- /dev/null
+++ b/basemap/layers/landuse/create.sql
@@ -0,0 +1,765 @@
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements. See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to you under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License. You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+-- Zoom levels 20 to 13
+CREATE
+ OR REPLACE VIEW osm_landuse AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_way
+ WHERE
+ tags ? 'landuse'
+UNION SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_relation
+ WHERE
+ tags ? 'landuse';
+
+CREATE
+ OR REPLACE VIEW osm_landuse_z20 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_landuse;
+
+CREATE
+ OR REPLACE VIEW osm_landuse_z19 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_landuse;
+
+CREATE
+ OR REPLACE VIEW osm_landuse_z18 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_landuse;
+
+CREATE
+ OR REPLACE VIEW osm_landuse_z17 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_landuse;
+
+CREATE
+ OR REPLACE VIEW osm_landuse_z16 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_landuse;
+
+CREATE
+ OR REPLACE VIEW osm_landuse_z15 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_landuse;
+
+CREATE
+ OR REPLACE VIEW osm_landuse_z14 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_landuse;
+
+CREATE
+ OR REPLACE VIEW osm_landuse_z13 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_landuse;
+
+-- Zoom level 12
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_landuse_z12_filtered CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_landuse_z12_filtered AS SELECT
+ tags -> 'landuse' AS tag,
+ st_buffer(
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 12 )
+ ),
+ 78270 / POWER( 2, 12 )* 1.1,
+ 'join=mitre'
+ ) AS geom
+ FROM
+ osm_landuse
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 12 ), 2 )* 32
+ AND tags ->> 'landuse' IN(
+ 'allotments',
+ 'commercial',
+ 'brownfield',
+ 'construction',
+ 'industrial',
+ 'residential',
+ 'retail',
+ 'farmland',
+ 'farmyard',
+ 'forest',
+ 'meadow',
+ 'greenhouse_horticulture',
+ 'meadow',
+ 'orchard',
+ 'plant_nursery',
+ 'vineyard',
+ 'basin',
+ 'salt_pond',
+ 'brownfield',
+ 'cemetery',
+ 'grass',
+ 'greenfield',
+ 'landfill',
+ 'quarry',
+ 'railway'
+ ) WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_landuse_z12 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_landuse_z12 AS WITH clustered AS(
+ SELECT
+ tag,
+ geom,
+ st_clusterdbscan(
+ geom,
+ 0,
+ 0
+ ) OVER(
+ PARTITION BY tag
+ ) AS cluster
+ FROM
+ osm_landuse_z12_filtered
+ ) SELECT
+ ROW_NUMBER() OVER() AS id,
+ jsonb_build_object(
+ 'landuse',
+ tag
+ ) AS tags,
+ st_simplifypreservetopology(
+ (
+ st_dump(
+ st_buffer(
+ st_collect(geom),
+ - 78270 / POWER( 2, 12 ),
+ 'join=mitre'
+ )
+ )
+ ).geom,
+ 78270 / POWER( 2, 12 )
+ ) AS geom
+ FROM
+ clustered
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 12 ), 2 )* 32
+ GROUP BY
+ tag,
+ cluster WITH NO DATA;
+
+-- Zoom level 11
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_landuse_z11_filtered CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_landuse_z11_filtered AS SELECT
+ tags -> 'landuse' AS tag,
+ st_buffer(
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 11 )
+ ),
+ 78270 / POWER( 2, 11 )* 1.1,
+ 'join=mitre'
+ ) AS geom
+ FROM
+ osm_landuse_z12
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 11 ), 2 )* 32 WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_landuse_z11 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_landuse_z11 AS WITH clustered AS(
+ SELECT
+ tag,
+ geom,
+ st_clusterdbscan(
+ geom,
+ 0,
+ 0
+ ) OVER(
+ PARTITION BY tag
+ ) AS cluster
+ FROM
+ osm_landuse_z11_filtered
+ ) SELECT
+ ROW_NUMBER() OVER() AS id,
+ jsonb_build_object(
+ 'landuse',
+ tag
+ ) AS tags,
+ st_simplifypreservetopology(
+ (
+ st_dump(
+ st_buffer(
+ st_collect(geom),
+ - 78270 / POWER( 2, 11 ),
+ 'join=mitre'
+ )
+ )
+ ).geom,
+ 78270 / POWER( 2, 11 )
+ ) AS geom
+ FROM
+ clustered
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 11 ), 2 )* 32
+ GROUP BY
+ tag,
+ cluster WITH NO DATA;
+
+-- Zoom level 10
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_landuse_z10_filtered CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_landuse_z10_filtered AS SELECT
+ tags -> 'landuse' AS tag,
+ st_buffer(
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 10 )
+ ),
+ 78270 / POWER( 2, 10 )* 1.1,
+ 'join=mitre'
+ ) AS geom
+ FROM
+ osm_landuse_z11
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 10 ), 2 )* 32 WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_landuse_z10 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_landuse_z10 AS WITH clustered AS(
+ SELECT
+ tag,
+ geom,
+ st_clusterdbscan(
+ geom,
+ 0,
+ 0
+ ) OVER(
+ PARTITION BY tag
+ ) AS cluster
+ FROM
+ osm_landuse_z10_filtered
+ ) SELECT
+ ROW_NUMBER() OVER() AS id,
+ jsonb_build_object(
+ 'landuse',
+ tag
+ ) AS tags,
+ st_simplifypreservetopology(
+ (
+ st_dump(
+ st_buffer(
+ st_collect(geom),
+ - 78270 / POWER( 2, 10 ),
+ 'join=mitre'
+ )
+ )
+ ).geom,
+ 78270 / POWER( 2, 10 )
+ ) AS geom
+ FROM
+ clustered
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 10 ), 2 )* 32
+ GROUP BY
+ tag,
+ cluster WITH NO DATA;
+
+-- Zoom level 9
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_landuse_z9 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_landuse_z9 AS WITH filtered AS(
+ SELECT
+ tags -> 'landuse' AS tag,
+ st_buffer(
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 9 )
+ ),
+ 78270 / POWER( 2, 9 )* 1.1,
+ 'join=mitre'
+ ) AS geom
+ FROM
+ osm_landuse_z10
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 9 ), 2 )* 32
+ ),
+ clustered AS(
+ SELECT
+ tag,
+ geom,
+ st_clusterdbscan(
+ geom,
+ 0,
+ 0
+ ) OVER(
+ PARTITION BY tag
+ ) AS cluster
+ FROM
+ filtered
+ ) SELECT
+ ROW_NUMBER() OVER() AS id,
+ jsonb_build_object(
+ 'landuse',
+ tag
+ ) AS tags,
+ st_simplifypreservetopology(
+ (
+ st_dump(
+ st_buffer(
+ st_collect(geom),
+ - 78270 / POWER( 2, 9 ),
+ 'join=mitre'
+ )
+ )
+ ).geom,
+ 78270 / POWER( 2, 9 )
+ ) AS geom
+ FROM
+ clustered
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 9 ), 2 )* 32
+ GROUP BY
+ tag,
+ cluster WITH NO DATA;
+
+-- Zoom level 8
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_landuse_z8 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_landuse_z8 AS WITH filtered AS(
+ SELECT
+ tags -> 'landuse' AS tag,
+ st_buffer(
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 8 )
+ ),
+ 78270 / POWER( 2, 8 )* 1.1,
+ 'join=mitre'
+ ) AS geom
+ FROM
+ osm_landuse_z9
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 8 ), 2 )* 32
+ ),
+ clustered AS(
+ SELECT
+ tag,
+ geom,
+ st_clusterdbscan(
+ geom,
+ 0,
+ 0
+ ) OVER(
+ PARTITION BY tag
+ ) AS cluster
+ FROM
+ filtered
+ ) SELECT
+ ROW_NUMBER() OVER() AS id,
+ jsonb_build_object(
+ 'landuse',
+ tag
+ ) AS tags,
+ st_simplifypreservetopology(
+ (
+ st_dump(
+ st_buffer(
+ st_collect(geom),
+ - 78270 / POWER( 2, 8 ),
+ 'join=mitre'
+ )
+ )
+ ).geom,
+ 78270 / POWER( 2, 8 )
+ ) AS geom
+ FROM
+ clustered
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 8 ), 2 )* 32
+ GROUP BY
+ tag,
+ cluster WITH NO DATA;
+
+-- Zoom level 7
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_landuse_z7 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_landuse_z7 AS WITH filtered AS(
+ SELECT
+ tags -> 'landuse' AS tag,
+ st_buffer(
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 7 )
+ ),
+ 78270 / POWER( 2, 7 )* 1.1,
+ 'join=mitre'
+ ) AS geom
+ FROM
+ osm_landuse_z8
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 7 ), 2 )* 32
+ ),
+ clustered AS(
+ SELECT
+ tag,
+ geom,
+ st_clusterdbscan(
+ geom,
+ 0,
+ 0
+ ) OVER(
+ PARTITION BY tag
+ ) AS cluster
+ FROM
+ filtered
+ ) SELECT
+ ROW_NUMBER() OVER() AS id,
+ jsonb_build_object(
+ 'landuse',
+ tag
+ ) AS tags,
+ st_simplifypreservetopology(
+ (
+ st_dump(
+ st_buffer(
+ st_collect(geom),
+ - 78270 / POWER( 2, 7 ),
+ 'join=mitre'
+ )
+ )
+ ).geom,
+ 78270 / POWER( 2, 7 )
+ ) AS geom
+ FROM
+ clustered
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 7 ), 2 )* 32
+ GROUP BY
+ tag,
+ cluster WITH NO DATA;
+
+-- Zoom level 6
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_landuse_z6 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_landuse_z6 AS WITH filtered AS(
+ SELECT
+ tags -> 'landuse' AS tag,
+ st_buffer(
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 6 )
+ ),
+ 78270 / POWER( 2, 6 )* 1.1,
+ 'join=mitre'
+ ) AS geom
+ FROM
+ osm_landuse_z7
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 6 ), 2 )* 32
+ ),
+ clustered AS(
+ SELECT
+ tag,
+ geom,
+ st_clusterdbscan(
+ geom,
+ 0,
+ 0
+ ) OVER(
+ PARTITION BY tag
+ ) AS cluster
+ FROM
+ filtered
+ ) SELECT
+ ROW_NUMBER() OVER() AS id,
+ jsonb_build_object(
+ 'landuse',
+ tag
+ ) AS tags,
+ st_simplifypreservetopology(
+ (
+ st_dump(
+ st_buffer(
+ st_collect(geom),
+ - 78270 / POWER( 2, 6 ),
+ 'join=mitre'
+ )
+ )
+ ).geom,
+ 78270 / POWER( 2, 6 )
+ ) AS geom
+ FROM
+ clustered
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 6 ), 2 )* 32
+ GROUP BY
+ tag,
+ cluster WITH NO DATA;
+
+-- Zoom level 5
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_landuse_z5 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_landuse_z5 AS WITH filtered AS(
+ SELECT
+ tags -> 'landuse' AS tag,
+ st_buffer(
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 5 )
+ ),
+ 78270 / POWER( 2, 5 )* 1.1,
+ 'join=mitre'
+ ) AS geom
+ FROM
+ osm_landuse_z6
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 5 ), 2 )* 32
+ ),
+ clustered AS(
+ SELECT
+ tag,
+ geom,
+ st_clusterdbscan(
+ geom,
+ 0,
+ 0
+ ) OVER(
+ PARTITION BY tag
+ ) AS cluster
+ FROM
+ filtered
+ ) SELECT
+ ROW_NUMBER() OVER() AS id,
+ jsonb_build_object(
+ 'landuse',
+ tag
+ ) AS tags,
+ st_simplifypreservetopology(
+ (
+ st_dump(
+ st_buffer(
+ st_collect(geom),
+ - 78270 / POWER( 2, 5 ),
+ 'join=mitre'
+ )
+ )
+ ).geom,
+ 78270 / POWER( 2, 5 )
+ ) AS geom
+ FROM
+ clustered
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 5 ), 2 )* 32
+ GROUP BY
+ tag,
+ cluster WITH NO DATA;
+
+-- Zoom level 4
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_landuse_z4 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_landuse_z4 AS WITH filtered AS(
+ SELECT
+ tags -> 'landuse' AS tag,
+ st_buffer(
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 4 )
+ ),
+ 78270 / POWER( 2, 4 )* 1.1,
+ 'join=mitre'
+ ) AS geom
+ FROM
+ osm_landuse_z6
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 4 ), 2 )* 32
+ ),
+ clustered AS(
+ SELECT
+ tag,
+ geom,
+ st_clusterdbscan(
+ geom,
+ 0,
+ 0
+ ) OVER(
+ PARTITION BY tag
+ ) AS cluster
+ FROM
+ filtered
+ ) SELECT
+ ROW_NUMBER() OVER() AS id,
+ jsonb_build_object(
+ 'landuse',
+ tag
+ ) AS tags,
+ st_simplifypreservetopology(
+ (
+ st_dump(
+ st_buffer(
+ st_collect(geom),
+ - 78270 / POWER( 2, 4 ),
+ 'join=mitre'
+ )
+ )
+ ).geom,
+ 78270 / POWER( 2, 4 )
+ ) AS geom
+ FROM
+ clustered
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 4 ), 2 )* 32
+ GROUP BY
+ tag,
+ cluster WITH NO DATA;
+
+-- Zoom level 3
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_landuse_z3 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_landuse_z3 AS SELECT
+ id,
+ tags,
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 3 )
+ ) AS geom
+ FROM
+ osm_landuse_z4
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 3 ), 2 )* 16 WITH NO DATA;
+
+-- Zoom level 2
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_landuse_z2 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_landuse_z2 AS SELECT
+ id,
+ tags,
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 2 )
+ ) AS geom
+ FROM
+ osm_landuse_z4
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 2 ), 2 )* 16 WITH NO DATA;
+
+-- Zoom level 1
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_landuse_z1 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_landuse_z1 AS SELECT
+ id,
+ tags,
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 1 )
+ ) AS geom
+ FROM
+ osm_landuse_z4
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 1 ), 2 )* 16 WITH NO DATA;
diff --git a/basemap/layers/landuse/index.sql b/basemap/layers/landuse/index.sql
deleted file mode 100644
index fa739a877..000000000
--- a/basemap/layers/landuse/index.sql
+++ /dev/null
@@ -1,26 +0,0 @@
--- Licensed to the Apache Software Foundation (ASF) under one or more
--- contributor license agreements. See the NOTICE file distributed with
--- this work for additional information regarding copyright ownership.
--- The ASF licenses this file to you under the Apache License, Version 2.0
--- (the "License"); you may not use this file except in compliance with
--- the License. You may obtain a copy of the License at
---
--- http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing, software
--- distributed under the License is distributed on an "AS IS" BASIS,
--- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--- See the License for the specific language governing permissions and
--- limitations under the License.
-CREATE INDEX IF NOT EXISTS osm_landuse_geom_z1_index ON osm_landuse_z1 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_landuse_geom_z2_index ON osm_landuse_z2 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_landuse_geom_z3_index ON osm_landuse_z3 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_landuse_geom_z4_index ON osm_landuse_z4 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_landuse_geom_z5_index ON osm_landuse_z5 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_landuse_geom_z6_index ON osm_landuse_z6 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_landuse_geom_z7_index ON osm_landuse_z7 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_landuse_geom_z8_index ON osm_landuse_z8 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_landuse_geom_z9_index ON osm_landuse_z9 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_landuse_geom_z10_index ON osm_landuse_z10 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_landuse_geom_z11_index ON osm_landuse_z11 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_landuse_geom_z12_index ON osm_landuse_z12 USING SPGIST (geom);
diff --git a/basemap/layers/landuse/prepare.sql b/basemap/layers/landuse/prepare.sql
deleted file mode 100644
index 520c2fc88..000000000
--- a/basemap/layers/landuse/prepare.sql
+++ /dev/null
@@ -1,232 +0,0 @@
--- Licensed to the Apache Software Foundation (ASF) under one or more
--- contributor license agreements. See the NOTICE file distributed with
--- this work for additional information regarding copyright ownership.
--- The ASF licenses this file to you under the Apache License, Version 2.0
--- (the "License"); you may not use this file except in compliance with
--- the License. You may obtain a copy of the License at
---
--- http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing, software
--- distributed under the License is distributed on an "AS IS" BASIS,
--- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--- See the License for the specific language governing permissions and
--- limitations under the License.
-CREATE MATERIALIZED VIEW osm_landuse_filtered AS
-SELECT
- tags -> 'landuse' AS landuse,
- st_simplifypreservetopology(geom, 78270 / power(2, 12)) AS geom
-FROM osm_polygon
-WHERE geom IS NOT NULL
- AND st_area(geom) > 78270 / power(2, 12) * 100
- AND tags ->> 'landuse' IN ('commercial', 'construction', 'industrial', 'residential', 'retail', 'farmland', 'forest', 'meadow', 'greenhouse_horticulture', 'meadow', 'orchard', 'plant_nursery','vineyard', 'basin', 'salt_pond', 'brownfield', 'cemetery', 'grass', 'greenfield', 'landfill', 'military', 'quarry', 'railway');
-CREATE INDEX IF NOT EXISTS osm_landuse_filtered_geom_idx ON osm_landuse_filtered USING GIST (geom);
-CREATE INDEX IF NOT EXISTS osm_landuse_filtered_tags_idx ON osm_landuse_filtered (landuse);
-
-CREATE MATERIALIZED VIEW osm_landuse_clustered AS
-SELECT
- landuse,
- geom,
- st_clusterdbscan(geom, 0, 0) OVER(PARTITION BY landuse) AS cluster
-FROM osm_landuse_filtered
-WHERE geom IS NOT NULL;
-CREATE INDEX IF NOT EXISTS osm_landuse_clustered_geom_idx ON osm_landuse_clustered USING GIST (geom);
-CREATE INDEX IF NOT EXISTS osm_landuse_clustered_tags_idx ON osm_landuse_clustered (landuse);
-
-CREATE MATERIALIZED VIEW osm_landuse_grouped AS
-SELECT
- landuse,
- st_collect(geom) AS geom
-FROM osm_landuse_clustered
-GROUP BY landuse, cluster;
-
-CREATE MATERIALIZED VIEW osm_landuse_buffered AS
-SELECT
- landuse,
- st_buffer(geom, 0, 'join=mitre') AS geom
-FROM osm_landuse_grouped;
-
-CREATE MATERIALIZED VIEW osm_landuse_exploded AS
-SELECT
- landuse,
- (st_dump(geom)).geom AS geom
-FROM osm_landuse_buffered;
-
-CREATE MATERIALIZED VIEW osm_landuse AS
-SELECT
- row_number() OVER () AS id,
- jsonb_build_object('landuse', landuse) AS tags,
- geom
-FROM osm_landuse_exploded;
-
--- XTRA LARGE
-CREATE MATERIALIZED VIEW osm_landuse_xl_filtered AS
-SELECT
- id,
- tags -> 'landuse' as landuse,
- st_buffer(st_simplifypreservetopology(geom, 78270 / power(2, 8)), 78270 / power(2, 8), 'join=mitre') AS geom
-FROM osm_landuse
-WHERE st_area(st_envelope(geom)) > 25 * power(78270 / power(2, 8), 2);
-
-CREATE MATERIALIZED VIEW osm_landuse_xl_clustered AS
-SELECT
- landuse,
- geom,
- st_clusterdbscan(geom, 0, 0) OVER(PARTITION BY landuse) AS cluster
-FROM osm_landuse_xl_filtered;
-
-CREATE MATERIALIZED VIEW osm_landuse_xl_grouped AS
-SELECT
- landuse,
- cluster,
- st_collect(geom) AS geom
-FROM osm_landuse_xl_clustered
-GROUP BY landuse, cluster;
-
-CREATE MATERIALIZED VIEW osm_landuse_xl_buffered AS
-SELECT
- landuse,
- st_buffer(geom, -78270 / power(2, 8), 'join=mitre') AS geom
-FROM osm_landuse_xl_grouped;
-
-CREATE MATERIALIZED VIEW osm_landuse_xl_exploded AS
-SELECT
- landuse,
- (st_dump(geom)).geom AS geom
-FROM osm_landuse_xl_buffered;
-
-CREATE MATERIALIZED VIEW osm_landuse_xl AS
-SELECT
- row_number() OVER () AS id,
- jsonb_build_object('landuse', landuse) AS tags,
- geom AS geom
-FROM osm_landuse_xl_buffered;
-
--- LARGE
-CREATE MATERIALIZED VIEW osm_landuse_l_filtered AS
-SELECT
- id,
- tags -> 'landuse' as landuse,
- st_buffer(st_simplifypreservetopology(geom, 78270 / power(2, 6)), 78270 / power(2, 7), 'join=mitre') AS geom
-FROM osm_landuse
-WHERE st_area(st_envelope(geom)) > 5 * power(78270 / power(2, 7), 2);
-
-CREATE MATERIALIZED VIEW osm_landuse_l_clustered AS
-SELECT
- landuse,
- geom,
- st_clusterdbscan(geom, 0, 0) OVER(PARTITION BY landuse) AS cluster
-FROM osm_landuse_l_filtered;
-
-CREATE MATERIALIZED VIEW osm_landuse_l_grouped AS
-SELECT
- landuse,
- cluster,
- st_collect(geom) AS geom
-FROM osm_landuse_l_clustered
-GROUP BY landuse, cluster;
-
-CREATE MATERIALIZED VIEW osm_landuse_l_buffered AS
-SELECT
- landuse,
- st_buffer(geom, 0.5 * -78270 / power(2, 7), 'join=mitre') AS geom
-FROM osm_landuse_l_grouped;
-
-CREATE MATERIALIZED VIEW osm_landuse_l_exploded AS
-SELECT
- landuse,
- (st_dump(geom)).geom AS geom
-FROM osm_landuse_l_buffered;
-
-CREATE MATERIALIZED VIEW osm_landuse_l AS
-SELECT
- row_number() OVER () AS id,
- jsonb_build_object('landuse', landuse) AS tags,
- geom AS geom
-FROM osm_landuse_l_buffered;
-
--- MEDIUM
-CREATE MATERIALIZED VIEW osm_landuse_m_filtered AS
-SELECT
- id,
- tags -> 'landuse' as landuse,
- st_buffer(st_simplifypreservetopology(geom, 78270 / power(2, 5)), 78270 / power(2, 6), 'join=mitre') AS geom
-FROM osm_landuse
-WHERE st_area(st_envelope(geom)) > 10 * power(78270 / power(2, 6), 2);
-
-CREATE MATERIALIZED VIEW osm_landuse_m_clustered AS
-SELECT
- landuse,
- geom,
- st_clusterdbscan(geom, 0, 0) OVER(PARTITION BY landuse) AS cluster
-FROM osm_landuse_m_filtered;
-
-CREATE MATERIALIZED VIEW osm_landuse_m_grouped AS
-SELECT
- landuse,
- cluster,
- st_collect(geom) AS geom
-FROM osm_landuse_m_clustered
-GROUP BY landuse, cluster;
-
-CREATE MATERIALIZED VIEW osm_landuse_m_buffered AS
-SELECT
- landuse,
- st_buffer(geom, 0.1 * -78270 / power(2, 6), 'join=mitre') AS geom
-FROM osm_landuse_m_grouped;
-
-CREATE MATERIALIZED VIEW osm_landuse_m_exploded AS
-SELECT
- landuse,
- (st_dump(geom)).geom AS geom
-FROM osm_landuse_m_buffered;
-
-CREATE MATERIALIZED VIEW osm_landuse_m AS
-SELECT
- row_number() OVER () AS id,
- jsonb_build_object('landuse', landuse) AS tags,
- geom AS geom
-FROM osm_landuse_m_buffered;
-
--- SMALL
-CREATE MATERIALIZED VIEW osm_landuse_s_filtered AS
-SELECT
- id,
- tags -> 'landuse' as landuse,
- st_buffer(st_simplifypreservetopology(geom, 78270 / power(2, 4)), 78270 / power(2, 5), 'join=mitre') AS geom
-FROM osm_landuse
-WHERE st_area(st_envelope(geom)) > 15 * power(78270 / power(2, 5), 2);
-
-CREATE MATERIALIZED VIEW osm_landuse_s_clustered AS
-SELECT
- landuse,
- geom,
- st_clusterdbscan(geom, 0, 0) OVER(PARTITION BY landuse) AS cluster
-FROM osm_landuse_s_filtered;
-
-CREATE MATERIALIZED VIEW osm_landuse_s_grouped AS
-SELECT
- landuse,
- cluster,
- st_collect(geom) AS geom
-FROM osm_landuse_s_clustered
-GROUP BY landuse, cluster;
-
-CREATE MATERIALIZED VIEW osm_landuse_s_buffered AS
-SELECT
- landuse,
- st_buffer(geom, 0, 'join=mitre') AS geom
-FROM osm_landuse_s_grouped;
-
-CREATE MATERIALIZED VIEW osm_landuse_s_exploded AS
-SELECT
- landuse,
- (st_dump(geom)).geom AS geom
-FROM osm_landuse_s_buffered;
-
-CREATE MATERIALIZED VIEW osm_landuse_s AS
-SELECT
- row_number() OVER () AS id,
- jsonb_build_object('landuse', landuse) AS tags,
- geom AS geom
-FROM osm_landuse_s_buffered;
diff --git a/basemap/layers/landuse/refresh.sql b/basemap/layers/landuse/refresh.sql
index 0cfb37f55..91511261b 100644
--- a/basemap/layers/landuse/refresh.sql
+++ b/basemap/layers/landuse/refresh.sql
@@ -12,51 +12,281 @@
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
+-- Zoom level 12
+DROP
+ INDEX IF EXISTS osm_landuse_z12_filtered_geom_idx;
-REFRESH MATERIALIZED VIEW osm_landuse_filtered;
-REFRESH MATERIALIZED VIEW osm_landuse_clustered;
-REFRESH MATERIALIZED VIEW osm_landuse_grouped;
-REFRESH MATERIALIZED VIEW osm_landuse_buffered;
-REFRESH MATERIALIZED VIEW osm_landuse_exploded;
-REFRESH MATERIALIZED VIEW osm_landuse;
-
-REFRESH MATERIALIZED VIEW osm_landuse_xl_filtered;
-REFRESH MATERIALIZED VIEW osm_landuse_xl_clustered;
-REFRESH MATERIALIZED VIEW osm_landuse_xl_grouped;
-REFRESH MATERIALIZED VIEW osm_landuse_xl_buffered;
-REFRESH MATERIALIZED VIEW osm_landuse_xl_exploded;
-REFRESH MATERIALIZED VIEW osm_landuse_xl;
-
-REFRESH MATERIALIZED VIEW osm_landuse_l_filtered;
-REFRESH MATERIALIZED VIEW osm_landuse_l_clustered;
-REFRESH MATERIALIZED VIEW osm_landuse_l_grouped;
-REFRESH MATERIALIZED VIEW osm_landuse_l_buffered;
-REFRESH MATERIALIZED VIEW osm_landuse_l_exploded;
-REFRESH MATERIALIZED VIEW osm_landuse_l;
-
-REFRESH MATERIALIZED VIEW osm_landuse_m_filtered;
-REFRESH MATERIALIZED VIEW osm_landuse_m_clustered;
-REFRESH MATERIALIZED VIEW osm_landuse_m_grouped;
-REFRESH MATERIALIZED VIEW osm_landuse_m_buffered;
-REFRESH MATERIALIZED VIEW osm_landuse_m_exploded;
-REFRESH MATERIALIZED VIEW osm_landuse_m;
-
-REFRESH MATERIALIZED VIEW osm_landuse_s_filtered;
-REFRESH MATERIALIZED VIEW osm_landuse_s_clustered;
-REFRESH MATERIALIZED VIEW osm_landuse_s_grouped;
-REFRESH MATERIALIZED VIEW osm_landuse_s_buffered;
-REFRESH MATERIALIZED VIEW osm_landuse_s_exploded;
-REFRESH MATERIALIZED VIEW osm_landuse_s;
+DROP
+ INDEX IF EXISTS osm_landuse_z12_filtered_tags_idx;
+
+REFRESH MATERIALIZED VIEW osm_landuse_z12_filtered;
+
+CREATE
+ INDEX IF NOT EXISTS osm_landuse_z12_filtered_geom_idx ON
+ osm_landuse_z12_filtered
+ USING GIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_landuse_z12_filtered_tags_idx ON
+ osm_landuse_z12_filtered(tag);
+
+DROP
+ INDEX IF EXISTS osm_landuse_z12_geom_idx;
+
+DROP
+ INDEX IF EXISTS osm_landuse_z12_tags_idx;
REFRESH MATERIALIZED VIEW osm_landuse_z12;
+
+CREATE
+ INDEX IF NOT EXISTS osm_landuse_z12_geom_idx ON
+ osm_landuse_z12
+ USING GIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_landuse_z12_tags_idx ON
+ osm_landuse_z12
+ USING GIN(tags);
+
+-- Zoom level 11
+DROP
+ INDEX IF EXISTS osm_landuse_z11_filtered_geom_idx;
+
+DROP
+ INDEX IF EXISTS osm_landuse_z11_filtered_tags_idx;
+
+REFRESH MATERIALIZED VIEW osm_landuse_z11_filtered;
+
+CREATE
+ INDEX IF NOT EXISTS osm_landuse_z11_filtered_geom_idx ON
+ osm_landuse_z11_filtered
+ USING GIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_landuse_z11_filtered_tags_idx ON
+ osm_landuse_z11_filtered(tag);
+
+DROP
+ INDEX IF EXISTS osm_landuse_z11_geom_idx;
+
+DROP
+ INDEX IF EXISTS osm_landuse_z11_tags_idx;
+
REFRESH MATERIALIZED VIEW osm_landuse_z11;
+
+CREATE
+ INDEX IF NOT EXISTS osm_landuse_z11_geom_idx ON
+ osm_landuse_z11
+ USING GIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_landuse_z11_tags_idx ON
+ osm_landuse_z11
+ USING GIN(tags);
+
+-- Zoom level 10
+DROP
+ INDEX IF EXISTS osm_landuse_z10_filtered_geom_idx;
+
+DROP
+ INDEX IF EXISTS osm_landuse_z10_filtered_tags_idx;
+
+REFRESH MATERIALIZED VIEW osm_landuse_z10_filtered;
+
+CREATE
+ INDEX IF NOT EXISTS osm_landuse_z10_filtered_geom_idx ON
+ osm_landuse_z10_filtered
+ USING GIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_landuse_z10_filtered_tags_idx ON
+ osm_landuse_z10_filtered(tag);
+
+DROP
+ INDEX IF EXISTS osm_landuse_z10_geom_idx;
+
+DROP
+ INDEX IF EXISTS osm_landuse_z10_tags_idx;
+
REFRESH MATERIALIZED VIEW osm_landuse_z10;
+
+CREATE
+ INDEX IF NOT EXISTS osm_landuse_z10_geom_idx ON
+ osm_landuse_z10
+ USING GIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_landuse_z10_tags_idx ON
+ osm_landuse_z10
+ USING GIN(tags);
+
+-- Zoom level 9
+DROP
+ INDEX IF EXISTS osm_landuse_z9_geom_idx;
+
+DROP
+ INDEX IF EXISTS osm_landuse_z9_tags_idx;
+
REFRESH MATERIALIZED VIEW osm_landuse_z9;
+
+CREATE
+ INDEX IF NOT EXISTS osm_landuse_z9_geom_idx ON
+ osm_landuse_z9
+ USING GIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_landuse_z9_tags_idx ON
+ osm_landuse_z9
+ USING GIN(tags);
+
+-- Zoom level 8
+DROP
+ INDEX IF EXISTS osm_landuse_z8_geom_idx;
+
+DROP
+ INDEX IF EXISTS osm_landuse_z8_tags_idx;
+
REFRESH MATERIALIZED VIEW osm_landuse_z8;
+
+CREATE
+ INDEX IF NOT EXISTS osm_landuse_z8_geom_idx ON
+ osm_landuse_z8
+ USING GIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_landuse_z8_tags_idx ON
+ osm_landuse_z8
+ USING GIN(tags);
+
+-- Zoom level 7
+DROP
+ INDEX IF EXISTS osm_landuse_z7_geom_idx;
+
+DROP
+ INDEX IF EXISTS osm_landuse_z7_tags_idx;
+
REFRESH MATERIALIZED VIEW osm_landuse_z7;
+
+CREATE
+ INDEX IF NOT EXISTS osm_landuse_z7_geom_idx ON
+ osm_landuse_z7
+ USING GIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_landuse_z7_tags_idx ON
+ osm_landuse_z7
+ USING GIN(tags);
+
+-- Zoom level 6
+DROP
+ INDEX IF EXISTS osm_landuse_z6_geom_idx;
+
+DROP
+ INDEX IF EXISTS osm_landuse_z6_tags_idx;
+
REFRESH MATERIALIZED VIEW osm_landuse_z6;
+
+CREATE
+ INDEX IF NOT EXISTS osm_landuse_z6_geom_idx ON
+ osm_landuse_z6
+ USING GIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_landuse_z6_tags_idx ON
+ osm_landuse_z6
+ USING GIN(tags);
+
+-- Zoom level 5
+DROP
+ INDEX IF EXISTS osm_landuse_z5_geom_idx;
+
+DROP
+ INDEX IF EXISTS osm_landuse_z5_tags_idx;
+
REFRESH MATERIALIZED VIEW osm_landuse_z5;
+
+CREATE
+ INDEX IF NOT EXISTS osm_landuse_z5_geom_idx ON
+ osm_landuse_z5
+ USING GIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_landuse_z5_tags_idx ON
+ osm_landuse_z5
+ USING GIN(tags);
+
+-- Zoom level 4
+DROP
+ INDEX IF EXISTS osm_landuse_z4_geom_idx;
+
+DROP
+ INDEX IF EXISTS osm_landuse_z4_tags_idx;
+
REFRESH MATERIALIZED VIEW osm_landuse_z4;
+
+CREATE
+ INDEX IF NOT EXISTS osm_landuse_z4_geom_idx ON
+ osm_landuse_z4
+ USING GIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_landuse_z4_tags_idx ON
+ osm_landuse_z4
+ USING GIN(tags);
+
+-- Zoom level 3
+DROP
+ INDEX IF EXISTS osm_landuse_z3_geom_idx;
+
+DROP
+ INDEX IF EXISTS osm_landuse_z3_tags_idx;
+
REFRESH MATERIALIZED VIEW osm_landuse_z3;
+
+CREATE
+ INDEX IF NOT EXISTS osm_landuse_z3_geom_idx ON
+ osm_landuse_z3
+ USING GIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_landuse_z3_tags_idx ON
+ osm_landuse_z3
+ USING GIN(tags);
+
+-- Zoom level 2
+DROP
+ INDEX IF EXISTS osm_landuse_z2_geom_idx;
+
+DROP
+ INDEX IF EXISTS osm_landuse_z2_tags_idx;
+
REFRESH MATERIALIZED VIEW osm_landuse_z2;
+
+CREATE
+ INDEX IF NOT EXISTS osm_landuse_z2_geom_idx ON
+ osm_landuse_z2
+ USING GIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_landuse_z2_tags_idx ON
+ osm_landuse_z2
+ USING GIN(tags);
+
+-- Zoom level 1
+DROP
+ INDEX IF EXISTS osm_landuse_z1_geom_idx;
+
+DROP
+ INDEX IF EXISTS osm_landuse_z1_tags_idx;
+
REFRESH MATERIALIZED VIEW osm_landuse_z1;
+
+CREATE
+ INDEX IF NOT EXISTS osm_landuse_z1_geom_idx ON
+ osm_landuse_z1
+ USING GIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_landuse_z1_tags_idx ON
+ osm_landuse_z1
+ USING GIN(tags);
diff --git a/basemap/layers/landuse/simplify.sql b/basemap/layers/landuse/simplify.sql
deleted file mode 100644
index 5b8b9e4eb..000000000
--- a/basemap/layers/landuse/simplify.sql
+++ /dev/null
@@ -1,98 +0,0 @@
--- Licensed to the Apache Software Foundation (ASF) under one or more
--- contributor license agreements. See the NOTICE file distributed with
--- this work for additional information regarding copyright ownership.
--- The ASF licenses this file to you under the Apache License, Version 2.0
--- (the "License"); you may not use this file except in compliance with
--- the License. You may obtain a copy of the License at
---
--- http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing, software
--- distributed under the License is distributed on an "AS IS" BASIS,
--- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--- See the License for the specific language governing permissions and
--- limitations under the License.
-
-CREATE VIEW osm_landuse_z20 AS
-SELECT id, tags, geom FROM osm_landuse;
-
-CREATE VIEW osm_landuse_z19 AS
-SELECT id, tags, geom FROM osm_landuse;
-
-CREATE VIEW osm_landuse_z18 AS
-SELECT id, tags, geom FROM osm_landuse;
-
-CREATE VIEW osm_landuse_z17 AS
-SELECT id, tags, geom FROM osm_landuse;
-
-CREATE VIEW osm_landuse_z16 AS
-SELECT id, tags, geom FROM osm_landuse;
-
-CREATE VIEW osm_landuse_z15 AS
-SELECT id, tags, geom FROM osm_landuse;
-
-CREATE VIEW osm_landuse_z14 AS
-SELECT id, tags, geom FROM osm_landuse;
-
-CREATE VIEW osm_landuse_z13 AS
-SELECT id, tags, geom FROM osm_landuse;
-
-CREATE MATERIALIZED VIEW osm_landuse_z12 AS
-SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 12)) AS geom
-FROM osm_landuse
-WHERE st_area(st_envelope(geom)) > 25 * power(78270 / power(2, 12), 2);
-
-CREATE MATERIALIZED VIEW osm_landuse_z11 AS
-SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 11)) AS geom
-FROM osm_landuse
-WHERE st_area(st_envelope(geom)) > 25 * power(78270 / power(2, 11), 2);
-
-CREATE MATERIALIZED VIEW osm_landuse_z10 AS
-SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 10)) AS geom
-FROM osm_landuse
-WHERE st_area(st_envelope(geom)) > 25 * power(78270 / power(2, 10), 2);
-
-CREATE MATERIALIZED VIEW osm_landuse_z9 AS
-SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 9)) AS geom
-FROM osm_landuse
-WHERE st_area(st_envelope(geom)) > 25 * power(78270 / power(2, 9), 2);
-
-CREATE MATERIALIZED VIEW osm_landuse_z8 AS
-SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 8)) AS geom
-FROM osm_landuse_xl
-WHERE st_area(st_envelope(geom)) > 25 * power(78270 / power(2, 8), 2);
-
-CREATE MATERIALIZED VIEW osm_landuse_z7 AS
-SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 7)) AS geom
-FROM osm_landuse_l
-WHERE st_area(st_envelope(geom)) > 150 * power(78270 / power(2, 7), 2);
-
-CREATE MATERIALIZED VIEW osm_landuse_z6 AS
-SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 6)) AS geom
-FROM osm_landuse_m
-WHERE st_area(st_envelope(geom)) > 150 * power(78270 / power(2, 6), 2);
-
-CREATE MATERIALIZED VIEW osm_landuse_z5 AS
-SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 5)) AS geom
-FROM osm_landuse_s
-WHERE st_area(st_envelope(geom)) > 150 * power(78270 / power(2, 5), 2);
-
-CREATE MATERIALIZED VIEW osm_landuse_z4 AS
-SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 4)) AS geom
-FROM osm_landuse_s
-WHERE st_area(st_envelope(geom)) > 150 * power(78270 / power(2, 4), 2);
-
-CREATE MATERIALIZED VIEW osm_landuse_z3 AS
-SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 3)) AS geom
-FROM osm_landuse_s
-WHERE st_area(st_envelope(geom)) > 150 * power(78270 / power(2, 3), 2);
-
-CREATE MATERIALIZED VIEW osm_landuse_z2 AS
-SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 2)) AS geom
-FROM osm_landuse_s
-WHERE st_area(st_envelope(geom)) > 150 * power(78270 / power(2, 2), 2);
-
-CREATE MATERIALIZED VIEW osm_landuse_z1 AS
-SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 1)) AS geom
-FROM osm_landuse_s
-WHERE st_area(st_envelope(geom)) > 250 * power(78270 / power(2, 1), 2);
diff --git a/basemap/layers/landuse/tileset.js b/basemap/layers/landuse/tileset.js
index d39132da4..735914682 100644
--- a/basemap/layers/landuse/tileset.js
+++ b/basemap/layers/landuse/tileset.js
@@ -20,19 +20,9 @@ export default {
queries: [
{
minzoom: 1,
- maxzoom: 13,
- sql:
- "SELECT id, tags, geom FROM osm_landuse_z$zoom WHERE tags ? 'landuse'",
- },
- {
- minzoom: 13,
maxzoom: 20,
- sql: "SELECT id, tags, geom FROM osm_ways WHERE tags ? 'landuse'"
+ sql:
+ "SELECT id, tags, geom FROM osm_landuse_z$zoom",
},
- {
- minzoom: 13,
- maxzoom: 20,
- sql: "SELECT id, tags, geom FROM osm_relations WHERE tags ? 'landuse'"
- }
],
}
diff --git a/basemap/layers/leisure/clean.sql b/basemap/layers/leisure/clean.sql
deleted file mode 100644
index de58d7bbe..000000000
--- a/basemap/layers/leisure/clean.sql
+++ /dev/null
@@ -1,72 +0,0 @@
--- Licensed to the Apache Software Foundation (ASF) under one or more
--- contributor license agreements. See the NOTICE file distributed with
--- this work for additional information regarding copyright ownership.
--- The ASF licenses this file to you under the Apache License, Version 2.0
--- (the "License"); you may not use this file except in compliance with
--- the License. You may obtain a copy of the License at
---
--- http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing, software
--- distributed under the License is distributed on an "AS IS" BASIS,
--- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--- See the License for the specific language governing permissions and
--- limitations under the License.
-
-DROP MATERIALIZED VIEW IF EXISTS osm_leisure_filtered CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_leisure_clustered CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_leisure_grouped CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_leisure_buffered CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_leisure_exploded CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_leisure CASCADE;
-
-DROP MATERIALIZED VIEW IF EXISTS osm_leisure_xl_filtered CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_leisure_xl_clustered CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_leisure_xl_grouped CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_leisure_xl_buffered CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_leisure_xl_exploded CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_leisure_xl CASCADE;
-
-DROP MATERIALIZED VIEW IF EXISTS osm_leisure_l_filtered CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_leisure_l_clustered CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_leisure_l_grouped CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_leisure_l_buffered CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_leisure_l_exploded CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_leisure_l CASCADE;
-
-DROP MATERIALIZED VIEW IF EXISTS osm_leisure_m_filtered CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_leisure_m_clustered CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_leisure_m_grouped CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_leisure_m_buffered CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_leisure_m_exploded CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_leisure_m CASCADE;
-
-DROP MATERIALIZED VIEW IF EXISTS osm_leisure_s_filtered CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_leisure_s_clustered CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_leisure_s_grouped CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_leisure_s_buffered CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_leisure_s_exploded CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_leisure_s CASCADE;
-
-DROP VIEW IF EXISTS osm_leisure_z20 CASCADE;
-DROP VIEW IF EXISTS osm_leisure_z19 CASCADE;
-DROP VIEW IF EXISTS osm_leisure_z18 CASCADE;
-DROP VIEW IF EXISTS osm_leisure_z17 CASCADE;
-DROP VIEW IF EXISTS osm_leisure_z16 CASCADE;
-DROP VIEW IF EXISTS osm_leisure_z15 CASCADE;
-DROP VIEW IF EXISTS osm_leisure_z14 CASCADE;
-DROP VIEW IF EXISTS osm_leisure_z13 CASCADE;
-
-DROP MATERIALIZED VIEW IF EXISTS osm_leisure_z12 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_leisure_z11 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_leisure_z10 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_leisure_z9 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_leisure_z8 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_leisure_z7 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_leisure_z6 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_leisure_z5 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_leisure_z4 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_leisure_z3 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_leisure_z2 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_leisure_z1 CASCADE;
-
diff --git a/basemap/layers/leisure/create.sql b/basemap/layers/leisure/create.sql
new file mode 100644
index 000000000..f0c348c63
--- /dev/null
+++ b/basemap/layers/leisure/create.sql
@@ -0,0 +1,750 @@
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements. See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to you under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License. You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+-- Zoom levels 20 to 13
+CREATE
+ OR REPLACE VIEW osm_leisure AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_way
+ WHERE
+ tags ? 'leisure'
+UNION SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_relation
+ WHERE
+ tags ? 'leisure';
+
+CREATE
+ OR REPLACE VIEW osm_leisure_z20 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_leisure;
+
+CREATE
+ OR REPLACE VIEW osm_leisure_z19 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_leisure;
+
+CREATE
+ OR REPLACE VIEW osm_leisure_z18 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_leisure;
+
+CREATE
+ OR REPLACE VIEW osm_leisure_z17 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_leisure;
+
+CREATE
+ OR REPLACE VIEW osm_leisure_z16 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_leisure;
+
+CREATE
+ OR REPLACE VIEW osm_leisure_z15 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_leisure;
+
+CREATE
+ OR REPLACE VIEW osm_leisure_z14 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_leisure;
+
+CREATE
+ OR REPLACE VIEW osm_leisure_z13 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_leisure;
+
+-- Zoom level 12
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_leisure_z12_filtered CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_leisure_z12_filtered AS SELECT
+ tags -> 'leisure' AS tag,
+ st_buffer(
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 12 )
+ ),
+ 78270 / POWER( 2, 12 )* 1.1,
+ 'join=mitre'
+ ) AS geom
+ FROM
+ osm_leisure
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 12 ), 2 )* 32
+ AND tags ->> 'leisure' IN(
+ 'garden',
+ 'golf_course',
+ 'marina',
+ 'nature_reserve',
+ 'park',
+ 'pitch',
+ 'sport_center',
+ 'stadium',
+ 'swimming_pool',
+ 'track'
+ ) WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_leisure_z12 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_leisure_z12 AS WITH clustered AS(
+ SELECT
+ tag,
+ geom,
+ st_clusterdbscan(
+ geom,
+ 0,
+ 0
+ ) OVER(
+ PARTITION BY tag
+ ) AS cluster
+ FROM
+ osm_leisure_z12_filtered
+ ) SELECT
+ ROW_NUMBER() OVER() AS id,
+ jsonb_build_object(
+ 'leisure',
+ tag
+ ) AS tags,
+ st_simplifypreservetopology(
+ (
+ st_dump(
+ st_buffer(
+ st_collect(geom),
+ - 78270 / POWER( 2, 12 ),
+ 'join=mitre'
+ )
+ )
+ ).geom,
+ 78270 / POWER( 2, 12 )
+ ) AS geom
+ FROM
+ clustered
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 12 ), 2 )* 32
+ GROUP BY
+ tag,
+ cluster WITH NO DATA;
+
+-- Zoom level 11
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_leisure_z11_filtered CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_leisure_z11_filtered AS SELECT
+ tags -> 'leisure' AS tag,
+ st_buffer(
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 11 )
+ ),
+ 78270 / POWER( 2, 11 )* 1.1,
+ 'join=mitre'
+ ) AS geom
+ FROM
+ osm_leisure_z12
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 11 ), 2 )* 32 WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_leisure_z11 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_leisure_z11 AS WITH clustered AS(
+ SELECT
+ tag,
+ geom,
+ st_clusterdbscan(
+ geom,
+ 0,
+ 0
+ ) OVER(
+ PARTITION BY tag
+ ) AS cluster
+ FROM
+ osm_leisure_z11_filtered
+ ) SELECT
+ ROW_NUMBER() OVER() AS id,
+ jsonb_build_object(
+ 'leisure',
+ tag
+ ) AS tags,
+ st_simplifypreservetopology(
+ (
+ st_dump(
+ st_buffer(
+ st_collect(geom),
+ - 78270 / POWER( 2, 11 ),
+ 'join=mitre'
+ )
+ )
+ ).geom,
+ 78270 / POWER( 2, 11 )
+ ) AS geom
+ FROM
+ clustered
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 11 ), 2 )* 32
+ GROUP BY
+ tag,
+ cluster WITH NO DATA;
+
+-- Zoom level 10
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_leisure_z10_filtered CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_leisure_z10_filtered AS SELECT
+ tags -> 'leisure' AS tag,
+ st_buffer(
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 10 )
+ ),
+ 78270 / POWER( 2, 10 )* 1.1,
+ 'join=mitre'
+ ) AS geom
+ FROM
+ osm_leisure_z11
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 10 ), 2 )* 32 WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_leisure_z10 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_leisure_z10 AS WITH clustered AS(
+ SELECT
+ tag,
+ geom,
+ st_clusterdbscan(
+ geom,
+ 0,
+ 0
+ ) OVER(
+ PARTITION BY tag
+ ) AS cluster
+ FROM
+ osm_leisure_z10_filtered
+ ) SELECT
+ ROW_NUMBER() OVER() AS id,
+ jsonb_build_object(
+ 'leisure',
+ tag
+ ) AS tags,
+ st_simplifypreservetopology(
+ (
+ st_dump(
+ st_buffer(
+ st_collect(geom),
+ - 78270 / POWER( 2, 10 ),
+ 'join=mitre'
+ )
+ )
+ ).geom,
+ 78270 / POWER( 2, 10 )
+ ) AS geom
+ FROM
+ clustered
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 10 ), 2 )* 32
+ GROUP BY
+ tag,
+ cluster WITH NO DATA;
+
+-- Zoom level 9
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_leisure_z9 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_leisure_z9 AS WITH filtered AS(
+ SELECT
+ tags -> 'leisure' AS tag,
+ st_buffer(
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 9 )
+ ),
+ 78270 / POWER( 2, 9 )* 1.1,
+ 'join=mitre'
+ ) AS geom
+ FROM
+ osm_leisure_z10
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 9 ), 2 )* 32
+ ),
+ clustered AS(
+ SELECT
+ tag,
+ geom,
+ st_clusterdbscan(
+ geom,
+ 0,
+ 0
+ ) OVER(
+ PARTITION BY tag
+ ) AS cluster
+ FROM
+ filtered
+ ) SELECT
+ ROW_NUMBER() OVER() AS id,
+ jsonb_build_object(
+ 'leisure',
+ tag
+ ) AS tags,
+ st_simplifypreservetopology(
+ (
+ st_dump(
+ st_buffer(
+ st_collect(geom),
+ - 78270 / POWER( 2, 9 ),
+ 'join=mitre'
+ )
+ )
+ ).geom,
+ 78270 / POWER( 2, 9 )
+ ) AS geom
+ FROM
+ clustered
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 9 ), 2 )* 32
+ GROUP BY
+ tag,
+ cluster WITH NO DATA;
+
+-- Zoom level 8
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_leisure_z8 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_leisure_z8 AS WITH filtered AS(
+ SELECT
+ tags -> 'leisure' AS tag,
+ st_buffer(
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 8 )
+ ),
+ 78270 / POWER( 2, 8 )* 1.1,
+ 'join=mitre'
+ ) AS geom
+ FROM
+ osm_leisure_z9
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 8 ), 2 )* 32
+ ),
+ clustered AS(
+ SELECT
+ tag,
+ geom,
+ st_clusterdbscan(
+ geom,
+ 0,
+ 0
+ ) OVER(
+ PARTITION BY tag
+ ) AS cluster
+ FROM
+ filtered
+ ) SELECT
+ ROW_NUMBER() OVER() AS id,
+ jsonb_build_object(
+ 'leisure',
+ tag
+ ) AS tags,
+ st_simplifypreservetopology(
+ (
+ st_dump(
+ st_buffer(
+ st_collect(geom),
+ - 78270 / POWER( 2, 8 ),
+ 'join=mitre'
+ )
+ )
+ ).geom,
+ 78270 / POWER( 2, 8 )
+ ) AS geom
+ FROM
+ clustered
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 8 ), 2 )* 32
+ GROUP BY
+ tag,
+ cluster WITH NO DATA;
+
+-- Zoom level 7
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_leisure_z7 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_leisure_z7 AS WITH filtered AS(
+ SELECT
+ tags -> 'leisure' AS tag,
+ st_buffer(
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 7 )
+ ),
+ 78270 / POWER( 2, 7 )* 1.1,
+ 'join=mitre'
+ ) AS geom
+ FROM
+ osm_leisure_z8
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 7 ), 2 )* 32
+ ),
+ clustered AS(
+ SELECT
+ tag,
+ geom,
+ st_clusterdbscan(
+ geom,
+ 0,
+ 0
+ ) OVER(
+ PARTITION BY tag
+ ) AS cluster
+ FROM
+ filtered
+ ) SELECT
+ ROW_NUMBER() OVER() AS id,
+ jsonb_build_object(
+ 'leisure',
+ tag
+ ) AS tags,
+ st_simplifypreservetopology(
+ (
+ st_dump(
+ st_buffer(
+ st_collect(geom),
+ - 78270 / POWER( 2, 7 ),
+ 'join=mitre'
+ )
+ )
+ ).geom,
+ 78270 / POWER( 2, 7 )
+ ) AS geom
+ FROM
+ clustered
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 7 ), 2 )* 32
+ GROUP BY
+ tag,
+ cluster WITH NO DATA;
+
+-- Zoom level 6
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_leisure_z6 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_leisure_z6 AS WITH filtered AS(
+ SELECT
+ tags -> 'leisure' AS tag,
+ st_buffer(
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 6 )
+ ),
+ 78270 / POWER( 2, 6 )* 1.1,
+ 'join=mitre'
+ ) AS geom
+ FROM
+ osm_leisure_z7
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 6 ), 2 )* 32
+ ),
+ clustered AS(
+ SELECT
+ tag,
+ geom,
+ st_clusterdbscan(
+ geom,
+ 0,
+ 0
+ ) OVER(
+ PARTITION BY tag
+ ) AS cluster
+ FROM
+ filtered
+ ) SELECT
+ ROW_NUMBER() OVER() AS id,
+ jsonb_build_object(
+ 'leisure',
+ tag
+ ) AS tags,
+ st_simplifypreservetopology(
+ (
+ st_dump(
+ st_buffer(
+ st_collect(geom),
+ - 78270 / POWER( 2, 6 ),
+ 'join=mitre'
+ )
+ )
+ ).geom,
+ 78270 / POWER( 2, 6 )
+ ) AS geom
+ FROM
+ clustered
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 6 ), 2 )* 32
+ GROUP BY
+ tag,
+ cluster WITH NO DATA;
+
+-- Zoom level 5
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_leisure_z5 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_leisure_z5 AS WITH filtered AS(
+ SELECT
+ tags -> 'leisure' AS tag,
+ st_buffer(
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 5 )
+ ),
+ 78270 / POWER( 2, 5 )* 1.1,
+ 'join=mitre'
+ ) AS geom
+ FROM
+ osm_leisure_z6
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 5 ), 2 )* 32
+ ),
+ clustered AS(
+ SELECT
+ tag,
+ geom,
+ st_clusterdbscan(
+ geom,
+ 0,
+ 0
+ ) OVER(
+ PARTITION BY tag
+ ) AS cluster
+ FROM
+ filtered
+ ) SELECT
+ ROW_NUMBER() OVER() AS id,
+ jsonb_build_object(
+ 'leisure',
+ tag
+ ) AS tags,
+ st_simplifypreservetopology(
+ (
+ st_dump(
+ st_buffer(
+ st_collect(geom),
+ - 78270 / POWER( 2, 5 ),
+ 'join=mitre'
+ )
+ )
+ ).geom,
+ 78270 / POWER( 2, 5 )
+ ) AS geom
+ FROM
+ clustered
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 5 ), 2 )* 32
+ GROUP BY
+ tag,
+ cluster WITH NO DATA;
+
+-- Zoom level 4
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_leisure_z4 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_leisure_z4 AS WITH filtered AS(
+ SELECT
+ tags -> 'leisure' AS tag,
+ st_buffer(
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 4 )
+ ),
+ 78270 / POWER( 2, 4 )* 1.1,
+ 'join=mitre'
+ ) AS geom
+ FROM
+ osm_leisure_z6
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 4 ), 2 )* 32
+ ),
+ clustered AS(
+ SELECT
+ tag,
+ geom,
+ st_clusterdbscan(
+ geom,
+ 0,
+ 0
+ ) OVER(
+ PARTITION BY tag
+ ) AS cluster
+ FROM
+ filtered
+ ) SELECT
+ ROW_NUMBER() OVER() AS id,
+ jsonb_build_object(
+ 'leisure',
+ tag
+ ) AS tags,
+ st_simplifypreservetopology(
+ (
+ st_dump(
+ st_buffer(
+ st_collect(geom),
+ - 78270 / POWER( 2, 4 ),
+ 'join=mitre'
+ )
+ )
+ ).geom,
+ 78270 / POWER( 2, 4 )
+ ) AS geom
+ FROM
+ clustered
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 4 ), 2 )* 32
+ GROUP BY
+ tag,
+ cluster WITH NO DATA;
+
+-- Zoom level 3
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_leisure_z3 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_leisure_z3 AS SELECT
+ id,
+ tags,
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 3 )
+ ) AS geom
+ FROM
+ osm_leisure_z4
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 3 ), 2 )* 16 WITH NO DATA;
+
+-- Zoom level 2
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_leisure_z2 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_leisure_z2 AS SELECT
+ id,
+ tags,
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 2 )
+ ) AS geom
+ FROM
+ osm_leisure_z4
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 2 ), 2 )* 16 WITH NO DATA;
+
+-- Zoom level 1
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_leisure_z1 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_leisure_z1 AS SELECT
+ id,
+ tags,
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 1 )
+ ) AS geom
+ FROM
+ osm_leisure_z4
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 1 ), 2 )* 16 WITH NO DATA;
diff --git a/basemap/layers/leisure/index.sql b/basemap/layers/leisure/index.sql
deleted file mode 100644
index 3029ef156..000000000
--- a/basemap/layers/leisure/index.sql
+++ /dev/null
@@ -1,27 +0,0 @@
--- Licensed to the Apache Software Foundation (ASF) under one or more
--- contributor license agreements. See the NOTICE file distributed with
--- this work for additional information regarding copyright ownership.
--- The ASF licenses this file to you under the Apache License, Version 2.0
--- (the "License"); you may not use this file except in compliance with
--- the License. You may obtain a copy of the License at
---
--- http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing, software
--- distributed under the License is distributed on an "AS IS" BASIS,
--- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--- See the License for the specific language governing permissions and
--- limitations under the License.
-
-CREATE INDEX IF NOT EXISTS osm_leisure_geom_z1_index ON osm_leisure_z1 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_leisure_geom_z2_index ON osm_leisure_z2 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_leisure_geom_z3_index ON osm_leisure_z3 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_leisure_geom_z4_index ON osm_leisure_z4 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_leisure_geom_z5_index ON osm_leisure_z5 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_leisure_geom_z6_index ON osm_leisure_z6 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_leisure_geom_z7_index ON osm_leisure_z7 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_leisure_geom_z8_index ON osm_leisure_z8 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_leisure_geom_z9_index ON osm_leisure_z9 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_leisure_geom_z10_index ON osm_leisure_z10 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_leisure_geom_z11_index ON osm_leisure_z11 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_leisure_geom_z12_index ON osm_leisure_z12 USING SPGIST (geom);
diff --git a/basemap/layers/leisure/line.js b/basemap/layers/leisure/line.js
index d1cf9569b..77f7c452f 100644
--- a/basemap/layers/leisure/line.js
+++ b/basemap/layers/leisure/line.js
@@ -24,6 +24,11 @@ export let directives = [
'line-color': theme.leisureNatureReserveLineColor,
'line-width': 2,
},
+ {
+ filter: ['==', ['get', 'leisure'], 'track'],
+ 'line-color': theme.leisureTrackLineColor,
+ 'line-width-stops': theme.leisureTrackLineWidth,
+ },
];
export default asLayerObject(withSortKeys(directives), {
@@ -36,4 +41,5 @@ export default asLayerObject(withSortKeys(directives), {
'line-cap': 'round',
'line-join': 'round',
},
+ 'filter': ['==', ['geometry-type'], 'LineString'],
});
diff --git a/basemap/layers/leisure/prepare.sql b/basemap/layers/leisure/prepare.sql
deleted file mode 100644
index aba4c2abb..000000000
--- a/basemap/layers/leisure/prepare.sql
+++ /dev/null
@@ -1,233 +0,0 @@
--- Licensed to the Apache Software Foundation (ASF) under one or more
--- contributor license agreements. See the NOTICE file distributed with
--- this work for additional information regarding copyright ownership.
--- The ASF licenses this file to you under the Apache License, Version 2.0
--- (the "License"); you may not use this file except in compliance with
--- the License. You may obtain a copy of the License at
---
--- http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing, software
--- distributed under the License is distributed on an "AS IS" BASIS,
--- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--- See the License for the specific language governing permissions and
--- limitations under the License.
-
-CREATE MATERIALIZED VIEW osm_leisure_filtered AS
-SELECT
- tags -> 'leisure' AS leisure,
- st_simplifypreservetopology(geom, 78270 / power(2, 12)) AS geom
-FROM osm_polygon
-WHERE geom IS NOT NULL
- AND st_area(geom) > 78270 / power(2, 12) * 100
- AND tags ->> 'leisure' IN ('garden', 'golf_course', 'marina', 'nature_reserve', 'park', 'pitch', 'sport_center', 'stadium', 'swimming_pool', 'track');
-CREATE INDEX IF NOT EXISTS osm_leisure_filtered_geom_idx ON osm_leisure_filtered USING GIST (geom);
-CREATE INDEX IF NOT EXISTS osm_leisure_filtered_tags_idx ON osm_leisure_filtered (leisure);
-
-CREATE MATERIALIZED VIEW osm_leisure_clustered AS
-SELECT
- leisure,
- geom,
- st_clusterdbscan(geom, 0, 0) OVER(PARTITION BY leisure) AS cluster
-FROM osm_leisure_filtered
-WHERE geom IS NOT NULL;
-CREATE INDEX IF NOT EXISTS osm_leisure_clustered_geom_idx ON osm_leisure_clustered USING GIST (geom);
-CREATE INDEX IF NOT EXISTS osm_leisure_clustered_tags_idx ON osm_leisure_clustered (leisure);
-
-CREATE MATERIALIZED VIEW osm_leisure_grouped AS
-SELECT
- leisure,
- st_collect(geom) AS geom
-FROM osm_leisure_clustered
-GROUP BY leisure, cluster;
-
-CREATE MATERIALIZED VIEW osm_leisure_buffered AS
-SELECT
- leisure,
- st_buffer(geom, 0, 'join=mitre') AS geom
-FROM osm_leisure_grouped;
-
-CREATE MATERIALIZED VIEW osm_leisure_exploded AS
-SELECT
- leisure,
- (st_dump(geom)).geom AS geom
-FROM osm_leisure_buffered;
-
-CREATE MATERIALIZED VIEW osm_leisure AS
-SELECT
- row_number() OVER () AS id,
- jsonb_build_object('leisure', leisure) AS tags,
- geom
-FROM osm_leisure_exploded;
-
--- XTRA LARGE
-CREATE MATERIALIZED VIEW osm_leisure_xl_filtered AS
-SELECT
- id,
- tags -> 'leisure' as leisure,
- st_buffer(st_simplifypreservetopology(geom, 78270 / power(2, 8)), 78270 / power(2, 8), 'join=mitre') AS geom
-FROM osm_leisure
-WHERE st_area(st_envelope(geom)) > 25 * power(78270 / power(2, 8), 2);
-
-CREATE MATERIALIZED VIEW osm_leisure_xl_clustered AS
-SELECT
- leisure,
- geom,
- st_clusterdbscan(geom, 0, 0) OVER(PARTITION BY leisure) AS cluster
-FROM osm_leisure_xl_filtered;
-
-CREATE MATERIALIZED VIEW osm_leisure_xl_grouped AS
-SELECT
- leisure,
- cluster,
- st_collect(geom) AS geom
-FROM osm_leisure_xl_clustered
-GROUP BY leisure, cluster;
-
-CREATE MATERIALIZED VIEW osm_leisure_xl_buffered AS
-SELECT
- leisure,
- st_buffer(geom, -78270 / power(2, 8), 'join=mitre') AS geom
-FROM osm_leisure_xl_grouped;
-
-CREATE MATERIALIZED VIEW osm_leisure_xl_exploded AS
-SELECT
- leisure,
- (st_dump(geom)).geom AS geom
-FROM osm_leisure_xl_buffered;
-
-CREATE MATERIALIZED VIEW osm_leisure_xl AS
-SELECT
- row_number() OVER () AS id,
- jsonb_build_object('leisure', leisure) AS tags,
- geom AS geom
-FROM osm_leisure_xl_buffered;
-
--- LARGE
-CREATE MATERIALIZED VIEW osm_leisure_l_filtered AS
-SELECT
- id,
- tags -> 'leisure' as leisure,
- st_buffer(st_simplifypreservetopology(geom, 78270 / power(2, 6)), 78270 / power(2, 7), 'join=mitre') AS geom
-FROM osm_leisure
-WHERE st_area(st_envelope(geom)) > 5 * power(78270 / power(2, 7), 2);
-
-CREATE MATERIALIZED VIEW osm_leisure_l_clustered AS
-SELECT
- leisure,
- geom,
- st_clusterdbscan(geom, 0, 0) OVER(PARTITION BY leisure) AS cluster
-FROM osm_leisure_l_filtered;
-
-CREATE MATERIALIZED VIEW osm_leisure_l_grouped AS
-SELECT
- leisure,
- cluster,
- st_collect(geom) AS geom
-FROM osm_leisure_l_clustered
-GROUP BY leisure, cluster;
-
-CREATE MATERIALIZED VIEW osm_leisure_l_buffered AS
-SELECT
- leisure,
- st_buffer(geom, 0.5 * -78270 / power(2, 7), 'join=mitre') AS geom
-FROM osm_leisure_l_grouped;
-
-CREATE MATERIALIZED VIEW osm_leisure_l_exploded AS
-SELECT
- leisure,
- (st_dump(geom)).geom AS geom
-FROM osm_leisure_l_buffered;
-
-CREATE MATERIALIZED VIEW osm_leisure_l AS
-SELECT
- row_number() OVER () AS id,
- jsonb_build_object('leisure', leisure) AS tags,
- geom AS geom
-FROM osm_leisure_l_buffered;
-
--- MEDIUM
-CREATE MATERIALIZED VIEW osm_leisure_m_filtered AS
-SELECT
- id,
- tags -> 'leisure' as leisure,
- st_buffer(st_simplifypreservetopology(geom, 78270 / power(2, 5)), 78270 / power(2, 6), 'join=mitre') AS geom
-FROM osm_leisure
-WHERE st_area(st_envelope(geom)) > 10 * power(78270 / power(2, 6), 2);
-
-CREATE MATERIALIZED VIEW osm_leisure_m_clustered AS
-SELECT
- leisure,
- geom,
- st_clusterdbscan(geom, 0, 0) OVER(PARTITION BY leisure) AS cluster
-FROM osm_leisure_m_filtered;
-
-CREATE MATERIALIZED VIEW osm_leisure_m_grouped AS
-SELECT
- leisure,
- cluster,
- st_collect(geom) AS geom
-FROM osm_leisure_m_clustered
-GROUP BY leisure, cluster;
-
-CREATE MATERIALIZED VIEW osm_leisure_m_buffered AS
-SELECT
- leisure,
- st_buffer(geom, 0.1 * -78270 / power(2, 6), 'join=mitre') AS geom
-FROM osm_leisure_m_grouped;
-
-CREATE MATERIALIZED VIEW osm_leisure_m_exploded AS
-SELECT
- leisure,
- (st_dump(geom)).geom AS geom
-FROM osm_leisure_m_buffered;
-
-CREATE MATERIALIZED VIEW osm_leisure_m AS
-SELECT
- row_number() OVER () AS id,
- jsonb_build_object('leisure', leisure) AS tags,
- geom AS geom
-FROM osm_leisure_m_buffered;
-
--- SMALL
-CREATE MATERIALIZED VIEW osm_leisure_s_filtered AS
-SELECT
- id,
- tags -> 'leisure' as leisure,
- st_buffer(st_simplifypreservetopology(geom, 78270 / power(2, 4)), 78270 / power(2, 5), 'join=mitre') AS geom
-FROM osm_leisure
-WHERE st_area(st_envelope(geom)) > 15 * power(78270 / power(2, 5), 2);
-
-CREATE MATERIALIZED VIEW osm_leisure_s_clustered AS
-SELECT
- leisure,
- geom,
- st_clusterdbscan(geom, 0, 0) OVER(PARTITION BY leisure) AS cluster
-FROM osm_leisure_s_filtered;
-
-CREATE MATERIALIZED VIEW osm_leisure_s_grouped AS
-SELECT
- leisure,
- cluster,
- st_collect(geom) AS geom
-FROM osm_leisure_s_clustered
-GROUP BY leisure, cluster;
-
-CREATE MATERIALIZED VIEW osm_leisure_s_buffered AS
-SELECT
- leisure,
- st_buffer(geom, 0, 'join=mitre') AS geom
-FROM osm_leisure_s_grouped;
-
-CREATE MATERIALIZED VIEW osm_leisure_s_exploded AS
-SELECT
- leisure,
- (st_dump(geom)).geom AS geom
-FROM osm_leisure_s_buffered;
-
-CREATE MATERIALIZED VIEW osm_leisure_s AS
-SELECT
- row_number() OVER () AS id,
- jsonb_build_object('leisure', leisure) AS tags,
- geom AS geom
-FROM osm_leisure_s_buffered;
diff --git a/basemap/layers/leisure/refresh.sql b/basemap/layers/leisure/refresh.sql
index 93a62c5d6..847385834 100644
--- a/basemap/layers/leisure/refresh.sql
+++ b/basemap/layers/leisure/refresh.sql
@@ -12,51 +12,281 @@
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
+-- Zoom level 12
+DROP
+ INDEX IF EXISTS osm_leisure_z12_filtered_geom_idx;
-REFRESH MATERIALIZED VIEW osm_leisure_filtered;
-REFRESH MATERIALIZED VIEW osm_leisure_clustered;
-REFRESH MATERIALIZED VIEW osm_leisure_grouped;
-REFRESH MATERIALIZED VIEW osm_leisure_buffered;
-REFRESH MATERIALIZED VIEW osm_leisure_exploded;
-REFRESH MATERIALIZED VIEW osm_leisure;
-
-REFRESH MATERIALIZED VIEW osm_leisure_xl_filtered;
-REFRESH MATERIALIZED VIEW osm_leisure_xl_clustered;
-REFRESH MATERIALIZED VIEW osm_leisure_xl_grouped;
-REFRESH MATERIALIZED VIEW osm_leisure_xl_buffered;
-REFRESH MATERIALIZED VIEW osm_leisure_xl_exploded;
-REFRESH MATERIALIZED VIEW osm_leisure_xl;
-
-REFRESH MATERIALIZED VIEW osm_leisure_l_filtered;
-REFRESH MATERIALIZED VIEW osm_leisure_l_clustered;
-REFRESH MATERIALIZED VIEW osm_leisure_l_grouped;
-REFRESH MATERIALIZED VIEW osm_leisure_l_buffered;
-REFRESH MATERIALIZED VIEW osm_leisure_l_exploded;
-REFRESH MATERIALIZED VIEW osm_leisure_l;
-
-REFRESH MATERIALIZED VIEW osm_leisure_m_filtered;
-REFRESH MATERIALIZED VIEW osm_leisure_m_clustered;
-REFRESH MATERIALIZED VIEW osm_leisure_m_grouped;
-REFRESH MATERIALIZED VIEW osm_leisure_m_buffered;
-REFRESH MATERIALIZED VIEW osm_leisure_m_exploded;
-REFRESH MATERIALIZED VIEW osm_leisure_m;
-
-REFRESH MATERIALIZED VIEW osm_leisure_s_filtered;
-REFRESH MATERIALIZED VIEW osm_leisure_s_clustered;
-REFRESH MATERIALIZED VIEW osm_leisure_s_grouped;
-REFRESH MATERIALIZED VIEW osm_leisure_s_buffered;
-REFRESH MATERIALIZED VIEW osm_leisure_s_exploded;
-REFRESH MATERIALIZED VIEW osm_leisure_s;
+DROP
+ INDEX IF EXISTS osm_leisure_z12_filtered_tags_idx;
+
+REFRESH MATERIALIZED VIEW osm_leisure_z12_filtered;
+
+CREATE
+ INDEX IF NOT EXISTS osm_leisure_z12_filtered_geom_idx ON
+ osm_leisure_z12_filtered
+ USING GIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_leisure_z12_filtered_tags_idx ON
+ osm_leisure_z12_filtered(tag);
+
+DROP
+ INDEX IF EXISTS osm_leisure_z12_geom_idx;
+
+DROP
+ INDEX IF EXISTS osm_leisure_z12_tags_idx;
REFRESH MATERIALIZED VIEW osm_leisure_z12;
+
+CREATE
+ INDEX IF NOT EXISTS osm_leisure_z12_geom_idx ON
+ osm_leisure_z12
+ USING GIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_leisure_z12_tags_idx ON
+ osm_leisure_z12
+ USING GIN(tags);
+
+-- Zoom level 11
+DROP
+ INDEX IF EXISTS osm_leisure_z11_filtered_geom_idx;
+
+DROP
+ INDEX IF EXISTS osm_leisure_z11_filtered_tags_idx;
+
+REFRESH MATERIALIZED VIEW osm_leisure_z11_filtered;
+
+CREATE
+ INDEX IF NOT EXISTS osm_leisure_z11_filtered_geom_idx ON
+ osm_leisure_z11_filtered
+ USING GIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_leisure_z11_filtered_tags_idx ON
+ osm_leisure_z11_filtered(tag);
+
+DROP
+ INDEX IF EXISTS osm_leisure_z11_geom_idx;
+
+DROP
+ INDEX IF EXISTS osm_leisure_z11_tags_idx;
+
REFRESH MATERIALIZED VIEW osm_leisure_z11;
+
+CREATE
+ INDEX IF NOT EXISTS osm_leisure_z11_geom_idx ON
+ osm_leisure_z11
+ USING GIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_leisure_z11_tags_idx ON
+ osm_leisure_z11
+ USING GIN(tags);
+
+-- Zoom level 10
+DROP
+ INDEX IF EXISTS osm_leisure_z10_filtered_geom_idx;
+
+DROP
+ INDEX IF EXISTS osm_leisure_z10_filtered_tags_idx;
+
+REFRESH MATERIALIZED VIEW osm_leisure_z10_filtered;
+
+CREATE
+ INDEX IF NOT EXISTS osm_leisure_z10_filtered_geom_idx ON
+ osm_leisure_z10_filtered
+ USING GIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_leisure_z10_filtered_tags_idx ON
+ osm_leisure_z10_filtered(tag);
+
+DROP
+ INDEX IF EXISTS osm_leisure_z10_geom_idx;
+
+DROP
+ INDEX IF EXISTS osm_leisure_z10_tags_idx;
+
REFRESH MATERIALIZED VIEW osm_leisure_z10;
+
+CREATE
+ INDEX IF NOT EXISTS osm_leisure_z10_geom_idx ON
+ osm_leisure_z10
+ USING GIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_leisure_z10_tags_idx ON
+ osm_leisure_z10
+ USING GIN(tags);
+
+-- Zoom level 9
+DROP
+ INDEX IF EXISTS osm_leisure_z9_geom_idx;
+
+DROP
+ INDEX IF EXISTS osm_leisure_z9_tags_idx;
+
REFRESH MATERIALIZED VIEW osm_leisure_z9;
+
+CREATE
+ INDEX IF NOT EXISTS osm_leisure_z9_geom_idx ON
+ osm_leisure_z9
+ USING GIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_leisure_z9_tags_idx ON
+ osm_leisure_z9
+ USING GIN(tags);
+
+-- Zoom level 8
+DROP
+ INDEX IF EXISTS osm_leisure_z8_geom_idx;
+
+DROP
+ INDEX IF EXISTS osm_leisure_z8_tags_idx;
+
REFRESH MATERIALIZED VIEW osm_leisure_z8;
+
+CREATE
+ INDEX IF NOT EXISTS osm_leisure_z8_geom_idx ON
+ osm_leisure_z8
+ USING GIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_leisure_z8_tags_idx ON
+ osm_leisure_z8
+ USING GIN(tags);
+
+-- Zoom level 7
+DROP
+ INDEX IF EXISTS osm_leisure_z7_geom_idx;
+
+DROP
+ INDEX IF EXISTS osm_leisure_z7_tags_idx;
+
REFRESH MATERIALIZED VIEW osm_leisure_z7;
+
+CREATE
+ INDEX IF NOT EXISTS osm_leisure_z7_geom_idx ON
+ osm_leisure_z7
+ USING GIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_leisure_z7_tags_idx ON
+ osm_leisure_z7
+ USING GIN(tags);
+
+-- Zoom level 6
+DROP
+ INDEX IF EXISTS osm_leisure_z6_geom_idx;
+
+DROP
+ INDEX IF EXISTS osm_leisure_z6_tags_idx;
+
REFRESH MATERIALIZED VIEW osm_leisure_z6;
+
+CREATE
+ INDEX IF NOT EXISTS osm_leisure_z6_geom_idx ON
+ osm_leisure_z6
+ USING GIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_leisure_z6_tags_idx ON
+ osm_leisure_z6
+ USING GIN(tags);
+
+-- Zoom level 5
+DROP
+ INDEX IF EXISTS osm_leisure_z5_geom_idx;
+
+DROP
+ INDEX IF EXISTS osm_leisure_z5_tags_idx;
+
REFRESH MATERIALIZED VIEW osm_leisure_z5;
+
+CREATE
+ INDEX IF NOT EXISTS osm_leisure_z5_geom_idx ON
+ osm_leisure_z5
+ USING GIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_leisure_z5_tags_idx ON
+ osm_leisure_z5
+ USING GIN(tags);
+
+-- Zoom level 4
+DROP
+ INDEX IF EXISTS osm_leisure_z4_geom_idx;
+
+DROP
+ INDEX IF EXISTS osm_leisure_z4_tags_idx;
+
REFRESH MATERIALIZED VIEW osm_leisure_z4;
+
+CREATE
+ INDEX IF NOT EXISTS osm_leisure_z4_geom_idx ON
+ osm_leisure_z4
+ USING GIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_leisure_z4_tags_idx ON
+ osm_leisure_z4
+ USING GIN(tags);
+
+-- Zoom level 3
+DROP
+ INDEX IF EXISTS osm_leisure_z3_geom_idx;
+
+DROP
+ INDEX IF EXISTS osm_leisure_z3_tags_idx;
+
REFRESH MATERIALIZED VIEW osm_leisure_z3;
+
+CREATE
+ INDEX IF NOT EXISTS osm_leisure_z3_geom_idx ON
+ osm_leisure_z3
+ USING GIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_leisure_z3_tags_idx ON
+ osm_leisure_z3
+ USING GIN(tags);
+
+-- Zoom level 2
+DROP
+ INDEX IF EXISTS osm_leisure_z2_geom_idx;
+
+DROP
+ INDEX IF EXISTS osm_leisure_z2_tags_idx;
+
REFRESH MATERIALIZED VIEW osm_leisure_z2;
+
+CREATE
+ INDEX IF NOT EXISTS osm_leisure_z2_geom_idx ON
+ osm_leisure_z2
+ USING GIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_leisure_z2_tags_idx ON
+ osm_leisure_z2
+ USING GIN(tags);
+
+-- Zoom level 1
+DROP
+ INDEX IF EXISTS osm_leisure_z1_geom_idx;
+
+DROP
+ INDEX IF EXISTS osm_leisure_z1_tags_idx;
+
REFRESH MATERIALIZED VIEW osm_leisure_z1;
+
+CREATE
+ INDEX IF NOT EXISTS osm_leisure_z1_geom_idx ON
+ osm_leisure_z1
+ USING GIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_leisure_z1_tags_idx ON
+ osm_leisure_z1
+ USING GIN(tags);
diff --git a/basemap/layers/leisure/simplify.sql b/basemap/layers/leisure/simplify.sql
deleted file mode 100644
index cdd6756c7..000000000
--- a/basemap/layers/leisure/simplify.sql
+++ /dev/null
@@ -1,98 +0,0 @@
--- Licensed to the Apache Software Foundation (ASF) under one or more
--- contributor license agreements. See the NOTICE file distributed with
--- this work for additional information regarding copyright ownership.
--- The ASF licenses this file to you under the Apache License, Version 2.0
--- (the "License"); you may not use this file except in compliance with
--- the License. You may obtain a copy of the License at
---
--- http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing, software
--- distributed under the License is distributed on an "AS IS" BASIS,
--- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--- See the License for the specific language governing permissions and
--- limitations under the License.
-
-CREATE VIEW osm_leisure_z20 AS
-SELECT id, tags, geom FROM osm_leisure;
-
-CREATE VIEW osm_leisure_z19 AS
-SELECT id, tags, geom FROM osm_leisure;
-
-CREATE VIEW osm_leisure_z18 AS
-SELECT id, tags, geom FROM osm_leisure;
-
-CREATE VIEW osm_leisure_z17 AS
-SELECT id, tags, geom FROM osm_leisure;
-
-CREATE VIEW osm_leisure_z16 AS
-SELECT id, tags, geom FROM osm_leisure;
-
-CREATE VIEW osm_leisure_z15 AS
-SELECT id, tags, geom FROM osm_leisure;
-
-CREATE VIEW osm_leisure_z14 AS
-SELECT id, tags, geom FROM osm_leisure;
-
-CREATE VIEW osm_leisure_z13 AS
-SELECT id, tags, geom FROM osm_leisure;
-
-CREATE MATERIALIZED VIEW osm_leisure_z12 AS
-SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 12)) AS geom
-FROM osm_leisure
-WHERE st_area(st_envelope(geom)) > 25 * power(78270 / power(2, 12), 2);
-
-CREATE MATERIALIZED VIEW osm_leisure_z11 AS
-SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 11)) AS geom
-FROM osm_leisure
-WHERE st_area(st_envelope(geom)) > 25 * power(78270 / power(2, 11), 2);
-
-CREATE MATERIALIZED VIEW osm_leisure_z10 AS
-SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 10)) AS geom
-FROM osm_leisure
-WHERE st_area(st_envelope(geom)) > 25 * power(78270 / power(2, 10), 2);
-
-CREATE MATERIALIZED VIEW osm_leisure_z9 AS
-SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 9)) AS geom
-FROM osm_leisure
-WHERE st_area(st_envelope(geom)) > 25 * power(78270 / power(2, 9), 2);
-
-CREATE MATERIALIZED VIEW osm_leisure_z8 AS
-SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 8)) AS geom
-FROM osm_leisure_xl
-WHERE st_area(st_envelope(geom)) > 25 * power(78270 / power(2, 8), 2);
-
-CREATE MATERIALIZED VIEW osm_leisure_z7 AS
-SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 7)) AS geom
-FROM osm_leisure_l
-WHERE st_area(st_envelope(geom)) > 150 * power(78270 / power(2, 7), 2);
-
-CREATE MATERIALIZED VIEW osm_leisure_z6 AS
-SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 6)) AS geom
-FROM osm_leisure_m
-WHERE st_area(st_envelope(geom)) > 150 * power(78270 / power(2, 6), 2);
-
-CREATE MATERIALIZED VIEW osm_leisure_z5 AS
-SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 5)) AS geom
-FROM osm_leisure_s
-WHERE st_area(st_envelope(geom)) > 150 * power(78270 / power(2, 5), 2);
-
-CREATE MATERIALIZED VIEW osm_leisure_z4 AS
-SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 4)) AS geom
-FROM osm_leisure_s
-WHERE st_area(st_envelope(geom)) > 150 * power(78270 / power(2, 4), 2);
-
-CREATE MATERIALIZED VIEW osm_leisure_z3 AS
-SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 3)) AS geom
-FROM osm_leisure_s
-WHERE st_area(st_envelope(geom)) > 150 * power(78270 / power(2, 3), 2);
-
-CREATE MATERIALIZED VIEW osm_leisure_z2 AS
-SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 2)) AS geom
-FROM osm_leisure_s
-WHERE st_area(st_envelope(geom)) > 150 * power(78270 / power(2, 2), 2);
-
-CREATE MATERIALIZED VIEW osm_leisure_z1 AS
-SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 1)) AS geom
-FROM osm_leisure_s
-WHERE st_area(st_envelope(geom)) > 250 * power(78270 / power(2, 1), 2);
diff --git a/basemap/layers/leisure/tileset.js b/basemap/layers/leisure/tileset.js
index bef2910c0..4eb6ffde0 100644
--- a/basemap/layers/leisure/tileset.js
+++ b/basemap/layers/leisure/tileset.js
@@ -20,21 +20,9 @@ export default {
queries: [
{
minzoom: 1,
- maxzoom: 13,
- sql:
- "SELECT id, tags, geom FROM osm_leisure_z$zoom WHERE tags ? 'leisure'",
- },
- {
- minzoom: 13,
maxzoom: 20,
sql:
- "SELECT id, tags, geom FROM osm_ways WHERE tags ? 'leisure'",
- },
- {
- minzoom: 13,
- maxzoom: 20,
- sql:
- "SELECT id, tags, geom FROM osm_relations WHERE tags ? 'leisure'",
+ "SELECT id, tags, geom FROM osm_leisure_z$zoom WHERE tags ? 'leisure'",
},
],
}
diff --git a/basemap/layers/linestring/create.sql b/basemap/layers/linestring/create.sql
new file mode 100644
index 000000000..1cbfd9e3c
--- /dev/null
+++ b/basemap/layers/linestring/create.sql
@@ -0,0 +1,50 @@
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements. See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to you under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License. You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+CREATE
+ OR REPLACE VIEW osm_linestring AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_way
+ LEFT JOIN osm_member ON
+ id = member_ref
+ WHERE
+ geom IS NOT NULL
+ AND ST_GeometryType(osm_way.geom)= 'ST_LineString'
+ AND tags != '{}'
+ AND member_ref IS NULL
+UNION SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_relation
+ WHERE
+ geom IS NOT NULL
+ AND ST_GeometryType(osm_relation.geom)= 'ST_LineString'
+ AND tags != '{}'
+UNION SELECT
+ id,
+ tags,
+ (
+ st_dump(geom)
+ ).geom AS geom
+ FROM
+ osm_relation
+ WHERE
+ geom IS NOT NULL
+ AND ST_GeometryType(osm_relation.geom)= 'ST_MultiLineString'
+ AND tags != '{}';
\ No newline at end of file
diff --git a/basemap/layers/ocean/clean.sql b/basemap/layers/man_made/create.sql
similarity index 81%
rename from basemap/layers/ocean/clean.sql
rename to basemap/layers/man_made/create.sql
index 9395db856..c1ab1e569 100644
--- a/basemap/layers/ocean/clean.sql
+++ b/basemap/layers/man_made/create.sql
@@ -12,6 +12,13 @@
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-DROP MATERIALIZED VIEW IF EXISTS osm_ocean CASCADE;
-
-DROP MATERIALIZED VIEW IF EXISTS osm_ocean_simplified CASCADE;
+CREATE
+ OR REPLACE VIEW osm_man_made AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_way
+ WHERE
+ geom IS NOT NULL
+ AND tags ? 'man_made'
\ No newline at end of file
diff --git a/basemap/layers/man_made/tileset.js b/basemap/layers/man_made/tileset.js
index a54e22d4b..3f81bcbaa 100644
--- a/basemap/layers/man_made/tileset.js
+++ b/basemap/layers/man_made/tileset.js
@@ -21,7 +21,7 @@ export default {
{
"minzoom": 14,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_ways WHERE tags ? 'man_made'"
+ "sql": "SELECT id, tags, geom FROM osm_man_made"
}
]
}
diff --git a/basemap/layers/linestring/prepare.sql b/basemap/layers/member/create.sql
similarity index 61%
rename from basemap/layers/linestring/prepare.sql
rename to basemap/layers/member/create.sql
index fb7b1cf3e..ec0ab1bb6 100644
--- a/basemap/layers/linestring/prepare.sql
+++ b/basemap/layers/member/create.sql
@@ -12,16 +12,23 @@
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_member CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_linestring CASCADE;
-
-CREATE MATERIALIZED VIEW osm_linestring AS
-SELECT id, tags, geom, changeset
-FROM osm_ways
-LEFT JOIN osm_member ON id = member_ref
-WHERE ST_GeometryType(osm_ways.geom) = 'ST_LineString'
- AND tags != '{}'
- AND member_ref IS NULL;
-
-CREATE INDEX IF NOT EXISTS osm_linestring_tags_index ON osm_linestring USING gin (tags);
-CREATE INDEX IF NOT EXISTS osm_linestring_geom_index ON osm_linestring USING gist (geom);
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_member AS SELECT
+ DISTINCT member_ref AS member_ref
+ FROM
+ osm_relation,
+ UNNEST(
+ member_types,
+ member_refs
+ ) AS way(
+ member_type,
+ member_ref
+ )
+ WHERE
+ geom IS NOT NULL
+ AND member_type = 1
+ AND tags ->> 'type' = 'multipolygon'
+ AND NOT tags ->> 'natural' = 'coastline' WITH NO DATA;
\ No newline at end of file
diff --git a/basemap/layers/member/refresh.sql b/basemap/layers/member/refresh.sql
index 1056b2b2f..38e755998 100644
--- a/basemap/layers/member/refresh.sql
+++ b/basemap/layers/member/refresh.sql
@@ -12,5 +12,11 @@
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
+DROP
+ INDEX IF EXISTS osm_member_idx;
REFRESH MATERIALIZED VIEW osm_member;
+
+CREATE
+ INDEX IF NOT EXISTS osm_member_idx ON
+ osm_member(member_ref);
\ No newline at end of file
diff --git a/basemap/layers/natural/clean.sql b/basemap/layers/natural/clean.sql
deleted file mode 100644
index 06df24530..000000000
--- a/basemap/layers/natural/clean.sql
+++ /dev/null
@@ -1,65 +0,0 @@
--- Licensed to the Apache Software Foundation (ASF) under one or more
--- contributor license agreements. See the NOTICE file distributed with
--- this work for additional information regarding copyright ownership.
--- The ASF licenses this file to you under the Apache License, Version 2.0
--- (the "License"); you may not use this file except in compliance with
--- the License. You may obtain a copy of the License at
---
--- http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing, software
--- distributed under the License is distributed on an "AS IS" BASIS,
--- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--- See the License for the specific language governing permissions and
--- limitations under the License.
-
-DROP MATERIALIZED VIEW IF EXISTS osm_natural_filtered CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_natural_clustered CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_natural_grouped CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_natural_buffered CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_natural_exploded CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_natural CASCADE;
-
-DROP MATERIALIZED VIEW IF EXISTS osm_natural_xl_filtered CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_natural_xl_clustered CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_natural_xl_grouped CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_natural_xl_buffered CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_natural_xl_exploded CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_natural_xl CASCADE;
-
-DROP MATERIALIZED VIEW IF EXISTS osm_natural_m_filtered CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_natural_m_clustered CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_natural_m_grouped CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_natural_m_buffered CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_natural_m_exploded CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_natural_m CASCADE;
-
-DROP MATERIALIZED VIEW IF EXISTS osm_natural_s_filtered CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_natural_s_clustered CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_natural_s_grouped CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_natural_s_buffered CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_natural_s_exploded CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_natural_s CASCADE;
-
-DROP VIEW IF EXISTS osm_natural_z20 CASCADE;
-DROP VIEW IF EXISTS osm_natural_z19 CASCADE;
-DROP VIEW IF EXISTS osm_natural_z18 CASCADE;
-DROP VIEW IF EXISTS osm_natural_z17 CASCADE;
-DROP VIEW IF EXISTS osm_natural_z16 CASCADE;
-DROP VIEW IF EXISTS osm_natural_z15 CASCADE;
-DROP VIEW IF EXISTS osm_natural_z14 CASCADE;
-DROP VIEW IF EXISTS osm_natural_z13 CASCADE;
-
-DROP MATERIALIZED VIEW IF EXISTS osm_natural_z12 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_natural_z11 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_natural_z10 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_natural_z9 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_natural_z8 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_natural_z7 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_natural_z6 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_natural_z5 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_natural_z4 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_natural_z3 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_natural_z2 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_natural_z1 CASCADE;
-
diff --git a/basemap/layers/natural/create.sql b/basemap/layers/natural/create.sql
new file mode 100644
index 000000000..319adebd7
--- /dev/null
+++ b/basemap/layers/natural/create.sql
@@ -0,0 +1,756 @@
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements. See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to you under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License. You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+-- Zoom levels 20 to 13
+CREATE
+ OR REPLACE VIEW osm_natural AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_way
+ WHERE
+ tags ? 'natural'
+UNION SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_relation
+ WHERE
+ tags ? 'natural';
+
+CREATE
+ OR REPLACE VIEW osm_natural_z20 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_natural;
+
+CREATE
+ OR REPLACE VIEW osm_natural_z19 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_natural;
+
+CREATE
+ OR REPLACE VIEW osm_natural_z18 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_natural;
+
+CREATE
+ OR REPLACE VIEW osm_natural_z17 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_natural;
+
+CREATE
+ OR REPLACE VIEW osm_natural_z16 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_natural;
+
+CREATE
+ OR REPLACE VIEW osm_natural_z15 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_natural;
+
+CREATE
+ OR REPLACE VIEW osm_natural_z14 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_natural;
+
+CREATE
+ OR REPLACE VIEW osm_natural_z13 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_natural;
+
+-- Zoom level 12
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_natural_z12_filtered CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_natural_z12_filtered AS SELECT
+ tags -> 'natural' AS tag,
+ st_buffer(
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 12 )
+ ),
+ 78270 / POWER( 2, 12 )* 1.1,
+ 'join=mitre'
+ ) AS geom
+ FROM
+ osm_natural
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 12 ), 2 )* 32
+ AND tags ->> 'natural' IN(
+ 'grassland',
+ 'heath',
+ 'scrub',
+ 'wood',
+ 'bay',
+ 'beach',
+ 'glacier',
+ 'mud',
+ 'shingle',
+ 'shoal',
+ 'strait',
+ 'water',
+ 'wetland',
+ 'bare_rock',
+ 'sand',
+ 'scree'
+ ) WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_natural_z12 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_natural_z12 AS WITH clustered AS(
+ SELECT
+ tag,
+ geom,
+ st_clusterdbscan(
+ geom,
+ 0,
+ 0
+ ) OVER(
+ PARTITION BY tag
+ ) AS cluster
+ FROM
+ osm_natural_z12_filtered
+ ) SELECT
+ ROW_NUMBER() OVER() AS id,
+ jsonb_build_object(
+ 'natural',
+ tag
+ ) AS tags,
+ st_simplifypreservetopology(
+ (
+ st_dump(
+ st_buffer(
+ st_collect(geom),
+ - 78270 / POWER( 2, 12 ),
+ 'join=mitre'
+ )
+ )
+ ).geom,
+ 78270 / POWER( 2, 12 )
+ ) AS geom
+ FROM
+ clustered
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 12 ), 2 )* 32
+ GROUP BY
+ tag,
+ cluster WITH NO DATA;
+
+-- Zoom level 11
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_natural_z11_filtered CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_natural_z11_filtered AS SELECT
+ tags -> 'natural' AS tag,
+ st_buffer(
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 11 )
+ ),
+ 78270 / POWER( 2, 11 )* 1.1,
+ 'join=mitre'
+ ) AS geom
+ FROM
+ osm_natural_z12
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 11 ), 2 )* 32 WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_natural_z11 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_natural_z11 AS WITH clustered AS(
+ SELECT
+ tag,
+ geom,
+ st_clusterdbscan(
+ geom,
+ 0,
+ 0
+ ) OVER(
+ PARTITION BY tag
+ ) AS cluster
+ FROM
+ osm_natural_z11_filtered
+ ) SELECT
+ ROW_NUMBER() OVER() AS id,
+ jsonb_build_object(
+ 'natural',
+ tag
+ ) AS tags,
+ st_simplifypreservetopology(
+ (
+ st_dump(
+ st_buffer(
+ st_collect(geom),
+ - 78270 / POWER( 2, 11 ),
+ 'join=mitre'
+ )
+ )
+ ).geom,
+ 78270 / POWER( 2, 11 )
+ ) AS geom
+ FROM
+ clustered
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 11 ), 2 )* 32
+ GROUP BY
+ tag,
+ cluster WITH NO DATA;
+
+-- Zoom level 10
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_natural_z10_filtered CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_natural_z10_filtered AS SELECT
+ tags -> 'natural' AS tag,
+ st_buffer(
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 10 )
+ ),
+ 78270 / POWER( 2, 10 )* 1.1,
+ 'join=mitre'
+ ) AS geom
+ FROM
+ osm_natural_z11
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 10 ), 2 )* 32 WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_natural_z10 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_natural_z10 AS WITH clustered AS(
+ SELECT
+ tag,
+ geom,
+ st_clusterdbscan(
+ geom,
+ 0,
+ 0
+ ) OVER(
+ PARTITION BY tag
+ ) AS cluster
+ FROM
+ osm_natural_z10_filtered
+ ) SELECT
+ ROW_NUMBER() OVER() AS id,
+ jsonb_build_object(
+ 'natural',
+ tag
+ ) AS tags,
+ st_simplifypreservetopology(
+ (
+ st_dump(
+ st_buffer(
+ st_collect(geom),
+ - 78270 / POWER( 2, 10 ),
+ 'join=mitre'
+ )
+ )
+ ).geom,
+ 78270 / POWER( 2, 10 )
+ ) AS geom
+ FROM
+ clustered
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 10 ), 2 )* 32
+ GROUP BY
+ tag,
+ cluster WITH NO DATA;
+
+-- Zoom level 9
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_natural_z9 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_natural_z9 AS WITH filtered AS(
+ SELECT
+ tags -> 'natural' AS tag,
+ st_buffer(
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 9 )
+ ),
+ 78270 / POWER( 2, 9 )* 1.1,
+ 'join=mitre'
+ ) AS geom
+ FROM
+ osm_natural_z10
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 9 ), 2 )* 32
+ ),
+ clustered AS(
+ SELECT
+ tag,
+ geom,
+ st_clusterdbscan(
+ geom,
+ 0,
+ 0
+ ) OVER(
+ PARTITION BY tag
+ ) AS cluster
+ FROM
+ filtered
+ ) SELECT
+ ROW_NUMBER() OVER() AS id,
+ jsonb_build_object(
+ 'natural',
+ tag
+ ) AS tags,
+ st_simplifypreservetopology(
+ (
+ st_dump(
+ st_buffer(
+ st_collect(geom),
+ - 78270 / POWER( 2, 9 ),
+ 'join=mitre'
+ )
+ )
+ ).geom,
+ 78270 / POWER( 2, 9 )
+ ) AS geom
+ FROM
+ clustered
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 9 ), 2 )* 32
+ GROUP BY
+ tag,
+ cluster WITH NO DATA;
+
+-- Zoom level 8
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_natural_z8 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_natural_z8 AS WITH filtered AS(
+ SELECT
+ tags -> 'natural' AS tag,
+ st_buffer(
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 8 )
+ ),
+ 78270 / POWER( 2, 8 )* 1.1,
+ 'join=mitre'
+ ) AS geom
+ FROM
+ osm_natural_z9
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 8 ), 2 )* 32
+ ),
+ clustered AS(
+ SELECT
+ tag,
+ geom,
+ st_clusterdbscan(
+ geom,
+ 0,
+ 0
+ ) OVER(
+ PARTITION BY tag
+ ) AS cluster
+ FROM
+ filtered
+ ) SELECT
+ ROW_NUMBER() OVER() AS id,
+ jsonb_build_object(
+ 'natural',
+ tag
+ ) AS tags,
+ st_simplifypreservetopology(
+ (
+ st_dump(
+ st_buffer(
+ st_collect(geom),
+ - 78270 / POWER( 2, 8 ),
+ 'join=mitre'
+ )
+ )
+ ).geom,
+ 78270 / POWER( 2, 8 )
+ ) AS geom
+ FROM
+ clustered
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 8 ), 2 )* 32
+ GROUP BY
+ tag,
+ cluster WITH NO DATA;
+
+-- Zoom level 7
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_natural_z7 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_natural_z7 AS WITH filtered AS(
+ SELECT
+ tags -> 'natural' AS tag,
+ st_buffer(
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 7 )
+ ),
+ 78270 / POWER( 2, 7 )* 1.1,
+ 'join=mitre'
+ ) AS geom
+ FROM
+ osm_natural_z8
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 7 ), 2 )* 32
+ ),
+ clustered AS(
+ SELECT
+ tag,
+ geom,
+ st_clusterdbscan(
+ geom,
+ 0,
+ 0
+ ) OVER(
+ PARTITION BY tag
+ ) AS cluster
+ FROM
+ filtered
+ ) SELECT
+ ROW_NUMBER() OVER() AS id,
+ jsonb_build_object(
+ 'natural',
+ tag
+ ) AS tags,
+ st_simplifypreservetopology(
+ (
+ st_dump(
+ st_buffer(
+ st_collect(geom),
+ - 78270 / POWER( 2, 7 ),
+ 'join=mitre'
+ )
+ )
+ ).geom,
+ 78270 / POWER( 2, 7 )
+ ) AS geom
+ FROM
+ clustered
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 7 ), 2 )* 32
+ GROUP BY
+ tag,
+ cluster WITH NO DATA;
+
+-- Zoom level 6
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_natural_z6 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_natural_z6 AS WITH filtered AS(
+ SELECT
+ tags -> 'natural' AS tag,
+ st_buffer(
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 6 )
+ ),
+ 78270 / POWER( 2, 6 )* 1.1,
+ 'join=mitre'
+ ) AS geom
+ FROM
+ osm_natural_z7
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 6 ), 2 )* 32
+ ),
+ clustered AS(
+ SELECT
+ tag,
+ geom,
+ st_clusterdbscan(
+ geom,
+ 0,
+ 0
+ ) OVER(
+ PARTITION BY tag
+ ) AS cluster
+ FROM
+ filtered
+ ) SELECT
+ ROW_NUMBER() OVER() AS id,
+ jsonb_build_object(
+ 'natural',
+ tag
+ ) AS tags,
+ st_simplifypreservetopology(
+ (
+ st_dump(
+ st_buffer(
+ st_collect(geom),
+ - 78270 / POWER( 2, 6 ),
+ 'join=mitre'
+ )
+ )
+ ).geom,
+ 78270 / POWER( 2, 6 )
+ ) AS geom
+ FROM
+ clustered
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 6 ), 2 )* 32
+ GROUP BY
+ tag,
+ cluster WITH NO DATA;
+
+-- Zoom level 5
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_natural_z5 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_natural_z5 AS WITH filtered AS(
+ SELECT
+ tags -> 'natural' AS tag,
+ st_buffer(
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 5 )
+ ),
+ 78270 / POWER( 2, 5 )* 1.1,
+ 'join=mitre'
+ ) AS geom
+ FROM
+ osm_natural_z6
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 5 ), 2 )* 32
+ ),
+ clustered AS(
+ SELECT
+ tag,
+ geom,
+ st_clusterdbscan(
+ geom,
+ 0,
+ 0
+ ) OVER(
+ PARTITION BY tag
+ ) AS cluster
+ FROM
+ filtered
+ ) SELECT
+ ROW_NUMBER() OVER() AS id,
+ jsonb_build_object(
+ 'natural',
+ tag
+ ) AS tags,
+ st_simplifypreservetopology(
+ (
+ st_dump(
+ st_buffer(
+ st_collect(geom),
+ - 78270 / POWER( 2, 5 ),
+ 'join=mitre'
+ )
+ )
+ ).geom,
+ 78270 / POWER( 2, 5 )
+ ) AS geom
+ FROM
+ clustered
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 5 ), 2 )* 32
+ GROUP BY
+ tag,
+ cluster WITH NO DATA;
+
+-- Zoom level 4
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_natural_z4 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_natural_z4 AS WITH filtered AS(
+ SELECT
+ tags -> 'natural' AS tag,
+ st_buffer(
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 4 )
+ ),
+ 78270 / POWER( 2, 4 )* 1.1,
+ 'join=mitre'
+ ) AS geom
+ FROM
+ osm_natural_z6
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 4 ), 2 )* 32
+ ),
+ clustered AS(
+ SELECT
+ tag,
+ geom,
+ st_clusterdbscan(
+ geom,
+ 0,
+ 0
+ ) OVER(
+ PARTITION BY tag
+ ) AS cluster
+ FROM
+ filtered
+ ) SELECT
+ ROW_NUMBER() OVER() AS id,
+ jsonb_build_object(
+ 'natural',
+ tag
+ ) AS tags,
+ st_simplifypreservetopology(
+ (
+ st_dump(
+ st_buffer(
+ st_collect(geom),
+ - 78270 / POWER( 2, 4 ),
+ 'join=mitre'
+ )
+ )
+ ).geom,
+ 78270 / POWER( 2, 4 )
+ ) AS geom
+ FROM
+ clustered
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 4 ), 2 )* 32
+ GROUP BY
+ tag,
+ cluster WITH NO DATA;
+
+-- Zoom level 3
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_natural_z3 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_natural_z3 AS SELECT
+ id,
+ tags,
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 3 )
+ ) AS geom
+ FROM
+ osm_natural_z4
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 3 ), 2 )* 16 WITH NO DATA;
+
+-- Zoom level 2
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_natural_z2 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_natural_z2 AS SELECT
+ id,
+ tags,
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 2 )
+ ) AS geom
+ FROM
+ osm_natural_z4
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 2 ), 2 )* 16 WITH NO DATA;
+
+-- Zoom level 1
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_natural_z1 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_natural_z1 AS SELECT
+ id,
+ tags,
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 1 )
+ ) AS geom
+ FROM
+ osm_natural_z4
+ WHERE
+ geom IS NOT NULL
+ AND NOT ST_IsEmpty(geom)
+ AND st_area(geom)> POWER( 78270 / POWER( 2, 1 ), 2 )* 16 WITH NO DATA;
diff --git a/basemap/layers/natural/index.sql b/basemap/layers/natural/index.sql
deleted file mode 100644
index eb0db91c4..000000000
--- a/basemap/layers/natural/index.sql
+++ /dev/null
@@ -1,27 +0,0 @@
--- Licensed to the Apache Software Foundation (ASF) under one or more
--- contributor license agreements. See the NOTICE file distributed with
--- this work for additional information regarding copyright ownership.
--- The ASF licenses this file to you under the Apache License, Version 2.0
--- (the "License"); you may not use this file except in compliance with
--- the License. You may obtain a copy of the License at
---
--- http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing, software
--- distributed under the License is distributed on an "AS IS" BASIS,
--- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--- See the License for the specific language governing permissions and
--- limitations under the License.
-
-CREATE INDEX IF NOT EXISTS osm_natural_geom_z12_index ON osm_natural_z12 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_natural_geom_z11_index ON osm_natural_z11 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_natural_geom_z10_index ON osm_natural_z10 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_natural_geom_z9_index ON osm_natural_z9 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_natural_geom_z8_index ON osm_natural_z8 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_natural_geom_z7_index ON osm_natural_z7 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_natural_geom_z6_index ON osm_natural_z6 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_natural_geom_z5_index ON osm_natural_z5 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_natural_geom_z4_index ON osm_natural_z4 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_natural_geom_z3_index ON osm_natural_z3 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_natural_geom_z2_index ON osm_natural_z2 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_natural_geom_z1_index ON osm_natural_z1 USING SPGIST (geom);
diff --git a/basemap/layers/natural/prepare.sql b/basemap/layers/natural/prepare.sql
deleted file mode 100644
index 3bc1e3627..000000000
--- a/basemap/layers/natural/prepare.sql
+++ /dev/null
@@ -1,212 +0,0 @@
--- Licensed to the Apache Software Foundation (ASF) under one or more
--- contributor license agreements. See the NOTICE file distributed with
--- this work for additional information regarding copyright ownership.
--- The ASF licenses this file to you under the Apache License, Version 2.0
--- (the "License"); you may not use this file except in compliance with
--- the License. You may obtain a copy of the License at
---
--- http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing, software
--- distributed under the License is distributed on an "AS IS" BASIS,
--- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--- See the License for the specific language governing permissions and
--- limitations under the License.
-
--- ('grassland', 'heath', 'scrub', 'wood', 'bay', 'beach', 'glacier', 'mud', 'shingle', 'shoal', 'strait', 'water', 'wetland', 'bare_rock', 'sand', 'scree');
-
-CREATE MATERIALIZED VIEW osm_natural_filtered AS
-SELECT
- tags -> 'natural' AS natural_value,
- st_simplifypreservetopology(geom, 78270 / power(2, 12)) AS geom
-FROM osm_polygon
-WHERE geom IS NOT NULL
- AND st_area(geom) > 78270 / power(2, 12) * 100
- AND tags ->> 'natural' IN ('grassland', 'heath', 'scrub', 'wood', 'bay', 'beach', 'glacier', 'mud', 'shingle', 'shoal', 'strait', 'water', 'wetland', 'bare_rock', 'sand', 'scree');
-CREATE INDEX IF NOT EXISTS osm_natural_filtered_geom_idx ON osm_natural_filtered USING GIST (geom);
-CREATE INDEX IF NOT EXISTS osm_natural_filtered_tags_idx ON osm_natural_filtered (natural_value);
-
-CREATE MATERIALIZED VIEW osm_natural_clustered AS
-SELECT
- natural_value,
- geom,
- st_clusterdbscan(geom, 0, 0) OVER(PARTITION BY natural_value) AS cluster
-FROM osm_natural_filtered
-WHERE geom IS NOT NULL;
-CREATE INDEX IF NOT EXISTS osm_natural_clustered_geom_idx ON osm_natural_clustered USING GIST (geom);
-CREATE INDEX IF NOT EXISTS osm_natural_clustered_tags_idx ON osm_natural_clustered (natural_value);
-
-CREATE MATERIALIZED VIEW osm_natural_grouped AS
-SELECT
- natural_value,
- st_collect(geom) AS geom
-FROM osm_natural_clustered
-GROUP BY natural_value, cluster;
-
-CREATE MATERIALIZED VIEW osm_natural_buffered AS
-SELECT
- natural_value,
- st_buffer(geom, 0, 'join=mitre') AS geom
-FROM osm_natural_grouped;
-
-CREATE MATERIALIZED VIEW osm_natural_exploded AS
-SELECT
- natural_value,
- (st_dump(geom)).geom AS geom
-FROM osm_natural_buffered;
-
-CREATE MATERIALIZED VIEW osm_natural AS
-SELECT
- row_number() OVER () AS id,
- jsonb_build_object('natural', natural_value) AS tags,
- geom
-FROM osm_natural_exploded;
-CREATE INDEX IF NOT EXISTS osm_natural_geom_idx ON osm_natural_filtered USING GIST (geom);
-CREATE INDEX IF NOT EXISTS osm_natural_tags_idx ON osm_natural_filtered USING GIN (natural_value);
-
--- XTRA LARGE
-CREATE MATERIALIZED VIEW osm_natural_xl_filtered AS
-SELECT
- id,
- tags -> 'natural' as natural_value,
- st_buffer(st_simplifypreservetopology(geom, 78270 / power(2, 8)), 78270 / power(2, 8), 'join=mitre') AS geom
-FROM osm_natural
-WHERE st_area(st_envelope(geom)) > 25 * power(78270 / power(2, 8), 2);
-CREATE INDEX IF NOT EXISTS osm_natural_xl_filtered_geom_idx ON osm_natural_xl_filtered USING GIST (geom);
-CREATE INDEX IF NOT EXISTS osm_natural_xl_filtered_tags_idx ON osm_natural_xl_filtered (natural_value);
-
-CREATE MATERIALIZED VIEW osm_natural_xl_clustered AS
-SELECT
- natural_value,
- geom,
- st_clusterdbscan(geom, 0, 0) OVER(PARTITION BY natural_value) AS cluster
-FROM osm_natural_xl_filtered;
-CREATE INDEX IF NOT EXISTS osm_natural_xl_clustered_geom_idx ON osm_natural_xl_clustered USING GIST (geom);
-CREATE INDEX IF NOT EXISTS osm_natural_xl_clustered_tags_idx ON osm_natural_xl_clustered (natural_value);
-
-CREATE MATERIALIZED VIEW osm_natural_xl_grouped AS
-SELECT
- natural_value,
- cluster,
- st_collect(geom) AS geom
-FROM osm_natural_xl_clustered
-GROUP BY natural_value, cluster;
-
-CREATE MATERIALIZED VIEW osm_natural_xl_buffered AS
-SELECT
- natural_value,
- st_buffer(geom, -78270 / power(2, 8), 'join=mitre') AS geom
-FROM osm_natural_xl_grouped;
-
-CREATE MATERIALIZED VIEW osm_natural_xl_exploded AS
-SELECT
- natural_value,
- (st_dump(geom)).geom AS geom
-FROM osm_natural_xl_buffered;
-
-CREATE MATERIALIZED VIEW osm_natural_xl AS
-SELECT
- row_number() OVER () AS id,
- jsonb_build_object('natural', natural_value) AS tags,
- geom AS geom
-FROM osm_natural_xl_buffered;
-CREATE INDEX IF NOT EXISTS osm_natural_xl_geom_idx ON osm_natural_xl USING GIST (geom);
-CREATE INDEX IF NOT EXISTS osm_natural_xl_tags_idx ON osm_natural_xl USING GIN (tags);
-
--- MEDIUM
-CREATE MATERIALIZED VIEW osm_natural_m_filtered AS
-SELECT
- id,
- tags -> 'natural' as natural_value,
- st_buffer(st_simplifypreservetopology(geom, 78270 / power(2, 5)), 78270 / power(2, 6), 'join=mitre') AS geom
-FROM osm_natural
-WHERE st_area(st_envelope(geom)) > 25 * power(78270 / power(2, 6), 2);
-CREATE INDEX IF NOT EXISTS osm_natural_m_filtered_geom_idx ON osm_natural_m_filtered USING GIST (geom);
-CREATE INDEX IF NOT EXISTS osm_natural_m_filtered_tags_idx ON osm_natural_m_filtered (natural_value);
-
-CREATE MATERIALIZED VIEW osm_natural_m_clustered AS
-SELECT
- natural_value,
- geom,
- st_clusterdbscan(geom, 0, 0) OVER(PARTITION BY natural_value) AS cluster
-FROM osm_natural_m_filtered;
-CREATE INDEX IF NOT EXISTS osm_natural_m_clustered_geom_idx ON osm_natural_m_clustered USING GIST (geom);
-CREATE INDEX IF NOT EXISTS osm_natural_m_clustered_tags_idx ON osm_natural_m_clustered (natural_value);
-
-CREATE MATERIALIZED VIEW osm_natural_m_grouped AS
-SELECT
- natural_value,
- cluster,
- st_collect(geom) AS geom
-FROM osm_natural_m_clustered
-GROUP BY natural_value, cluster;
-
-CREATE MATERIALIZED VIEW osm_natural_m_buffered AS
-SELECT
- natural_value,
- st_buffer(geom, 0.5 * -78270 / power(2, 6), 'join=mitre') AS geom
-FROM osm_natural_m_grouped;
-
-CREATE MATERIALIZED VIEW osm_natural_m_exploded AS
-SELECT
- natural_value,
- (st_dump(geom)).geom AS geom
-FROM osm_natural_m_buffered;
-
-CREATE MATERIALIZED VIEW osm_natural_m AS
-SELECT
- row_number() OVER () AS id,
- jsonb_build_object('natural', natural_value) AS tags,
- geom AS geom
-FROM osm_natural_m_buffered;
-CREATE INDEX IF NOT EXISTS osm_natural_m_geom_idx ON osm_natural_m USING GIST (geom);
-CREATE INDEX IF NOT EXISTS osm_natural_m_tags_idx ON osm_natural_m USING GIN (tags);
-
--- SMALL
-CREATE MATERIALIZED VIEW osm_natural_s_filtered AS
-SELECT
- id,
- tags -> 'natural' as natural_value,
- st_buffer(st_simplifypreservetopology(geom, 78270 / power(2, 5)), 78270 / power(2, 6), 'join=mitre') AS geom
-FROM osm_natural
-WHERE st_area(st_envelope(geom)) > 25 * power(78270 / power(2, 6), 2);
-CREATE INDEX IF NOT EXISTS osm_natural_s_filtered_geom_idx ON osm_natural_s_filtered USING GIST (geom);
-CREATE INDEX IF NOT EXISTS osm_natural_s_filtered_tags_idx ON osm_natural_s_filtered (natural_value);
-
-CREATE MATERIALIZED VIEW osm_natural_s_clustered AS
-SELECT
- natural_value,
- geom,
- st_clusterdbscan(geom, 0, 0) OVER(PARTITION BY natural_value) AS cluster
-FROM osm_natural_s_filtered;
-CREATE INDEX IF NOT EXISTS osm_natural_s_clustered_geom_idx ON osm_natural_s_clustered USING GIST (geom);
-CREATE INDEX IF NOT EXISTS osm_natural_s_clustered_tags_idx ON osm_natural_s_clustered (natural_value);
-
-CREATE MATERIALIZED VIEW osm_natural_s_grouped AS
-SELECT
- natural_value,
- cluster,
- st_collect(geom) AS geom
-FROM osm_natural_s_clustered
-GROUP BY natural_value, cluster;
-
-CREATE MATERIALIZED VIEW osm_natural_s_buffered AS
-SELECT
- natural_value,
- st_buffer(geom, 0.1 * -78270 / power(2, 6), 'join=mitre') AS geom
-FROM osm_natural_s_grouped;
-
-CREATE MATERIALIZED VIEW osm_natural_s_exploded AS
-SELECT
- natural_value,
- (st_dump(geom)).geom AS geom
-FROM osm_natural_s_buffered;
-
-CREATE MATERIALIZED VIEW osm_natural_s AS
-SELECT
- row_number() OVER () AS id,
- jsonb_build_object('natural', natural_value) AS tags,
- geom AS geom
-FROM osm_natural_s_buffered;
-CREATE INDEX IF NOT EXISTS osm_natural_s_geom_idx ON osm_natural_s USING GIST (geom);
-CREATE INDEX IF NOT EXISTS osm_natural_s_tags_idx ON osm_natural_s USING GIN (tags);
diff --git a/basemap/layers/natural/refresh.sql b/basemap/layers/natural/refresh.sql
index 215d35ab3..4d61fd264 100644
--- a/basemap/layers/natural/refresh.sql
+++ b/basemap/layers/natural/refresh.sql
@@ -12,46 +12,281 @@
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
+-- Zoom level 12
+DROP
+ INDEX IF EXISTS osm_natural_z12_filtered_geom_idx;
-REFRESH MATERIALIZED VIEW osm_natural_filtered;
-REFRESH MATERIALIZED VIEW osm_natural_clustered;
-REFRESH MATERIALIZED VIEW osm_natural_grouped;
-REFRESH MATERIALIZED VIEW osm_natural_buffered;
-REFRESH MATERIALIZED VIEW osm_natural_exploded;
-REFRESH MATERIALIZED VIEW osm_natural;
-
-REFRESH MATERIALIZED VIEW osm_natural_xl_filtered;
-REFRESH MATERIALIZED VIEW osm_natural_xl_clustered;
-REFRESH MATERIALIZED VIEW osm_natural_xl_grouped;
-REFRESH MATERIALIZED VIEW osm_natural_xl_buffered;
-REFRESH MATERIALIZED VIEW osm_natural_xl_exploded;
-REFRESH MATERIALIZED VIEW osm_natural_xl;
-
--- Why don't we have a natural_l view?
-
-REFRESH MATERIALIZED VIEW osm_natural_m_filtered;
-REFRESH MATERIALIZED VIEW osm_natural_m_clustered;
-REFRESH MATERIALIZED VIEW osm_natural_m_grouped;
-REFRESH MATERIALIZED VIEW osm_natural_m_buffered;
-REFRESH MATERIALIZED VIEW osm_natural_m_exploded;
-REFRESH MATERIALIZED VIEW osm_natural_m;
-
-REFRESH MATERIALIZED VIEW osm_natural_s_filtered;
-REFRESH MATERIALIZED VIEW osm_natural_s_clustered;
-REFRESH MATERIALIZED VIEW osm_natural_s_grouped;
-REFRESH MATERIALIZED VIEW osm_natural_s_buffered;
-REFRESH MATERIALIZED VIEW osm_natural_s_exploded;
-REFRESH MATERIALIZED VIEW osm_natural_s;
+DROP
+ INDEX IF EXISTS osm_natural_z12_filtered_tags_idx;
+
+REFRESH MATERIALIZED VIEW osm_natural_z12_filtered;
+
+CREATE
+ INDEX IF NOT EXISTS osm_natural_z12_filtered_geom_idx ON
+ osm_natural_z12_filtered
+ USING GIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_natural_z12_filtered_tags_idx ON
+ osm_natural_z12_filtered(tag);
+
+DROP
+ INDEX IF EXISTS osm_natural_z12_geom_idx;
+
+DROP
+ INDEX IF EXISTS osm_natural_z12_tags_idx;
REFRESH MATERIALIZED VIEW osm_natural_z12;
+
+CREATE
+ INDEX IF NOT EXISTS osm_natural_z12_geom_idx ON
+ osm_natural_z12
+ USING GIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_natural_z12_tags_idx ON
+ osm_natural_z12
+ USING GIN(tags);
+
+-- Zoom level 11
+DROP
+ INDEX IF EXISTS osm_natural_z11_filtered_geom_idx;
+
+DROP
+ INDEX IF EXISTS osm_natural_z11_filtered_tags_idx;
+
+REFRESH MATERIALIZED VIEW osm_natural_z11_filtered;
+
+CREATE
+ INDEX IF NOT EXISTS osm_natural_z11_filtered_geom_idx ON
+ osm_natural_z11_filtered
+ USING GIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_natural_z11_filtered_tags_idx ON
+ osm_natural_z11_filtered(tag);
+
+DROP
+ INDEX IF EXISTS osm_natural_z11_geom_idx;
+
+DROP
+ INDEX IF EXISTS osm_natural_z11_tags_idx;
+
REFRESH MATERIALIZED VIEW osm_natural_z11;
+
+CREATE
+ INDEX IF NOT EXISTS osm_natural_z11_geom_idx ON
+ osm_natural_z11
+ USING GIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_natural_z11_tags_idx ON
+ osm_natural_z11
+ USING GIN(tags);
+
+-- Zoom level 10
+DROP
+ INDEX IF EXISTS osm_natural_z10_filtered_geom_idx;
+
+DROP
+ INDEX IF EXISTS osm_natural_z10_filtered_tags_idx;
+
+REFRESH MATERIALIZED VIEW osm_natural_z10_filtered;
+
+CREATE
+ INDEX IF NOT EXISTS osm_natural_z10_filtered_geom_idx ON
+ osm_natural_z10_filtered
+ USING GIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_natural_z10_filtered_tags_idx ON
+ osm_natural_z10_filtered(tag);
+
+DROP
+ INDEX IF EXISTS osm_natural_z10_geom_idx;
+
+DROP
+ INDEX IF EXISTS osm_natural_z10_tags_idx;
+
REFRESH MATERIALIZED VIEW osm_natural_z10;
+
+CREATE
+ INDEX IF NOT EXISTS osm_natural_z10_geom_idx ON
+ osm_natural_z10
+ USING GIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_natural_z10_tags_idx ON
+ osm_natural_z10
+ USING GIN(tags);
+
+-- Zoom level 9
+DROP
+ INDEX IF EXISTS osm_natural_z9_geom_idx;
+
+DROP
+ INDEX IF EXISTS osm_natural_z9_tags_idx;
+
REFRESH MATERIALIZED VIEW osm_natural_z9;
+
+CREATE
+ INDEX IF NOT EXISTS osm_natural_z9_geom_idx ON
+ osm_natural_z9
+ USING GIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_natural_z9_tags_idx ON
+ osm_natural_z9
+ USING GIN(tags);
+
+-- Zoom level 8
+DROP
+ INDEX IF EXISTS osm_natural_z8_geom_idx;
+
+DROP
+ INDEX IF EXISTS osm_natural_z8_tags_idx;
+
REFRESH MATERIALIZED VIEW osm_natural_z8;
+
+CREATE
+ INDEX IF NOT EXISTS osm_natural_z8_geom_idx ON
+ osm_natural_z8
+ USING GIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_natural_z8_tags_idx ON
+ osm_natural_z8
+ USING GIN(tags);
+
+-- Zoom level 7
+DROP
+ INDEX IF EXISTS osm_natural_z7_geom_idx;
+
+DROP
+ INDEX IF EXISTS osm_natural_z7_tags_idx;
+
REFRESH MATERIALIZED VIEW osm_natural_z7;
+
+CREATE
+ INDEX IF NOT EXISTS osm_natural_z7_geom_idx ON
+ osm_natural_z7
+ USING GIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_natural_z7_tags_idx ON
+ osm_natural_z7
+ USING GIN(tags);
+
+-- Zoom level 6
+DROP
+ INDEX IF EXISTS osm_natural_z6_geom_idx;
+
+DROP
+ INDEX IF EXISTS osm_natural_z6_tags_idx;
+
REFRESH MATERIALIZED VIEW osm_natural_z6;
+
+CREATE
+ INDEX IF NOT EXISTS osm_natural_z6_geom_idx ON
+ osm_natural_z6
+ USING GIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_natural_z6_tags_idx ON
+ osm_natural_z6
+ USING GIN(tags);
+
+-- Zoom level 5
+DROP
+ INDEX IF EXISTS osm_natural_z5_geom_idx;
+
+DROP
+ INDEX IF EXISTS osm_natural_z5_tags_idx;
+
REFRESH MATERIALIZED VIEW osm_natural_z5;
+
+CREATE
+ INDEX IF NOT EXISTS osm_natural_z5_geom_idx ON
+ osm_natural_z5
+ USING GIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_natural_z5_tags_idx ON
+ osm_natural_z5
+ USING GIN(tags);
+
+-- Zoom level 4
+DROP
+ INDEX IF EXISTS osm_natural_z4_geom_idx;
+
+DROP
+ INDEX IF EXISTS osm_natural_z4_tags_idx;
+
REFRESH MATERIALIZED VIEW osm_natural_z4;
+
+CREATE
+ INDEX IF NOT EXISTS osm_natural_z4_geom_idx ON
+ osm_natural_z4
+ USING GIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_natural_z4_tags_idx ON
+ osm_natural_z4
+ USING GIN(tags);
+
+-- Zoom level 3
+DROP
+ INDEX IF EXISTS osm_natural_z3_geom_idx;
+
+DROP
+ INDEX IF EXISTS osm_natural_z3_tags_idx;
+
REFRESH MATERIALIZED VIEW osm_natural_z3;
+
+CREATE
+ INDEX IF NOT EXISTS osm_natural_z3_geom_idx ON
+ osm_natural_z3
+ USING GIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_natural_z3_tags_idx ON
+ osm_natural_z3
+ USING GIN(tags);
+
+-- Zoom level 2
+DROP
+ INDEX IF EXISTS osm_natural_z2_geom_idx;
+
+DROP
+ INDEX IF EXISTS osm_natural_z2_tags_idx;
+
REFRESH MATERIALIZED VIEW osm_natural_z2;
+
+CREATE
+ INDEX IF NOT EXISTS osm_natural_z2_geom_idx ON
+ osm_natural_z2
+ USING GIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_natural_z2_tags_idx ON
+ osm_natural_z2
+ USING GIN(tags);
+
+-- Zoom level 1
+DROP
+ INDEX IF EXISTS osm_natural_z1_geom_idx;
+
+DROP
+ INDEX IF EXISTS osm_natural_z1_tags_idx;
+
REFRESH MATERIALIZED VIEW osm_natural_z1;
+
+CREATE
+ INDEX IF NOT EXISTS osm_natural_z1_geom_idx ON
+ osm_natural_z1
+ USING GIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_natural_z1_tags_idx ON
+ osm_natural_z1
+ USING GIN(tags);
diff --git a/basemap/layers/natural/simplify.sql b/basemap/layers/natural/simplify.sql
deleted file mode 100644
index 8f4523675..000000000
--- a/basemap/layers/natural/simplify.sql
+++ /dev/null
@@ -1,98 +0,0 @@
--- Licensed to the Apache Software Foundation (ASF) under one or more
--- contributor license agreements. See the NOTICE file distributed with
--- this work for additional information regarding copyright ownership.
--- The ASF licenses this file to you under the Apache License, Version 2.0
--- (the "License"); you may not use this file except in compliance with
--- the License. You may obtain a copy of the License at
---
--- http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing, software
--- distributed under the License is distributed on an "AS IS" BASIS,
--- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--- See the License for the specific language governing permissions and
--- limitations under the License.
-
-CREATE VIEW osm_natural_z20 AS
-SELECT id, tags, geom FROM osm_natural;
-
-CREATE VIEW osm_natural_z19 AS
-SELECT id, tags, geom FROM osm_natural;
-
-CREATE VIEW osm_natural_z18 AS
-SELECT id, tags, geom FROM osm_natural;
-
-CREATE VIEW osm_natural_z17 AS
-SELECT id, tags, geom FROM osm_natural;
-
-CREATE VIEW osm_natural_z16 AS
-SELECT id, tags, geom FROM osm_natural;
-
-CREATE VIEW osm_natural_z15 AS
-SELECT id, tags, geom FROM osm_natural;
-
-CREATE VIEW osm_natural_z14 AS
-SELECT id, tags, geom FROM osm_natural;
-
-CREATE VIEW osm_natural_z13 AS
-SELECT id, tags, geom FROM osm_natural;
-
-CREATE MATERIALIZED VIEW osm_natural_z12 AS
-SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 12)) AS geom
-FROM osm_natural
-WHERE st_area(st_envelope(geom)) > 10 * power(78270 / power(2, 12), 2);
-
-CREATE MATERIALIZED VIEW osm_natural_z11 AS
-SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 11)) AS geom
-FROM osm_natural
-WHERE st_area(st_envelope(geom)) > 10 * power(78270 / power(2, 11), 2);
-
-CREATE MATERIALIZED VIEW osm_natural_z10 AS
-SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 10)) AS geom
-FROM osm_natural
-WHERE st_area(st_envelope(geom)) > 10 * power(78270 / power(2, 10), 2);
-
-CREATE MATERIALIZED VIEW osm_natural_z9 AS
-SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 9)) AS geom
-FROM osm_natural
-WHERE st_area(st_envelope(geom)) > 10 * power(78270 / power(2, 9), 2);
-
-CREATE MATERIALIZED VIEW osm_natural_z8 AS
-SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 8)) AS geom
-FROM osm_natural_xl
-WHERE st_area(st_envelope(geom)) > 10 * power(78270 / power(2, 8), 2);
-
-CREATE MATERIALIZED VIEW osm_natural_z7 AS
-SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 7)) AS geom
-FROM osm_natural_xl
-WHERE st_area(st_envelope(geom)) > 10 * power(78270 / power(2, 7), 2);
-
-CREATE MATERIALIZED VIEW osm_natural_z6 AS
-SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 6)) AS geom
-FROM osm_natural_m
-WHERE st_area(st_envelope(geom)) > 10 * power(78270 / power(2, 6), 2);
-
-CREATE MATERIALIZED VIEW osm_natural_z5 AS
-SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 5)) AS geom
-FROM osm_natural_s
-WHERE st_area(st_envelope(geom)) > 10 * power(78270 / power(2, 5), 2);
-
-CREATE MATERIALIZED VIEW osm_natural_z4 AS
-SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 4)) AS geom
-FROM osm_natural_s
-WHERE st_area(st_envelope(geom)) > 10 * power(78270 / power(2, 4), 2);
-
-CREATE MATERIALIZED VIEW osm_natural_z3 AS
-SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 3)) AS geom
-FROM osm_natural_s
-WHERE st_area(st_envelope(geom)) > 25 * power(78270 / power(2, 3), 2);
-
-CREATE MATERIALIZED VIEW osm_natural_z2 AS
-SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 2)) AS geom
-FROM osm_natural_s
-WHERE st_area(st_envelope(geom)) > 25 * power(78270 / power(2, 2), 2);
-
-CREATE MATERIALIZED VIEW osm_natural_z1 AS
-SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 1)) AS geom
-FROM osm_natural_s
-WHERE st_area(st_envelope(geom)) > 25 * power(78270 / power(2, 1), 2);
diff --git a/basemap/layers/natural/tileset.js b/basemap/layers/natural/tileset.js
index 41c65e7f4..2e335d192 100644
--- a/basemap/layers/natural/tileset.js
+++ b/basemap/layers/natural/tileset.js
@@ -19,23 +19,8 @@ export default {
"queries": [
{
"minzoom": 1,
- "maxzoom": 8,
- "sql": "SELECT id, tags, geom FROM osm_natural_z$zoom WHERE tags ->> 'natural' IN ('wood', 'scrub', 'heath', 'grassland', 'bare_rock', 'scree', 'shingle', 'sand', 'mud', 'water', 'wetland', 'glacier', 'beach')"
- },
- {
- "minzoom": 8,
- "maxzoom": 13,
- "sql": "SELECT id, tags, geom FROM osm_natural_z$zoom WHERE tags ->> 'natural' IN ('wood', 'scrub', 'heath', 'grassland', 'bare_rock', 'scree', 'shingle', 'sand', 'mud', 'water', 'wetland', 'glacier', 'beach')"
- },
- {
- "minzoom": 13,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_ways WHERE tags ? 'natural' AND tags ->> 'natural' NOT IN ('coastline')"
+ "sql": "SELECT id, tags, geom FROM osm_natural_z$zoom"
},
- {
- "minzoom": 13,
- "maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_relations WHERE tags ? 'natural' AND tags ->> 'natural' NOT IN ('coastline')"
- }
]
}
diff --git a/basemap/layers/node/create.sql b/basemap/layers/node/create.sql
new file mode 100644
index 000000000..58f50dc52
--- /dev/null
+++ b/basemap/layers/node/create.sql
@@ -0,0 +1,31 @@
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements. See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to you under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License. You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+DROP
+ TABLE
+ IF EXISTS osm_node CASCADE;
+
+CREATE
+ TABLE
+ IF NOT EXISTS osm_node(
+ id int8 PRIMARY KEY,
+ version INT,
+ uid INT,
+ TIMESTAMP TIMESTAMP WITHOUT TIME ZONE,
+ changeset int8,
+ tags jsonb,
+ lon FLOAT,
+ lat FLOAT,
+ geom geometry(point)
+ );
\ No newline at end of file
diff --git a/basemap/layers/node/refresh.sql b/basemap/layers/node/refresh.sql
new file mode 100644
index 000000000..0c7db66fe
--- /dev/null
+++ b/basemap/layers/node/refresh.sql
@@ -0,0 +1,29 @@
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements. See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to you under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License. You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+DROP
+ INDEX IF EXISTS osm_node_geom_index;
+
+DROP
+ INDEX IF EXISTS osm_node_tags_index;
+
+CREATE
+ INDEX IF NOT EXISTS osm_node_geom_index ON
+ osm_node
+ USING GIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_node_tags_index ON
+ osm_node
+ USING GIN(tags);
diff --git a/basemap/layers/ocean/create.sql b/basemap/layers/ocean/create.sql
new file mode 100644
index 000000000..df7732820
--- /dev/null
+++ b/basemap/layers/ocean/create.sql
@@ -0,0 +1,65 @@
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements. See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to you under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License. You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+DROP
+ TABLE
+ IF EXISTS water_polygons_shp CASCADE;
+
+CREATE
+ TABLE
+ IF NOT EXISTS water_polygons_shp(
+ x BIGINT,
+ y BIGINT,
+ geometry geometry
+ );
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_ocean CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_ocean AS SELECT
+ ROW_NUMBER() OVER() AS id,
+ '{"ocean":"water"}'::jsonb AS tags,
+ st_setsrid(
+ geometry,
+ 3857
+ ) AS geom
+ FROM
+ water_polygons_shp WITH NO DATA;
+
+DROP
+ TABLE
+ IF EXISTS simplified_water_polygons_shp CASCADE;
+
+CREATE
+ TABLE
+ IF NOT EXISTS simplified_water_polygons_shp(
+ x BIGINT,
+ y BIGINT,
+ geometry geometry
+ );
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_ocean_simplified CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_ocean_simplified AS SELECT
+ ROW_NUMBER() OVER() AS id,
+ '{"ocean":"water"}'::jsonb AS tags,
+ st_setsrid(
+ geometry,
+ 3857
+ ) AS geom
+ FROM
+ simplified_water_polygons_shp WITH NO DATA;
diff --git a/basemap/layers/ocean/index.sql b/basemap/layers/ocean/index.sql
deleted file mode 100644
index 8a7cba7ad..000000000
--- a/basemap/layers/ocean/index.sql
+++ /dev/null
@@ -1,17 +0,0 @@
--- Licensed to the Apache Software Foundation (ASF) under one or more
--- contributor license agreements. See the NOTICE file distributed with
--- this work for additional information regarding copyright ownership.
--- The ASF licenses this file to you under the Apache License, Version 2.0
--- (the "License"); you may not use this file except in compliance with
--- the License. You may obtain a copy of the License at
---
--- http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing, software
--- distributed under the License is distributed on an "AS IS" BASIS,
--- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--- See the License for the specific language governing permissions and
--- limitations under the License.
-CREATE INDEX IF NOT EXISTS osm_ocean_geometry_index ON osm_ocean USING gist(geom);
-
-CREATE INDEX IF NOT EXISTS osm_ocean_simplified_geometry_index ON osm_ocean_simplified USING gist(geom);
diff --git a/basemap/layers/ocean/prepare.sql b/basemap/layers/ocean/prepare.sql
deleted file mode 100644
index 77399e228..000000000
--- a/basemap/layers/ocean/prepare.sql
+++ /dev/null
@@ -1,19 +0,0 @@
--- Licensed to the Apache Software Foundation (ASF) under one or more
--- contributor license agreements. See the NOTICE file distributed with
--- this work for additional information regarding copyright ownership.
--- The ASF licenses this file to you under the Apache License, Version 2.0
--- (the "License"); you may not use this file except in compliance with
--- the License. You may obtain a copy of the License at
---
--- http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing, software
--- distributed under the License is distributed on an "AS IS" BASIS,
--- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--- See the License for the specific language governing permissions and
--- limitations under the License.
-CREATE MATERIALIZED VIEW osm_ocean AS
-SELECT row_number() OVER () as id, '{"ocean":"water"}'::jsonb as tags, st_setsrid(geometry, 3857) AS geom FROM water_polygons_shp;
-
-CREATE MATERIALIZED VIEW osm_ocean_simplified AS
-SELECT row_number() OVER () as id, '{"ocean":"water"}'::jsonb as tags, st_setsrid(geometry, 3857) AS geom FROM simplified_water_polygons_shp;
diff --git a/basemap/layers/member/prepare.sql b/basemap/layers/ocean/refresh.sql
similarity index 65%
rename from basemap/layers/member/prepare.sql
rename to basemap/layers/ocean/refresh.sql
index 7d11ddd8e..b1476fd89 100644
--- a/basemap/layers/member/prepare.sql
+++ b/basemap/layers/ocean/refresh.sql
@@ -12,14 +12,22 @@
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-DROP MATERIALIZED VIEW IF EXISTS osm_member CASCADE;
+DROP
+ INDEX IF EXISTS osm_ocean_geometry_index;
-CREATE MATERIALIZED VIEW osm_member AS
-SELECT DISTINCT member_ref as member_ref
-FROM osm_relations, unnest(member_types, member_refs) AS way(member_type, member_ref)
-WHERE geom IS NOT NULL
- AND member_type = 1
- AND tags ->> 'type' = 'multipolygon'
- AND NOT tags ->> 'natural' = 'coastline';
+REFRESH MATERIALIZED VIEW osm_ocean;
-CREATE INDEX osm_member_index ON osm_member(member_ref);
\ No newline at end of file
+CREATE
+ INDEX IF NOT EXISTS osm_ocean_geometry_index ON
+ osm_ocean
+ USING gist(geom);
+
+DROP
+ INDEX IF EXISTS osm_ocean_simplified_geometry_index;
+
+REFRESH MATERIALIZED VIEW osm_ocean_simplified;
+
+CREATE
+ INDEX IF NOT EXISTS osm_ocean_simplified_geometry_index ON
+ osm_ocean_simplified
+ USING gist(geom);
diff --git a/basemap/layers/point/clean.sql b/basemap/layers/point/clean.sql
deleted file mode 100644
index 3203a3e99..000000000
--- a/basemap/layers/point/clean.sql
+++ /dev/null
@@ -1,39 +0,0 @@
--- Licensed to the Apache Software Foundation (ASF) under one or more
--- contributor license agreements. See the NOTICE file distributed with
--- this work for additional information regarding copyright ownership.
--- The ASF licenses this file to you under the Apache License, Version 2.0
--- (the "License"); you may not use this file except in compliance with
--- the License. You may obtain a copy of the License at
---
--- http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing, software
--- distributed under the License is distributed on an "AS IS" BASIS,
--- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--- See the License for the specific language governing permissions and
--- limitations under the License.
-
-DROP INDEX IF EXISTS osm_point_tags_index;
-DROP INDEX IF EXISTS osm_point_geom_index;
-
-DROP VIEW IF EXISTS osm_point_z20 CASCADE;
-DROP VIEW IF EXISTS osm_point_z19 CASCADE;
-DROP VIEW IF EXISTS osm_point_z18 CASCADE;
-DROP VIEW IF EXISTS osm_point_z17 CASCADE;
-DROP VIEW IF EXISTS osm_point_z16 CASCADE;
-DROP VIEW IF EXISTS osm_point_z15 CASCADE;
-DROP VIEW IF EXISTS osm_point_z14 CASCADE;
-
-DROP MATERIALIZED VIEW IF EXISTS osm_point_z13 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_point_z12 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_point_z11 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_point_z10 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_point_z9 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_point_z8 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_point_z7 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_point_z6 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_point_z5 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_point_z4 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_point_z3 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_point_z2 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_point_z1 CASCADE;
\ No newline at end of file
diff --git a/basemap/layers/point/create.sql b/basemap/layers/point/create.sql
new file mode 100644
index 000000000..2463e956e
--- /dev/null
+++ b/basemap/layers/point/create.sql
@@ -0,0 +1,400 @@
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements. See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to you under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License. You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+CREATE
+ OR REPLACE VIEW osm_point AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_node
+ WHERE
+ geom IS NOT NULL
+ AND tags != '{}';
+
+CREATE
+ OR REPLACE VIEW osm_point_z20 AS SELECT
+ *
+ FROM
+ osm_point;
+
+CREATE
+ OR REPLACE VIEW osm_point_z19 AS SELECT
+ *
+ FROM
+ osm_point;
+
+CREATE
+ OR REPLACE VIEW osm_point_z18 AS SELECT
+ *
+ FROM
+ osm_point;
+
+CREATE
+ OR REPLACE VIEW osm_point_z17 AS SELECT
+ *
+ FROM
+ osm_point;
+
+CREATE
+ OR REPLACE VIEW osm_point_z16 AS SELECT
+ *
+ FROM
+ osm_point;
+
+CREATE
+ OR REPLACE VIEW osm_point_z15 AS SELECT
+ *
+ FROM
+ osm_point;
+
+CREATE
+ OR REPLACE VIEW osm_point_z14 AS SELECT
+ *
+ FROM
+ osm_point;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_point_z13;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_point_z13 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_point
+ WHERE
+ (
+ tags ->> 'place'
+ )= ANY(
+ ARRAY [ 'region',
+ 'province',
+ 'district',
+ 'county',
+ 'municipality',
+ 'city',
+ 'town',
+ 'village',
+ 'quarter',
+ 'hamlet' ]
+ )
+ OR(
+ tags ->> 'natural'
+ )= ANY(
+ ARRAY [ 'peak',
+ 'volcano',
+ 'spring' ]
+ )
+ OR(
+ tags ->> 'highway'
+ )= 'motorway_junction'
+ OR(
+ tags ->> 'tourism'
+ )= 'wilderness_hut'
+ OR(
+ tags ->> 'waterway'
+ )= 'waterfall'
+ OR(
+ tags ->> 'railway'
+ )= 'level_crossing' WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_point_z12;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_point_z12 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_point
+ WHERE
+ (
+ tags ->> 'place'
+ )= ANY(
+ ARRAY [ 'region',
+ 'province',
+ 'district',
+ 'county',
+ 'municipality',
+ 'city',
+ 'town',
+ 'village' ]
+ )
+ OR(
+ tags ->> 'natural'
+ )= ANY(
+ ARRAY [ 'peak',
+ 'volcano' ]
+ )
+ OR(
+ tags ->> 'highway'
+ )= 'motorway_junction'
+ OR(
+ tags ->> 'tourism'
+ )= 'wilderness_hut'
+ OR(
+ tags ->> 'waterway'
+ )= 'waterfall' WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_point_z11;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_point_z11 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_point
+ WHERE
+ (
+ tags ->> 'place'
+ )= ANY(
+ ARRAY [ 'country',
+ 'state',
+ 'region',
+ 'province',
+ 'district',
+ 'county',
+ 'municipality',
+ 'city',
+ 'town',
+ 'village' ]
+ )
+ OR(
+ tags ->> 'natural'
+ )= ANY(
+ ARRAY [ 'peak',
+ 'volcano' ]
+ )
+ OR(
+ tags ->> 'highway'
+ )= 'motorway_junction' WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_point_z10;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_point_z10 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_point
+ WHERE
+ (
+ tags ->> 'place'
+ )= ANY(
+ ARRAY [ 'country',
+ 'state',
+ 'region',
+ 'province',
+ 'district',
+ 'county',
+ 'municipality',
+ 'city',
+ 'town' ]
+ )
+ OR(
+ tags ->> 'natural'
+ )= ANY(
+ ARRAY [ 'peak',
+ 'volcano' ]
+ )
+ OR(
+ tags ->> 'highway'
+ )= 'motorway_junction' WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_point_z9;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_point_z9 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_point
+ WHERE
+ (
+ tags ->> 'place'
+ )= ANY(
+ ARRAY [ 'country',
+ 'state',
+ 'region',
+ 'province',
+ 'district',
+ 'county',
+ 'municipality',
+ 'city',
+ 'town' ]
+ ) WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_point_z8;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_point_z8 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_point
+ WHERE
+ (
+ tags ->> 'place'
+ )= ANY(
+ ARRAY [ 'country',
+ 'state',
+ 'region',
+ 'province',
+ 'district',
+ 'county',
+ 'municipality',
+ 'city',
+ 'town' ]
+ ) WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_point_z7;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_point_z7 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_point
+ WHERE
+ (
+ tags ->> 'place'
+ )= ANY(
+ ARRAY [ 'country',
+ 'city',
+ 'sea',
+ 'state',
+ 'county' ]
+ ) WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_point_z6;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_point_z6 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_point
+ WHERE
+ (
+ tags ->> 'place'
+ )= ANY(
+ ARRAY [ 'country',
+ 'city',
+ 'sea',
+ 'state',
+ 'county' ]
+ ) WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_point_z5;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_point_z5 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_point
+ WHERE
+ (
+ tags ->> 'place'
+ )= ANY(
+ ARRAY [ 'country',
+ 'city',
+ 'sea',
+ 'state',
+ 'county' ]
+ ) WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_point_z4;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_point_z4 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_point
+ WHERE
+ (
+ tags ->> 'place'
+ )= ANY(
+ ARRAY [ 'country',
+ 'city',
+ 'sea' ]
+ ) WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_point_z3;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_point_z3 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_point
+ WHERE
+ (
+ tags ->> 'place'
+ )= ANY(
+ ARRAY [ 'country',
+ 'city',
+ 'sea' ]
+ ) WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_point_z2;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_point_z2 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_point
+ WHERE
+ (
+ tags ->> 'place'
+ )= 'country' WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_point_z1;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_point_z1 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_point
+ WHERE
+ (
+ tags ->> 'place'
+ )= 'country' WITH NO DATA;
diff --git a/basemap/layers/point/index.sql b/basemap/layers/point/index.sql
deleted file mode 100644
index 1c9c24e86..000000000
--- a/basemap/layers/point/index.sql
+++ /dev/null
@@ -1,28 +0,0 @@
--- Licensed to the Apache Software Foundation (ASF) under one or more
--- contributor license agreements. See the NOTICE file distributed with
--- this work for additional information regarding copyright ownership.
--- The ASF licenses this file to you under the Apache License, Version 2.0
--- (the "License"); you may not use this file except in compliance with
--- the License. You may obtain a copy of the License at
---
--- http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing, software
--- distributed under the License is distributed on an "AS IS" BASIS,
--- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--- See the License for the specific language governing permissions and
--- limitations under the License.
-
-CREATE INDEX IF NOT EXISTS osm_point_geom_z13_index ON osm_point_z13 USING gist (geom);
-CREATE INDEX IF NOT EXISTS osm_point_geom_z12_index ON osm_point_z12 USING gist (geom);
-CREATE INDEX IF NOT EXISTS osm_point_geom_z11_index ON osm_point_z11 USING gist (geom);
-CREATE INDEX IF NOT EXISTS osm_point_geom_z10_index ON osm_point_z10 USING gist (geom);
-CREATE INDEX IF NOT EXISTS osm_point_geom_z9_index ON osm_point_z9 USING gist (geom);
-CREATE INDEX IF NOT EXISTS osm_point_geom_z8_index ON osm_point_z8 USING gist (geom);
-CREATE INDEX IF NOT EXISTS osm_point_geom_z7_index ON osm_point_z7 USING gist (geom);
-CREATE INDEX IF NOT EXISTS osm_point_geom_z6_index ON osm_point_z6 USING gist (geom);
-CREATE INDEX IF NOT EXISTS osm_point_geom_z5_index ON osm_point_z5 USING gist (geom);
-CREATE INDEX IF NOT EXISTS osm_point_geom_z4_index ON osm_point_z4 USING gist (geom);
-CREATE INDEX IF NOT EXISTS osm_point_geom_z3_index ON osm_point_z3 USING gist (geom);
-CREATE INDEX IF NOT EXISTS osm_point_geom_z2_index ON osm_point_z2 USING gist (geom);
-CREATE INDEX IF NOT EXISTS osm_point_geom_z1_index ON osm_point_z1 USING gist (geom);
\ No newline at end of file
diff --git a/basemap/layers/point/refresh.sql b/basemap/layers/point/refresh.sql
index 981821ba8..6058abd73 100644
--- a/basemap/layers/point/refresh.sql
+++ b/basemap/layers/point/refresh.sql
@@ -12,17 +12,132 @@
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
+DROP
+ INDEX IF EXISTS osm_point_geom_z13_index;
+
+DROP
+ INDEX IF EXISTS osm_point_geom_z12_index;
+
+DROP
+ INDEX IF EXISTS osm_point_geom_z11_index;
+
+DROP
+ INDEX IF EXISTS osm_point_geom_z10_index;
+
+DROP
+ INDEX IF EXISTS osm_point_geom_z9_index;
+
+DROP
+ INDEX IF EXISTS osm_point_geom_z8_index;
+
+DROP
+ INDEX IF EXISTS osm_point_geom_z7_index;
+
+DROP
+ INDEX IF EXISTS osm_point_geom_z6_index;
+
+DROP
+ INDEX IF EXISTS osm_point_geom_z5_index;
+
+DROP
+ INDEX IF EXISTS osm_point_geom_z4_index;
+
+DROP
+ INDEX IF EXISTS osm_point_geom_z3_index;
+
+DROP
+ INDEX IF EXISTS osm_point_geom_z2_index;
+
+DROP
+ INDEX IF EXISTS osm_point_geom_z1_index;
REFRESH MATERIALIZED VIEW osm_point_z13;
+
REFRESH MATERIALIZED VIEW osm_point_z12;
+
REFRESH MATERIALIZED VIEW osm_point_z11;
+
REFRESH MATERIALIZED VIEW osm_point_z10;
+
REFRESH MATERIALIZED VIEW osm_point_z9;
+
REFRESH MATERIALIZED VIEW osm_point_z8;
+
REFRESH MATERIALIZED VIEW osm_point_z7;
+
REFRESH MATERIALIZED VIEW osm_point_z6;
+
REFRESH MATERIALIZED VIEW osm_point_z5;
+
REFRESH MATERIALIZED VIEW osm_point_z4;
+
REFRESH MATERIALIZED VIEW osm_point_z3;
+
REFRESH MATERIALIZED VIEW osm_point_z2;
-REFRESH MATERIALIZED VIEW osm_point_z1;
\ No newline at end of file
+
+REFRESH MATERIALIZED VIEW osm_point_z1;
+
+CREATE
+ INDEX IF NOT EXISTS osm_point_geom_z13_index ON
+ osm_point_z13
+ USING gist(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_point_geom_z12_index ON
+ osm_point_z12
+ USING gist(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_point_geom_z11_index ON
+ osm_point_z11
+ USING gist(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_point_geom_z10_index ON
+ osm_point_z10
+ USING gist(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_point_geom_z9_index ON
+ osm_point_z9
+ USING gist(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_point_geom_z8_index ON
+ osm_point_z8
+ USING gist(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_point_geom_z7_index ON
+ osm_point_z7
+ USING gist(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_point_geom_z6_index ON
+ osm_point_z6
+ USING gist(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_point_geom_z5_index ON
+ osm_point_z5
+ USING gist(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_point_geom_z4_index ON
+ osm_point_z4
+ USING gist(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_point_geom_z3_index ON
+ osm_point_z3
+ USING gist(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_point_geom_z2_index ON
+ osm_point_z2
+ USING gist(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_point_geom_z1_index ON
+ osm_point_z1
+ USING gist(geom);
\ No newline at end of file
diff --git a/basemap/layers/point/simplify.sql b/basemap/layers/point/simplify.sql
deleted file mode 100644
index 879bec222..000000000
--- a/basemap/layers/point/simplify.sql
+++ /dev/null
@@ -1,115 +0,0 @@
--- Licensed to the Apache Software Foundation (ASF) under one or more
--- contributor license agreements. See the NOTICE file distributed with
--- this work for additional information regarding copyright ownership.
--- The ASF licenses this file to you under the Apache License, Version 2.0
--- (the "License"); you may not use this file except in compliance with
--- the License. You may obtain a copy of the License at
---
--- http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing, software
--- distributed under the License is distributed on an "AS IS" BASIS,
--- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--- See the License for the specific language governing permissions and
--- limitations under the License.
-
-CREATE VIEW osm_point_z20 AS
-SELECT id, tags, geom
-FROM osm_nodes
-WHERE tags != '{}';
-
-CREATE VIEW osm_point_z19 AS
-SELECT id, tags, geom
-FROM osm_nodes
-WHERE tags != '{}';
-
-CREATE VIEW osm_point_z18 AS
-SELECT id, tags, geom
-FROM osm_nodes
-WHERE tags != '{}';
-
-CREATE VIEW osm_point_z17 AS
-SELECT id, tags, geom
-FROM osm_nodes
-WHERE tags != '{}';
-
-CREATE VIEW osm_point_z16 AS
-SELECT id, tags, geom
-FROM osm_nodes
-WHERE tags != '{}';
-
-CREATE VIEW osm_point_z15 AS
-SELECT id, tags, geom
-FROM osm_nodes
-WHERE tags != '{}';
-
-CREATE VIEW osm_point_z14 AS
-SELECT id, tags, geom
-FROM osm_nodes
-WHERE tags != '{}';
-
-CREATE MATERIALIZED VIEW osm_point_z13 AS
-SELECT id, tags, geom
-FROM osm_nodes
-WHERE tags != '{}'
-AND (tags ->> 'place' IN ('region', 'province', 'district', 'county', 'municipality', 'city', 'town', 'village', 'quarter', 'hamlet')) OR (tags ->> 'natural' IN ('peak', 'volcano')) OR (tags ->> 'highway' IN ('motorway_junction')) OR (tags ->> 'tourism' IN ('wilderness_hut')) OR (tags ->> 'waterway' IN ('waterfall')) OR (tags ->> 'natural' IN ('spring')) OR (tags ->> 'railway' IN ('level_crossing'));
-
-CREATE MATERIALIZED VIEW osm_point_z12 AS
-SELECT id, tags, geom
-FROM osm_nodes
-WHERE tags != '{}' AND (tags ->> 'place' IN ('region', 'province', 'district', 'county', 'municipality', 'city', 'town', 'village')) OR (tags ->> 'natural' IN ('peak', 'volcano')) OR (tags ->> 'highway' IN ('motorway_junction')) OR (tags ->> 'tourism' IN ('wilderness_hut')) OR (tags ->> 'waterway' IN ('waterfall'));
-
-CREATE MATERIALIZED VIEW osm_point_z11 AS
-SELECT id, tags, geom
-FROM osm_nodes
-WHERE tags != '{}' AND (tags ->> 'place' IN ('country', 'state', 'region', 'province', 'district', 'county', 'municipality', 'city', 'town', 'village')) OR (tags ->> 'natural' IN ('peak', 'volcano')) OR (tags ->> 'highway' IN ('motorway_junction'));
-
-CREATE MATERIALIZED VIEW osm_point_z10 AS
-SELECT id, tags, geom
-FROM osm_nodes
-WHERE tags != '{}' AND (tags ->> 'place' IN ('country', 'state', 'region', 'province', 'district', 'county', 'municipality', 'city', 'town')) OR (tags ->> 'natural' IN ('peak', 'volcano')) OR (tags ->> 'highway' IN ('motorway_junction'));
-
-CREATE MATERIALIZED VIEW osm_point_z9 AS
-SELECT id, tags, geom
-FROM osm_nodes
-WHERE tags != '{}' AND tags ->> 'place' IN ('country', 'state', 'region', 'province', 'district', 'county', 'municipality', 'city', 'town');
-
-CREATE MATERIALIZED VIEW osm_point_z8 AS
-SELECT id, tags, geom
-FROM osm_nodes
-WHERE tags != '{}' AND tags ->> 'place' IN ('country', 'state', 'region', 'province', 'district', 'county', 'municipality', 'city', 'town');
-
-CREATE MATERIALIZED VIEW osm_point_z7 AS
-SELECT id, tags, geom
-FROM osm_nodes
-WHERE tags != '{}' AND tags ->> 'place' IN ('country', 'city', 'sea', 'state', 'county');
-
-CREATE MATERIALIZED VIEW osm_point_z6 AS
-SELECT id, tags, geom
-FROM osm_nodes
-WHERE tags != '{}' AND tags ->> 'place' IN ('country', 'city', 'sea', 'state', 'county');
-
-CREATE MATERIALIZED VIEW osm_point_z5 AS
-SELECT id, tags, geom
-FROM osm_nodes
-WHERE tags != '{}' AND tags ->> 'place' IN ('country', 'city', 'sea', 'state', 'county');
-
-CREATE MATERIALIZED VIEW osm_point_z4 AS
-SELECT id, tags, geom
-FROM osm_nodes
-WHERE tags != '{}' AND tags ->> 'place' IN ('country', 'city', 'sea');
-
-CREATE MATERIALIZED VIEW osm_point_z3 AS
-SELECT id, tags, geom
-FROM osm_nodes
-WHERE tags != '{}' AND tags ->> 'place' IN ('country', 'city', 'sea');
-
-CREATE MATERIALIZED VIEW osm_point_z2 AS
-SELECT id, tags, geom
-FROM osm_nodes
-WHERE tags != '{}' AND tags ->> 'place' IN ('country');
-
-CREATE MATERIALIZED VIEW osm_point_z1 AS
-SELECT id, tags, geom
-FROM osm_nodes
-WHERE tags != '{}' AND tags ->> 'place' IN ('country');
\ No newline at end of file
diff --git a/basemap/layers/polygon/create.sql b/basemap/layers/polygon/create.sql
new file mode 100644
index 000000000..b637b3723
--- /dev/null
+++ b/basemap/layers/polygon/create.sql
@@ -0,0 +1,50 @@
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements. See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to you under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License. You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+CREATE
+ OR REPLACE VIEW osm_polygon AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_way
+ LEFT JOIN osm_member ON
+ id = member_ref
+ WHERE
+ geom IS NOT NULL
+ AND ST_GeometryType(osm_way.geom)= 'ST_Polygon'
+ AND tags != '{}'
+ AND member_ref IS NULL
+UNION SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_relation
+ WHERE
+ geom IS NOT NULL
+ AND ST_GeometryType(osm_relation.geom)= 'ST_Polygon'
+ AND tags != '{}'
+UNION SELECT
+ id,
+ tags,
+ (
+ st_dump(geom)
+ ).geom AS geom
+ FROM
+ osm_relation
+ WHERE
+ geom IS NOT NULL
+ AND ST_GeometryType(osm_relation.geom)= 'ST_MultiPolygon'
+ AND tags != '{}';
\ No newline at end of file
diff --git a/basemap/layers/polygon/index.sql b/basemap/layers/polygon/index.sql
deleted file mode 100644
index 4d0ede344..000000000
--- a/basemap/layers/polygon/index.sql
+++ /dev/null
@@ -1,16 +0,0 @@
--- Licensed to the Apache Software Foundation (ASF) under one or more
--- contributor license agreements. See the NOTICE file distributed with
--- this work for additional information regarding copyright ownership.
--- The ASF licenses this file to you under the Apache License, Version 2.0
--- (the "License"); you may not use this file except in compliance with
--- the License. You may obtain a copy of the License at
---
--- http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing, software
--- distributed under the License is distributed on an "AS IS" BASIS,
--- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--- See the License for the specific language governing permissions and
--- limitations under the License.
-CREATE INDEX osm_polygon_geom_idx ON osm_polygon USING GIST (geom);
-CREATE INDEX osm_polygon_tags_idx ON osm_polygon USING GIN (tags);
\ No newline at end of file
diff --git a/basemap/layers/polygon/prepare.sql b/basemap/layers/polygon/prepare.sql
deleted file mode 100644
index 301e628e4..000000000
--- a/basemap/layers/polygon/prepare.sql
+++ /dev/null
@@ -1,31 +0,0 @@
--- Licensed to the Apache Software Foundation (ASF) under one or more
--- contributor license agreements. See the NOTICE file distributed with
--- this work for additional information regarding copyright ownership.
--- The ASF licenses this file to you under the Apache License, Version 2.0
--- (the "License"); you may not use this file except in compliance with
--- the License. You may obtain a copy of the License at
---
--- http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing, software
--- distributed under the License is distributed on an "AS IS" BASIS,
--- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--- See the License for the specific language governing permissions and
--- limitations under the License.
-
-CREATE MATERIALIZED VIEW osm_polygon AS
-SELECT id, tags, geom
-FROM osm_ways LEFT JOIN osm_member ON id = member_ref
-WHERE ST_GeometryType(osm_ways.geom) = 'ST_Polygon'
- AND tags != '{}'
- AND member_ref IS NULL
-UNION
-SELECT id, tags, geom
-FROM osm_relations
-WHERE ST_GeometryType(osm_relations.geom) = 'ST_Polygon'
- AND tags != '{}'
-UNION
-SELECT id, tags, (st_dump(geom)).geom as geom
-FROM osm_relations
-WHERE ST_GeometryType(osm_relations.geom) = 'ST_MultiPolygon'
- AND tags != '{}';
\ No newline at end of file
diff --git a/basemap/layers/power/create.sql b/basemap/layers/power/create.sql
new file mode 100644
index 000000000..6d5cabd3e
--- /dev/null
+++ b/basemap/layers/power/create.sql
@@ -0,0 +1,30 @@
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements. See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to you under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License. You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+CREATE
+ OR REPLACE VIEW osm_power AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_way
+ WHERE
+ geom IS NOT NULL
+ AND tags ->> 'power' IN(
+ 'cable',
+ 'line',
+ 'minor_line',
+ 'plant',
+ 'substation'
+ );
\ No newline at end of file
diff --git a/basemap/layers/power/tileset.js b/basemap/layers/power/tileset.js
index e651209db..e2cf1746f 100644
--- a/basemap/layers/power/tileset.js
+++ b/basemap/layers/power/tileset.js
@@ -20,7 +20,7 @@ export default {
{
"minzoom": 13,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_ways WHERE tags ->> 'power' IN ('cable', 'line', 'minor_line', 'plant', 'substation')"
+ "sql": "SELECT id, tags, geom FROM osm_power"
}
]
}
diff --git a/basemap/layers/railway/clean.sql b/basemap/layers/railway/clean.sql
deleted file mode 100644
index 28bb55fbf..000000000
--- a/basemap/layers/railway/clean.sql
+++ /dev/null
@@ -1,38 +0,0 @@
--- Licensed to the Apache Software Foundation (ASF) under one or more
--- contributor license agreements. See the NOTICE file distributed with
--- this work for additional information regarding copyright ownership.
--- The ASF licenses this file to you under the Apache License, Version 2.0
--- (the "License"); you may not use this file except in compliance with
--- the License. You may obtain a copy of the License at
---
--- http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing, software
--- distributed under the License is distributed on an "AS IS" BASIS,
--- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--- See the License for the specific language governing permissions and
--- limitations under the License.
-
-DROP MATERIALIZED VIEW IF EXISTS osm_railway CASCADE;
-
-DROP VIEW IF EXISTS osm_railway_z20 CASCADE;
-DROP VIEW IF EXISTS osm_railway_z19 CASCADE;
-DROP VIEW IF EXISTS osm_railway_z18 CASCADE;
-DROP VIEW IF EXISTS osm_railway_z17 CASCADE;
-DROP VIEW IF EXISTS osm_railway_z16 CASCADE;
-DROP VIEW IF EXISTS osm_railway_z15 CASCADE;
-DROP VIEW IF EXISTS osm_railway_z14 CASCADE;
-DROP VIEW IF EXISTS osm_railway_z13 CASCADE;
-
-DROP MATERIALIZED VIEW IF EXISTS osm_railway_z12 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_railway_z11 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_railway_z10 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_railway_z9 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_railway_z8 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_railway_z7 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_railway_z6 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_railway_z5 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_railway_z4 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_railway_z3 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_railway_z2 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_railway_z1 CASCADE;
diff --git a/basemap/layers/railway/create.sql b/basemap/layers/railway/create.sql
new file mode 100644
index 000000000..ae6e65435
--- /dev/null
+++ b/basemap/layers/railway/create.sql
@@ -0,0 +1,409 @@
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements. See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to you under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License. You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+CREATE
+ OR REPLACE VIEW osm_railway AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_way
+ WHERE
+ tags ? 'railway';
+
+CREATE
+ OR REPLACE VIEW osm_railway_z20 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_railway;
+
+CREATE
+ OR REPLACE VIEW osm_railway_z19 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_railway;
+
+CREATE
+ OR REPLACE VIEW osm_railway_z18 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_railway;
+
+CREATE
+ OR REPLACE VIEW osm_railway_z17 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_railway;
+
+CREATE
+ OR REPLACE VIEW osm_railway_z16 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_railway;
+
+CREATE
+ OR REPLACE VIEW osm_railway_z15 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_railway;
+
+CREATE
+ OR REPLACE VIEW osm_railway_z14 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_railway;
+
+CREATE
+ OR REPLACE VIEW osm_railway_z13 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_railway;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_railway_filtered CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_railway_filtered AS SELECT
+ tags -> 'railway' AS railway,
+ geom AS geom
+ FROM
+ osm_railway
+ WHERE
+ tags ->> 'railway' IN(
+ 'light_rail',
+ 'monorail',
+ 'rail',
+ 'subway',
+ 'tram'
+ )
+ AND NOT tags ? 'service' WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_railway_clustered CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_railway_clustered AS SELECT
+ railway AS railway,
+ geom AS geom,
+ ST_ClusterDBSCAN(
+ geom,
+ 0,
+ 1
+ ) OVER(
+ PARTITION BY railway
+ ) AS cluster
+ FROM
+ osm_railway_filtered WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_railway_simplified CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_railway_simplified AS WITH merged AS(
+ SELECT
+ railway AS railway,
+ ST_LineMerge(
+ ST_Collect(geom)
+ ) AS geom
+ FROM
+ osm_railway_clustered
+ GROUP BY
+ railway,
+ cluster
+ ),
+ exploded AS(
+ SELECT
+ railway AS railway,
+ (
+ ST_Dump(geom)
+ ).geom AS geom
+ FROM
+ merged
+ ) SELECT
+ ROW_NUMBER() OVER() AS id,
+ jsonb_build_object(
+ 'railway',
+ railway
+ ) AS tags,
+ geom AS geom
+ FROM
+ exploded WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_railway_z12 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_railway_z12 AS SELECT
+ id,
+ tags,
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 12 )
+ ) AS geom
+ FROM
+ osm_railway_simplified
+ WHERE
+ geom IS NOT NULL
+ AND(
+ st_area(
+ st_envelope(geom)
+ )> POWER(( 78270 / POWER( 2, 12 )), 2 )
+ ) WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_railway_z11 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_railway_z11 AS SELECT
+ id,
+ tags,
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 11 )
+ ) AS geom
+ FROM
+ osm_railway_simplified
+ WHERE
+ geom IS NOT NULL
+ AND(
+ st_area(
+ st_envelope(geom)
+ )> POWER(( 78270 / POWER( 2, 11 )), 2 )
+ ) WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_railway_z10 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_railway_z10 AS SELECT
+ id,
+ tags,
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 10 )
+ ) AS geom
+ FROM
+ osm_railway_simplified
+ WHERE
+ geom IS NOT NULL
+ AND(
+ st_area(
+ st_envelope(geom)
+ )> POWER(( 78270 / POWER( 2, 10 )), 2 )
+ ) WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_railway_z9 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_railway_z9 AS SELECT
+ id,
+ tags,
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 9 )
+ ) AS geom
+ FROM
+ osm_railway_simplified
+ WHERE
+ geom IS NOT NULL
+ AND(
+ st_area(
+ st_envelope(geom)
+ )> POWER(( 78270 / POWER( 2, 9 )), 2 )
+ ) WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_railway_z8 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_railway_z8 AS SELECT
+ id,
+ tags,
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 8 )
+ ) AS geom
+ FROM
+ osm_railway_simplified
+ WHERE
+ geom IS NOT NULL
+ AND(
+ st_area(
+ st_envelope(geom)
+ )> POWER(( 78270 / POWER( 2, 8 )), 2 )
+ ) WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_railway_z7 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_railway_z7 AS SELECT
+ id,
+ tags,
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 7 )
+ ) AS geom
+ FROM
+ osm_railway_simplified
+ WHERE
+ geom IS NOT NULL
+ AND(
+ st_area(
+ st_envelope(geom)
+ )> POWER(( 78270 / POWER( 2, 7 )), 2 )
+ ) WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_railway_z6 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_railway_z6 AS SELECT
+ id,
+ tags,
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 6 )
+ ) AS geom
+ FROM
+ osm_railway_simplified
+ WHERE
+ geom IS NOT NULL
+ AND(
+ st_area(
+ st_envelope(geom)
+ )> POWER(( 78270 / POWER( 2, 6 )), 2 )
+ ) WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_railway_z5 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_railway_z5 AS SELECT
+ id,
+ tags,
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 5 )
+ ) AS geom
+ FROM
+ osm_railway_simplified
+ WHERE
+ geom IS NOT NULL
+ AND(
+ st_area(
+ st_envelope(geom)
+ )> POWER(( 78270 / POWER( 2, 5 )), 2 )
+ ) WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_railway_z4 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_railway_z4 AS SELECT
+ id,
+ tags,
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 4 )
+ ) AS geom
+ FROM
+ osm_railway_simplified
+ WHERE
+ geom IS NOT NULL
+ AND(
+ st_area(
+ st_envelope(geom)
+ )> POWER(( 78270 / POWER( 2, 4 )), 2 )
+ ) WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_railway_z3 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_railway_z3 AS SELECT
+ id,
+ tags,
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 3 )
+ ) AS geom
+ FROM
+ osm_railway_simplified
+ WHERE
+ geom IS NOT NULL
+ AND(
+ st_area(
+ st_envelope(geom)
+ )> POWER(( 78270 / POWER( 2, 3 )), 2 )
+ ) WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_railway_z2 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_railway_z2 AS SELECT
+ id,
+ tags,
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 2 )
+ ) AS geom
+ FROM
+ osm_railway_simplified
+ WHERE
+ geom IS NOT NULL
+ AND(
+ st_area(
+ st_envelope(geom)
+ )> POWER(( 78270 / POWER( 2, 2 )), 2 )
+ ) WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_railway_z1 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_railway_z1 AS SELECT
+ id,
+ tags,
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 1 )
+ ) AS geom
+ FROM
+ osm_railway_simplified
+ WHERE
+ geom IS NOT NULL
+ AND(
+ st_area(
+ st_envelope(geom)
+ )> POWER(( 78270 / POWER( 2, 1 )), 2 )
+ ) WITH NO DATA;
diff --git a/basemap/layers/railway/index.sql b/basemap/layers/railway/index.sql
deleted file mode 100644
index df2d0d5bf..000000000
--- a/basemap/layers/railway/index.sql
+++ /dev/null
@@ -1,27 +0,0 @@
--- Licensed to the Apache Software Foundation (ASF) under one or more
--- contributor license agreements. See the NOTICE file distributed with
--- this work for additional information regarding copyright ownership.
--- The ASF licenses this file to you under the Apache License, Version 2.0
--- (the "License"); you may not use this file except in compliance with
--- the License. You may obtain a copy of the License at
---
--- http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing, software
--- distributed under the License is distributed on an "AS IS" BASIS,
--- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--- See the License for the specific language governing permissions and
--- limitations under the License.
-
-CREATE INDEX IF NOT EXISTS osm_railway_geom_z12_index ON osm_railway_z12 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_railway_geom_z11_index ON osm_railway_z11 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_railway_geom_z10_index ON osm_railway_z10 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_railway_geom_z9_index ON osm_railway_z9 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_railway_geom_z8_index ON osm_railway_z8 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_railway_geom_z7_index ON osm_railway_z7 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_railway_geom_z6_index ON osm_railway_z6 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_railway_geom_z5_index ON osm_railway_z5 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_railway_geom_z4_index ON osm_railway_z4 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_railway_geom_z3_index ON osm_railway_z3 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_railway_geom_z2_index ON osm_railway_z2 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_railway_geom_z1_index ON osm_railway_z1 USING SPGIST (geom);
diff --git a/basemap/layers/railway/line.js b/basemap/layers/railway/line.js
index fb91bb351..2ab1afc91 100644
--- a/basemap/layers/railway/line.js
+++ b/basemap/layers/railway/line.js
@@ -38,10 +38,7 @@ export let directives = [
},
{
- 'filter': ['all',
- ['==', ['get', 'railway'], 'turntable'],
- ['has', 'service']
- ],
+ 'filter': ['==', ['get', 'railway'], 'turntable'],
'line-color': theme.railwayAllRailsLineColor,
'line-width-stops': theme.railwayServiceLineWidth,
},
diff --git a/basemap/layers/railway/prepare.sql b/basemap/layers/railway/prepare.sql
deleted file mode 100644
index e9f9c029b..000000000
--- a/basemap/layers/railway/prepare.sql
+++ /dev/null
@@ -1,26 +0,0 @@
--- Licensed to the Apache Software Foundation (ASF) under one or more
--- contributor license agreements. See the NOTICE file distributed with
--- this work for additional information regarding copyright ownership.
--- The ASF licenses this file to you under the Apache License, Version 2.0
--- (the "License"); you may not use this file except in compliance with
--- the License. You may obtain a copy of the License at
---
--- http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing, software
--- distributed under the License is distributed on an "AS IS" BASIS,
--- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--- See the License for the specific language governing permissions and
--- limitations under the License.
-
-CREATE MATERIALIZED VIEW osm_railway AS
-SELECT id, tags, geom
-FROM (
- SELECT
- min(id) as id,
- jsonb_build_object('railway', tags -> 'railway', 'service', tags -> 'service') as tags,
- (st_dump(st_linemerge(st_collect(geom)))).geom as geom
- FROM osm_ways
- WHERE tags ->> 'railway' IN ('light_rail', 'monorail', 'rail', 'subway', 'tram')
- GROUP BY tags -> 'railway', tags -> 'service'
-) AS mergedDirective;
diff --git a/basemap/layers/railway/refresh.sql b/basemap/layers/railway/refresh.sql
index 81f52c134..f485acae1 100644
--- a/basemap/layers/railway/refresh.sql
+++ b/basemap/layers/railway/refresh.sql
@@ -12,18 +12,152 @@
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
+DROP
+ INDEX IF EXISTS osm_railway_filtered_geom;
-REFRESH MATERIALIZED VIEW osm_railway;
+REFRESH MATERIALIZED VIEW osm_railway_filtered;
+
+CREATE
+ INDEX IF NOT EXISTS osm_railway_filtered_geom ON
+ osm_railway_filtered
+ USING GIST(geom);
+
+DROP
+ INDEX IF EXISTS osm_railway_clustered_geom;
+
+REFRESH MATERIALIZED VIEW osm_railway_clustered;
+
+CREATE
+ INDEX IF NOT EXISTS osm_railway_clustered_geom ON
+ osm_railway_clustered
+ USING GIST(geom);
+
+DROP
+ INDEX IF EXISTS osm_railway_simplified_geom;
+
+REFRESH MATERIALIZED VIEW osm_railway_simplified;
+
+CREATE
+ INDEX IF NOT EXISTS osm_railway_simplified_geom ON
+ osm_railway_simplified
+ USING GIST(geom);
+
+DROP
+ INDEX IF EXISTS osm_railway_z12_geom_idx;
REFRESH MATERIALIZED VIEW osm_railway_z12;
+
+CREATE
+ INDEX IF NOT EXISTS osm_railway_z12_geom_idx ON
+ osm_railway_z12
+ USING GIST(geom);
+
+DROP
+ INDEX IF EXISTS osm_railway_z11_geom_idx;
+
REFRESH MATERIALIZED VIEW osm_railway_z11;
+
+CREATE
+ INDEX IF NOT EXISTS osm_railway_z11_geom_idx ON
+ osm_railway_z11
+ USING GIST(geom);
+
+DROP
+ INDEX IF EXISTS osm_railway_z10_geom_idx;
+
REFRESH MATERIALIZED VIEW osm_railway_z10;
+
+CREATE
+ INDEX IF NOT EXISTS osm_railway_z10_geom_idx ON
+ osm_railway_z10
+ USING GIST(geom);
+
+DROP
+ INDEX IF EXISTS osm_railway_z9_geom_idx;
+
REFRESH MATERIALIZED VIEW osm_railway_z9;
+
+CREATE
+ INDEX IF NOT EXISTS osm_railway_z9_geom_idx ON
+ osm_railway_z9
+ USING GIST(geom);
+
+DROP
+ INDEX IF EXISTS osm_railway_z8_geom_idx;
+
REFRESH MATERIALIZED VIEW osm_railway_z8;
+
+CREATE
+ INDEX IF NOT EXISTS osm_railway_z8_geom_idx ON
+ osm_railway_z8
+ USING GIST(geom);
+
+DROP
+ INDEX IF EXISTS osm_railway_z7_geom_idx;
+
REFRESH MATERIALIZED VIEW osm_railway_z7;
+
+CREATE
+ INDEX IF NOT EXISTS osm_railway_z7_geom_idx ON
+ osm_railway_z7
+ USING GIST(geom);
+
+DROP
+ INDEX IF EXISTS osm_railway_z6_geom_idx;
+
REFRESH MATERIALIZED VIEW osm_railway_z6;
+
+CREATE
+ INDEX IF NOT EXISTS osm_railway_z6_geom_idx ON
+ osm_railway_z6
+ USING GIST(geom);
+
+DROP
+ INDEX IF EXISTS osm_railway_z5_geom_idx;
+
REFRESH MATERIALIZED VIEW osm_railway_z5;
+
+CREATE
+ INDEX IF NOT EXISTS osm_railway_z5_geom_idx ON
+ osm_railway_z5
+ USING GIST(geom);
+
+DROP
+ INDEX IF EXISTS osm_railway_z4_geom_idx;
+
REFRESH MATERIALIZED VIEW osm_railway_z4;
+
+CREATE
+ INDEX IF NOT EXISTS osm_railway_z4_geom_idx ON
+ osm_railway_z4
+ USING GIST(geom);
+
+DROP
+ INDEX IF EXISTS osm_railway_z3_geom_idx;
+
REFRESH MATERIALIZED VIEW osm_railway_z3;
+
+CREATE
+ INDEX IF NOT EXISTS osm_railway_z3_geom_idx ON
+ osm_railway_z3
+ USING GIST(geom);
+
+DROP
+ INDEX IF EXISTS osm_railway_z2_geom_idx;
+
REFRESH MATERIALIZED VIEW osm_railway_z2;
+
+CREATE
+ INDEX IF NOT EXISTS osm_railway_z2_geom_idx ON
+ osm_railway_z2
+ USING GIST(geom);
+
+DROP
+ INDEX IF EXISTS osm_railway_z1_geom_idx;
+
REFRESH MATERIALIZED VIEW osm_railway_z1;
+
+CREATE
+ INDEX IF NOT EXISTS osm_railway_z1_geom_idx ON
+ osm_railway_z1
+ USING GIST(geom);
diff --git a/basemap/layers/railway/simplify.sql b/basemap/layers/railway/simplify.sql
deleted file mode 100644
index 11e015f5a..000000000
--- a/basemap/layers/railway/simplify.sql
+++ /dev/null
@@ -1,97 +0,0 @@
--- Licensed to the Apache Software Foundation (ASF) under one or more
--- contributor license agreements. See the NOTICE file distributed with
--- this work for additional information regarding copyright ownership.
--- The ASF licenses this file to you under the Apache License, Version 2.0
--- (the "License"); you may not use this file except in compliance with
--- the License. You may obtain a copy of the License at
---
--- http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing, software
--- distributed under the License is distributed on an "AS IS" BASIS,
--- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--- See the License for the specific language governing permissions and
--- limitations under the License.
-CREATE VIEW osm_railway_z20 AS
-SELECT id, tags, geom FROM osm_railway;
-
-CREATE VIEW osm_railway_z19 AS
-SELECT id, tags, geom FROM osm_railway;
-
-CREATE VIEW osm_railway_z18 AS
-SELECT id, tags, geom FROM osm_railway;
-
-CREATE VIEW osm_railway_z17 AS
-SELECT id, tags, geom FROM osm_railway;
-
-CREATE VIEW osm_railway_z16 AS
-SELECT id, tags, geom FROM osm_railway;
-
-CREATE VIEW osm_railway_z15 AS
-SELECT id, tags, geom FROM osm_railway;
-
-CREATE VIEW osm_railway_z14 AS
-SELECT id, tags, geom FROM osm_railway;
-
-CREATE VIEW osm_railway_z13 AS
-SELECT id, tags, geom FROM osm_railway;
-
-CREATE MATERIALIZED VIEW osm_railway_z12 AS
-SELECT id, tags, geom
-FROM (SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 12)) AS geom FROM osm_railway) AS osm_railway
-WHERE geom IS NOT NULL AND (st_area(st_envelope(geom)) > power((78270 / power(2, 12)), 2));
-
-CREATE MATERIALIZED VIEW osm_railway_z11 AS
-SELECT id, tags, geom
-FROM (SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 11)) AS geom FROM osm_railway) AS osm_railway
-WHERE geom IS NOT NULL AND (st_area(st_envelope(geom)) > power((78270 / power(2, 11)), 2));
-
-CREATE MATERIALIZED VIEW osm_railway_z10 AS
-SELECT id, tags, geom
-FROM (SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 10)) AS geom FROM osm_railway) AS osm_railway
-WHERE geom IS NOT NULL AND (st_area(st_envelope(geom)) > power((78270 / power(2, 10)), 2));
-
-CREATE MATERIALIZED VIEW osm_railway_z9 AS
-SELECT id, tags, geom
-FROM (SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 9)) AS geom FROM osm_railway) AS osm_railway
-WHERE geom IS NOT NULL AND (st_area(st_envelope(geom)) > power((78270 / power(2, 9)), 2));
-
-CREATE MATERIALIZED VIEW osm_railway_z8 AS
-SELECT id, tags, geom
-FROM (SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 8)) AS geom FROM osm_railway) AS osm_railway
-WHERE geom IS NOT NULL AND (st_area(st_envelope(geom)) > power((78270 / power(2, 8)), 2));
-
-CREATE MATERIALIZED VIEW osm_railway_z7 AS
-SELECT id, tags, geom
-FROM (SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 7)) AS geom FROM osm_railway) AS osm_railway
-WHERE geom IS NOT NULL AND (st_area(st_envelope(geom)) > power((78270 / power(2, 7)), 2));
-
-CREATE MATERIALIZED VIEW osm_railway_z6 AS
-SELECT id, tags, geom
-FROM (SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 6)) AS geom FROM osm_railway) AS osm_railway
-WHERE geom IS NOT NULL AND (st_area(st_envelope(geom)) > power((78270 / power(2, 6)), 2));
-
-CREATE MATERIALIZED VIEW osm_railway_z5 AS
-SELECT id, tags, geom
-FROM (SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 5)) AS geom FROM osm_railway) AS osm_railway
-WHERE geom IS NOT NULL AND (st_area(st_envelope(geom)) > power((78270 / power(2, 5)), 2));
-
-CREATE MATERIALIZED VIEW osm_railway_z4 AS
-SELECT id, tags, geom
-FROM (SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 4)) AS geom FROM osm_railway) AS osm_railway
-WHERE geom IS NOT NULL AND (st_area(st_envelope(geom)) > power((78270 / power(2, 4)), 2));
-
-CREATE MATERIALIZED VIEW osm_railway_z3 AS
-SELECT id, tags, geom
-FROM (SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 3)) AS geom FROM osm_railway) AS osm_railway
-WHERE geom IS NOT NULL AND (st_area(st_envelope(geom)) > power((78270 / power(2, 3)), 2));
-
-CREATE MATERIALIZED VIEW osm_railway_z2 AS
-SELECT id, tags, geom
-FROM (SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 2)) AS geom FROM osm_railway) AS osm_railway
-WHERE geom IS NOT NULL AND (st_area(st_envelope(geom)) > power((78270 / power(2, 2)), 2));
-
-CREATE MATERIALIZED VIEW osm_railway_z1 AS
-SELECT id, tags, geom
-FROM (SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 1)) AS geom FROM osm_railway) AS osm_railway
-WHERE geom IS NOT NULL AND (st_area(st_envelope(geom)) > power((78270 / power(2, 1)), 2));
diff --git a/basemap/layers/railway/tileset.js b/basemap/layers/railway/tileset.js
index d847a0311..09ffe6755 100644
--- a/basemap/layers/railway/tileset.js
+++ b/basemap/layers/railway/tileset.js
@@ -18,14 +18,9 @@ export default {
"id": "railway",
"queries": [
{
- "minzoom": 9,
- "maxzoom": 13,
- "sql": "SELECT id, tags, geom FROM osm_railway_z$zoom"
- },
- {
- "minzoom": 13,
+ "minzoom": 7,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_ways WHERE tags ? 'railway'"
+ "sql": "SELECT id, tags, geom FROM osm_railway_z$zoom"
}
]
}
diff --git a/basemap/layers/relation/create.sql b/basemap/layers/relation/create.sql
new file mode 100644
index 000000000..23a8f3332
--- /dev/null
+++ b/basemap/layers/relation/create.sql
@@ -0,0 +1,32 @@
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements. See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to you under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License. You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+DROP
+ TABLE
+ IF EXISTS osm_relation CASCADE;
+
+CREATE
+ TABLE
+ IF NOT EXISTS osm_relation(
+ id int8 PRIMARY KEY,
+ version INT,
+ uid INT,
+ TIMESTAMP TIMESTAMP WITHOUT TIME ZONE,
+ changeset int8,
+ tags jsonb,
+ member_refs BIGINT [],
+ member_types INT [],
+ member_roles text [],
+ geom geometry
+ );
\ No newline at end of file
diff --git a/basemap/layers/relation/refresh.sql b/basemap/layers/relation/refresh.sql
new file mode 100644
index 000000000..d49b7f1fe
--- /dev/null
+++ b/basemap/layers/relation/refresh.sql
@@ -0,0 +1,29 @@
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements. See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to you under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License. You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+DROP
+ INDEX IF EXISTS osm_relation_geom_index;
+
+DROP
+ INDEX IF EXISTS osm_relation_tags_index;
+
+CREATE
+ INDEX IF NOT EXISTS osm_relation_geom_index ON
+ osm_relation
+ USING GIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_relation_tags_index ON
+ osm_relation
+ USING GIN(tags);
diff --git a/basemap/layers/route/clean.sql b/basemap/layers/route/clean.sql
deleted file mode 100644
index 1b5358ae7..000000000
--- a/basemap/layers/route/clean.sql
+++ /dev/null
@@ -1,38 +0,0 @@
--- Licensed to the Apache Software Foundation (ASF) under one or more
--- contributor license agreements. See the NOTICE file distributed with
--- this work for additional information regarding copyright ownership.
--- The ASF licenses this file to you under the Apache License, Version 2.0
--- (the "License"); you may not use this file except in compliance with
--- the License. You may obtain a copy of the License at
---
--- http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing, software
--- distributed under the License is distributed on an "AS IS" BASIS,
--- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--- See the License for the specific language governing permissions and
--- limitations under the License.
-
-DROP MATERIALIZED VIEW IF EXISTS osm_route CASCADE;
-
-DROP VIEW IF EXISTS osm_route_z20 CASCADE;
-DROP VIEW IF EXISTS osm_route_z19 CASCADE;
-DROP VIEW IF EXISTS osm_route_z18 CASCADE;
-DROP VIEW IF EXISTS osm_route_z17 CASCADE;
-DROP VIEW IF EXISTS osm_route_z16 CASCADE;
-DROP VIEW IF EXISTS osm_route_z15 CASCADE;
-DROP VIEW IF EXISTS osm_route_z14 CASCADE;
-DROP VIEW IF EXISTS osm_route_z13 CASCADE;
-
-DROP MATERIALIZED VIEW IF EXISTS osm_route_z12 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_route_z11 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_route_z10 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_route_z9 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_route_z8 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_route_z7 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_route_z6 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_route_z5 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_route_z4 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_route_z3 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_route_z2 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_route_z1 CASCADE;
diff --git a/basemap/layers/route/create.sql b/basemap/layers/route/create.sql
new file mode 100644
index 000000000..5e83bfbdb
--- /dev/null
+++ b/basemap/layers/route/create.sql
@@ -0,0 +1,415 @@
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements. See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to you under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License. You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+CREATE
+ OR REPLACE VIEW osm_route AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_linestring
+ WHERE
+ tags ? 'route';
+
+CREATE
+ OR REPLACE VIEW osm_route_z20 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_route;
+
+CREATE
+ OR REPLACE VIEW osm_route_z19 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_route;
+
+CREATE
+ OR REPLACE VIEW osm_route_z18 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_route;
+
+CREATE
+ OR REPLACE VIEW osm_route_z17 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_route;
+
+CREATE
+ OR REPLACE VIEW osm_route_z16 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_route;
+
+CREATE
+ OR REPLACE VIEW osm_route_z15 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_route;
+
+CREATE
+ OR REPLACE VIEW osm_route_z14 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_route;
+
+CREATE
+ OR REPLACE VIEW osm_route_z13 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_route;
+
+------------------
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_route_filtered CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_route_filtered AS SELECT
+ tags -> 'route' AS route,
+ geom AS geom
+ FROM
+ osm_route
+ WHERE
+ tags ->> 'route' IN(
+ 'road',
+ 'bus',
+ 'trolleybus',
+ 'route',
+ 'ferry',
+ 'train',
+ 'subway',
+ 'light_rail',
+ 'railway',
+ 'tram',
+ 'funicular'
+ ) WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_route_clustered CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_route_clustered AS SELECT
+ route AS route,
+ geom AS geom,
+ ST_ClusterDBSCAN(
+ geom,
+ 0,
+ 1
+ ) OVER(
+ PARTITION BY route
+ ) AS cluster
+ FROM
+ osm_route_filtered WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_route_simplified CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_route_simplified AS WITH merged AS(
+ SELECT
+ route AS route,
+ ST_LineMerge(
+ ST_Collect(geom)
+ ) AS geom
+ FROM
+ osm_route_clustered
+ GROUP BY
+ route,
+ cluster
+ ),
+ exploded AS(
+ SELECT
+ route AS route,
+ (
+ ST_Dump(geom)
+ ).geom AS geom
+ FROM
+ merged
+ ) SELECT
+ ROW_NUMBER() OVER() AS id,
+ jsonb_build_object(
+ 'route',
+ route
+ ) AS tags,
+ geom AS geom
+ FROM
+ exploded WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_route_z12 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_route_z12 AS SELECT
+ id,
+ tags,
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 12 )
+ ) AS geom
+ FROM
+ osm_route_simplified
+ WHERE
+ geom IS NOT NULL
+ AND(
+ st_area(
+ st_envelope(geom)
+ )> POWER(( 78270 / POWER( 2, 12 )), 2 )
+ ) WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_route_z11 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_route_z11 AS SELECT
+ id,
+ tags,
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 11 )
+ ) AS geom
+ FROM
+ osm_route_simplified
+ WHERE
+ geom IS NOT NULL
+ AND(
+ st_area(
+ st_envelope(geom)
+ )> POWER(( 78270 / POWER( 2, 11 )), 2 )
+ ) WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_route_z10 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_route_z10 AS SELECT
+ id,
+ tags,
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 10 )
+ ) AS geom
+ FROM
+ osm_route_simplified
+ WHERE
+ geom IS NOT NULL
+ AND(
+ st_area(
+ st_envelope(geom)
+ )> POWER(( 78270 / POWER( 2, 10 )), 2 )
+ ) WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_route_z9 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_route_z9 AS SELECT
+ id,
+ tags,
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 9 )
+ ) AS geom
+ FROM
+ osm_route_simplified
+ WHERE
+ geom IS NOT NULL
+ AND(
+ st_area(
+ st_envelope(geom)
+ )> POWER(( 78270 / POWER( 2, 9 )), 2 )
+ ) WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_route_z8 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_route_z8 AS SELECT
+ id,
+ tags,
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 8 )
+ ) AS geom
+ FROM
+ osm_route_simplified
+ WHERE
+ geom IS NOT NULL
+ AND(
+ st_area(
+ st_envelope(geom)
+ )> POWER(( 78270 / POWER( 2, 8 )), 2 )
+ ) WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_route_z7 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_route_z7 AS SELECT
+ id,
+ tags,
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 7 )
+ ) AS geom
+ FROM
+ osm_route_simplified
+ WHERE
+ geom IS NOT NULL
+ AND(
+ st_area(
+ st_envelope(geom)
+ )> POWER(( 78270 / POWER( 2, 7 )), 2 )
+ ) WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_route_z6 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_route_z6 AS SELECT
+ id,
+ tags,
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 6 )
+ ) AS geom
+ FROM
+ osm_route_simplified
+ WHERE
+ geom IS NOT NULL
+ AND(
+ st_area(
+ st_envelope(geom)
+ )> POWER(( 78270 / POWER( 2, 6 )), 2 )
+ ) WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_route_z5 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_route_z5 AS SELECT
+ id,
+ tags,
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 5 )
+ ) AS geom
+ FROM
+ osm_route_simplified
+ WHERE
+ geom IS NOT NULL
+ AND(
+ st_area(
+ st_envelope(geom)
+ )> POWER(( 78270 / POWER( 2, 5 )), 2 )
+ ) WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_route_z4 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_route_z4 AS SELECT
+ id,
+ tags,
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 4 )
+ ) AS geom
+ FROM
+ osm_route_simplified
+ WHERE
+ geom IS NOT NULL
+ AND(
+ st_area(
+ st_envelope(geom)
+ )> POWER(( 78270 / POWER( 2, 4 )), 2 )
+ ) WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_route_z3 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_route_z3 AS SELECT
+ id,
+ tags,
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 3 )
+ ) AS geom
+ FROM
+ osm_route_simplified
+ WHERE
+ geom IS NOT NULL
+ AND(
+ st_area(
+ st_envelope(geom)
+ )> POWER(( 78270 / POWER( 2, 3 )), 2 )
+ ) WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_route_z2 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_route_z2 AS SELECT
+ id,
+ tags,
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 2 )
+ ) AS geom
+ FROM
+ osm_route_simplified
+ WHERE
+ geom IS NOT NULL
+ AND(
+ st_area(
+ st_envelope(geom)
+ )> POWER(( 78270 / POWER( 2, 2 )), 2 )
+ ) WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_route_z1 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_route_z1 AS SELECT
+ id,
+ tags,
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 1 )
+ ) AS geom
+ FROM
+ osm_route_simplified
+ WHERE
+ geom IS NOT NULL
+ AND(
+ st_area(
+ st_envelope(geom)
+ )> POWER(( 78270 / POWER( 2, 1 )), 2 )
+ ) WITH NO DATA;
diff --git a/basemap/layers/route/index.sql b/basemap/layers/route/index.sql
deleted file mode 100644
index 3b2a8ac91..000000000
--- a/basemap/layers/route/index.sql
+++ /dev/null
@@ -1,27 +0,0 @@
--- Licensed to the Apache Software Foundation (ASF) under one or more
--- contributor license agreements. See the NOTICE file distributed with
--- this work for additional information regarding copyright ownership.
--- The ASF licenses this file to you under the Apache License, Version 2.0
--- (the "License"); you may not use this file except in compliance with
--- the License. You may obtain a copy of the License at
---
--- http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing, software
--- distributed under the License is distributed on an "AS IS" BASIS,
--- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--- See the License for the specific language governing permissions and
--- limitations under the License.
-
-CREATE INDEX IF NOT EXISTS osm_route_geom_z12_index ON osm_route_z12 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_route_geom_z11_index ON osm_route_z11 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_route_geom_z10_index ON osm_route_z10 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_route_geom_z9_index ON osm_route_z9 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_route_geom_z8_index ON osm_route_z8 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_route_geom_z7_index ON osm_route_z7 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_route_geom_z6_index ON osm_route_z6 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_route_geom_z5_index ON osm_route_z5 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_route_geom_z4_index ON osm_route_z4 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_route_geom_z3_index ON osm_route_z3 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_route_geom_z2_index ON osm_route_z2 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_route_geom_z1_index ON osm_route_z1 USING SPGIST (geom);
diff --git a/basemap/layers/route/prepare.sql b/basemap/layers/route/prepare.sql
deleted file mode 100644
index e7881c161..000000000
--- a/basemap/layers/route/prepare.sql
+++ /dev/null
@@ -1,31 +0,0 @@
--- Licensed to the Apache Software Foundation (ASF) under one or more
--- contributor license agreements. See the NOTICE file distributed with
--- this work for additional information regarding copyright ownership.
--- The ASF licenses this file to you under the Apache License, Version 2.0
--- (the "License"); you may not use this file except in compliance with
--- the License. You may obtain a copy of the License at
---
--- http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing, software
--- distributed under the License is distributed on an "AS IS" BASIS,
--- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--- See the License for the specific language governing permissions and
--- limitations under the License.
-
-DROP MATERIALIZED VIEW IF EXISTS osm_route CASCADE;
-
-CREATE MATERIALIZED VIEW osm_route AS
-SELECT id, tags, geom
-FROM (
- SELECT
- min(id) as id,
- jsonb_build_object('route', tags -> 'route') as tags,
- (st_dump(st_linemerge(st_collect(geom)))).geom as geom
- FROM osm_ways
- WHERE tags ->> 'route' IN ('light_rail', 'monorail', 'rail', 'subway', 'tram')
- AND NOT tags ? 'service'
- GROUP BY tags -> 'route'
-) AS mergedDirective;
-
-CREATE INDEX IF NOT EXISTS osm_route_geom_index ON osm_route USING SPGIST (geom);
diff --git a/basemap/layers/route/refresh.sql b/basemap/layers/route/refresh.sql
index a25194f99..09459ad41 100644
--- a/basemap/layers/route/refresh.sql
+++ b/basemap/layers/route/refresh.sql
@@ -12,18 +12,152 @@
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
+DROP
+ INDEX IF EXISTS osm_route_filtered_geom;
-REFRESH MATERIALIZED VIEW osm_route;
+REFRESH MATERIALIZED VIEW osm_route_filtered;
+
+CREATE
+ INDEX IF NOT EXISTS osm_route_filtered_geom ON
+ osm_route_filtered
+ USING GIST(geom);
+
+DROP
+ INDEX IF EXISTS osm_route_clustered_geom;
+
+REFRESH MATERIALIZED VIEW osm_route_clustered;
+
+CREATE
+ INDEX IF NOT EXISTS osm_route_clustered_geom ON
+ osm_route_clustered
+ USING GIST(geom);
+
+DROP
+ INDEX IF EXISTS osm_route_simplified_geom;
+
+REFRESH MATERIALIZED VIEW osm_route_simplified;
+
+CREATE
+ INDEX IF NOT EXISTS osm_route_simplified_geom ON
+ osm_route_simplified
+ USING GIST(geom);
+
+DROP
+ INDEX IF EXISTS osm_route_z12_geom_idx;
REFRESH MATERIALIZED VIEW osm_route_z12;
+
+CREATE
+ INDEX IF NOT EXISTS osm_route_z12_geom_idx ON
+ osm_route_z12
+ USING GIST(geom);
+
+DROP
+ INDEX IF EXISTS osm_route_z11_geom_idx;
+
REFRESH MATERIALIZED VIEW osm_route_z11;
+
+CREATE
+ INDEX IF NOT EXISTS osm_route_z11_geom_idx ON
+ osm_route_z11
+ USING GIST(geom);
+
+DROP
+ INDEX IF EXISTS osm_route_z10_geom_idx;
+
REFRESH MATERIALIZED VIEW osm_route_z10;
+
+CREATE
+ INDEX IF NOT EXISTS osm_route_z10_geom_idx ON
+ osm_route_z10
+ USING GIST(geom);
+
+DROP
+ INDEX IF EXISTS osm_route_z9_geom_idx;
+
REFRESH MATERIALIZED VIEW osm_route_z9;
+
+CREATE
+ INDEX IF NOT EXISTS osm_route_z9_geom_idx ON
+ osm_route_z9
+ USING GIST(geom);
+
+DROP
+ INDEX IF EXISTS osm_route_z8_geom_idx;
+
REFRESH MATERIALIZED VIEW osm_route_z8;
+
+CREATE
+ INDEX IF NOT EXISTS osm_route_z8_geom_idx ON
+ osm_route_z8
+ USING GIST(geom);
+
+DROP
+ INDEX IF EXISTS osm_route_z7_geom_idx;
+
REFRESH MATERIALIZED VIEW osm_route_z7;
+
+CREATE
+ INDEX IF NOT EXISTS osm_route_z7_geom_idx ON
+ osm_route_z7
+ USING GIST(geom);
+
+DROP
+ INDEX IF EXISTS osm_route_z6_geom_idx;
+
REFRESH MATERIALIZED VIEW osm_route_z6;
+
+CREATE
+ INDEX IF NOT EXISTS osm_route_z6_geom_idx ON
+ osm_route_z6
+ USING GIST(geom);
+
+DROP
+ INDEX IF EXISTS osm_route_z5_geom_idx;
+
REFRESH MATERIALIZED VIEW osm_route_z5;
+
+CREATE
+ INDEX IF NOT EXISTS osm_route_z5_geom_idx ON
+ osm_route_z5
+ USING GIST(geom);
+
+DROP
+ INDEX IF EXISTS osm_route_z4_geom_idx;
+
REFRESH MATERIALIZED VIEW osm_route_z4;
+
+CREATE
+ INDEX IF NOT EXISTS osm_route_z4_geom_idx ON
+ osm_route_z4
+ USING GIST(geom);
+
+DROP
+ INDEX IF EXISTS osm_route_z3_geom_idx;
+
REFRESH MATERIALIZED VIEW osm_route_z3;
+
+CREATE
+ INDEX IF NOT EXISTS osm_route_z3_geom_idx ON
+ osm_route_z3
+ USING GIST(geom);
+
+DROP
+ INDEX IF EXISTS osm_route_z2_geom_idx;
+
REFRESH MATERIALIZED VIEW osm_route_z2;
+
+CREATE
+ INDEX IF NOT EXISTS osm_route_z2_geom_idx ON
+ osm_route_z2
+ USING GIST(geom);
+
+DROP
+ INDEX IF EXISTS osm_route_z1_geom_idx;
+
REFRESH MATERIALIZED VIEW osm_route_z1;
+
+CREATE
+ INDEX IF NOT EXISTS osm_route_z1_geom_idx ON
+ osm_route_z1
+ USING GIST(geom);
diff --git a/basemap/layers/route/simplify.sql b/basemap/layers/route/simplify.sql
deleted file mode 100644
index ef5284247..000000000
--- a/basemap/layers/route/simplify.sql
+++ /dev/null
@@ -1,98 +0,0 @@
--- Licensed to the Apache Software Foundation (ASF) under one or more
--- contributor license agreements. See the NOTICE file distributed with
--- this work for additional information regarding copyright ownership.
--- The ASF licenses this file to you under the Apache License, Version 2.0
--- (the "License"); you may not use this file except in compliance with
--- the License. You may obtain a copy of the License at
---
--- http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing, software
--- distributed under the License is distributed on an "AS IS" BASIS,
--- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--- See the License for the specific language governing permissions and
--- limitations under the License.
-
-CREATE VIEW osm_route_z20 AS
-SELECT id, tags, geom FROM osm_route;
-
-CREATE VIEW osm_route_z19 AS
-SELECT id, tags, geom FROM osm_route;
-
-CREATE VIEW osm_route_z18 AS
-SELECT id, tags, geom FROM osm_route;
-
-CREATE VIEW osm_route_z17 AS
-SELECT id, tags, geom FROM osm_route;
-
-CREATE VIEW osm_route_z16 AS
-SELECT id, tags, geom FROM osm_route;
-
-CREATE VIEW osm_route_z15 AS
-SELECT id, tags, geom FROM osm_route;
-
-CREATE VIEW osm_route_z14 AS
-SELECT id, tags, geom FROM osm_route;
-
-CREATE VIEW osm_route_z13 AS
-SELECT id, tags, geom FROM osm_route;
-
-CREATE MATERIALIZED VIEW osm_route_z12 AS
-SELECT id, tags, geom
-FROM (SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 12)) AS geom FROM osm_route) AS osm_route
-WHERE geom IS NOT NULL AND (st_area(st_envelope(geom)) > power((78270 / power(2, 12)), 2));
-
-CREATE MATERIALIZED VIEW osm_route_z11 AS
-SELECT id, tags, geom
-FROM (SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 11)) AS geom FROM osm_route) AS osm_route
-WHERE geom IS NOT NULL AND (st_area(st_envelope(geom)) > power((78270 / power(2, 11)), 2));
-
-CREATE MATERIALIZED VIEW osm_route_z10 AS
-SELECT id, tags, geom
-FROM (SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 10)) AS geom FROM osm_route) AS osm_route
-WHERE geom IS NOT NULL AND (st_area(st_envelope(geom)) > power((78270 / power(2, 10)), 2));
-
-CREATE MATERIALIZED VIEW osm_route_z9 AS
-SELECT id, tags, geom
-FROM (SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 9)) AS geom FROM osm_route) AS osm_route
-WHERE geom IS NOT NULL AND (st_area(st_envelope(geom)) > power((78270 / power(2, 9)), 2));
-
-CREATE MATERIALIZED VIEW osm_route_z8 AS
-SELECT id, tags, geom
-FROM (SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 8)) AS geom FROM osm_route) AS osm_route
-WHERE geom IS NOT NULL AND (st_area(st_envelope(geom)) > power((78270 / power(2, 8)), 2));
-
-CREATE MATERIALIZED VIEW osm_route_z7 AS
-SELECT id, tags, geom
-FROM (SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 7)) AS geom FROM osm_route) AS osm_route
-WHERE geom IS NOT NULL AND (st_area(st_envelope(geom)) > power((78270 / power(2, 7)), 2));
-
-CREATE MATERIALIZED VIEW osm_route_z6 AS
-SELECT id, tags, geom
-FROM (SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 6)) AS geom FROM osm_route) AS osm_route
-WHERE geom IS NOT NULL AND (st_area(st_envelope(geom)) > power((78270 / power(2, 6)), 2));
-
-CREATE MATERIALIZED VIEW osm_route_z5 AS
-SELECT id, tags, geom
-FROM (SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 5)) AS geom FROM osm_route) AS osm_route
-WHERE geom IS NOT NULL AND (st_area(st_envelope(geom)) > power((78270 / power(2, 5)), 2));
-
-CREATE MATERIALIZED VIEW osm_route_z4 AS
-SELECT id, tags, geom
-FROM (SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 4)) AS geom FROM osm_route) AS osm_route
-WHERE geom IS NOT NULL AND (st_area(st_envelope(geom)) > power((78270 / power(2, 4)), 2));
-
-CREATE MATERIALIZED VIEW osm_route_z3 AS
-SELECT id, tags, geom
-FROM (SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 3)) AS geom FROM osm_route) AS osm_route
-WHERE geom IS NOT NULL AND (st_area(st_envelope(geom)) > power((78270 / power(2, 3)), 2));
-
-CREATE MATERIALIZED VIEW osm_route_z2 AS
-SELECT id, tags, geom
-FROM (SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 2)) AS geom FROM osm_route) AS osm_route
-WHERE geom IS NOT NULL AND (st_area(st_envelope(geom)) > power((78270 / power(2, 2)), 2));
-
-CREATE MATERIALIZED VIEW osm_route_z1 AS
-SELECT id, tags, geom
-FROM (SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 1)) AS geom FROM osm_route) AS osm_route
-WHERE geom IS NOT NULL AND (st_area(st_envelope(geom)) > power((78270 / power(2, 1)), 2));
diff --git a/basemap/layers/route/tileset.js b/basemap/layers/route/tileset.js
index 9d5481aa9..b5714de16 100644
--- a/basemap/layers/route/tileset.js
+++ b/basemap/layers/route/tileset.js
@@ -25,7 +25,7 @@ export default {
{
"minzoom": 13,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_ways WHERE tags ? 'route'"
+ "sql": "SELECT id, tags, geom FROM osm_way WHERE tags ? 'route'"
}
]
}
diff --git a/basemap/layers/tourism/create.sql b/basemap/layers/tourism/create.sql
new file mode 100644
index 000000000..bc2b2ce43
--- /dev/null
+++ b/basemap/layers/tourism/create.sql
@@ -0,0 +1,24 @@
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements. See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to you under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License. You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+CREATE
+ OR REPLACE VIEW osm_tourism AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_relation
+ WHERE
+ geom IS NOT NULL
+ AND tags ? 'tourism';
\ No newline at end of file
diff --git a/basemap/layers/tourism/tileset.js b/basemap/layers/tourism/tileset.js
index f99681c96..a6fca2451 100644
--- a/basemap/layers/tourism/tileset.js
+++ b/basemap/layers/tourism/tileset.js
@@ -20,7 +20,7 @@ export default {
{
"minzoom": 14,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_relations_z$zoom WHERE tags ? 'tourism'"
+ "sql": "SELECT id, tags, geom FROM osm_tourism"
}
]
}
diff --git a/basemap/layers/waterway/clean.sql b/basemap/layers/waterway/clean.sql
deleted file mode 100644
index b5c2bfdb8..000000000
--- a/basemap/layers/waterway/clean.sql
+++ /dev/null
@@ -1,38 +0,0 @@
--- Licensed to the Apache Software Foundation (ASF) under one or more
--- contributor license agreements. See the NOTICE file distributed with
--- this work for additional information regarding copyright ownership.
--- The ASF licenses this file to you under the Apache License, Version 2.0
--- (the "License"); you may not use this file except in compliance with
--- the License. You may obtain a copy of the License at
---
--- http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing, software
--- distributed under the License is distributed on an "AS IS" BASIS,
--- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--- See the License for the specific language governing permissions and
--- limitations under the License.
-
-DROP MATERIALIZED VIEW IF EXISTS osm_waterway CASCADE;
-
-DROP VIEW IF EXISTS osm_waterway_z20 CASCADE;
-DROP VIEW IF EXISTS osm_waterway_z19 CASCADE;
-DROP VIEW IF EXISTS osm_waterway_z18 CASCADE;
-DROP VIEW IF EXISTS osm_waterway_z17 CASCADE;
-DROP VIEW IF EXISTS osm_waterway_z16 CASCADE;
-DROP VIEW IF EXISTS osm_waterway_z15 CASCADE;
-DROP VIEW IF EXISTS osm_waterway_z14 CASCADE;
-DROP VIEW IF EXISTS osm_waterway_z13 CASCADE;
-
-DROP MATERIALIZED VIEW IF EXISTS osm_waterway_z12 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_waterway_z11 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_waterway_z10 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_waterway_z9 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_waterway_z8 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_waterway_z7 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_waterway_z6 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_waterway_z5 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_waterway_z4 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_waterway_z3 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_waterway_z2 CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_waterway_z1 CASCADE;
diff --git a/basemap/layers/waterway/create.sql b/basemap/layers/waterway/create.sql
new file mode 100644
index 000000000..c4db91cbf
--- /dev/null
+++ b/basemap/layers/waterway/create.sql
@@ -0,0 +1,410 @@
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements. See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to you under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License. You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+CREATE
+ OR REPLACE VIEW osm_waterway AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_way
+ WHERE
+ tags ? 'waterway';
+
+CREATE
+ OR REPLACE VIEW osm_waterway_z20 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_waterway;
+
+CREATE
+ OR REPLACE VIEW osm_waterway_z19 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_waterway;
+
+CREATE
+ OR REPLACE VIEW osm_waterway_z18 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_waterway;
+
+CREATE
+ OR REPLACE VIEW osm_waterway_z17 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_waterway;
+
+CREATE
+ OR REPLACE VIEW osm_waterway_z16 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_waterway;
+
+CREATE
+ OR REPLACE VIEW osm_waterway_z15 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_waterway;
+
+CREATE
+ OR REPLACE VIEW osm_waterway_z14 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_waterway;
+
+CREATE
+ OR REPLACE VIEW osm_waterway_z13 AS SELECT
+ id,
+ tags,
+ geom
+ FROM
+ osm_waterway;
+
+------------------
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_waterway_filtered CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_waterway_filtered AS SELECT
+ tags -> 'waterway' AS waterway,
+ geom AS geom
+ FROM
+ osm_waterway
+ WHERE
+ tags ->> 'waterway' IN(
+ 'river',
+ 'stream',
+ 'canal',
+ 'drain',
+ 'ditch'
+ )
+ AND NOT tags ? 'intermittent' WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_waterway_clustered CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_waterway_clustered AS SELECT
+ waterway AS waterway,
+ geom AS geom,
+ ST_ClusterDBSCAN(
+ geom,
+ 0,
+ 1
+ ) OVER(
+ PARTITION BY waterway
+ ) AS cluster
+ FROM
+ osm_waterway_filtered WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_waterway_simplified CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_waterway_simplified AS WITH merged AS(
+ SELECT
+ waterway AS waterway,
+ ST_LineMerge(
+ ST_Collect(geom)
+ ) AS geom
+ FROM
+ osm_waterway_clustered
+ GROUP BY
+ waterway,
+ cluster
+ ),
+ exploded AS(
+ SELECT
+ waterway AS waterway,
+ (
+ ST_Dump(geom)
+ ).geom AS geom
+ FROM
+ merged
+ ) SELECT
+ ROW_NUMBER() OVER() AS id,
+ jsonb_build_object(
+ 'waterway',
+ waterway
+ ) AS tags,
+ geom AS geom
+ FROM
+ exploded WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_waterway_z12 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_waterway_z12 AS SELECT
+ id,
+ tags,
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 12 )
+ ) AS geom
+ FROM
+ osm_waterway_simplified
+ WHERE
+ geom IS NOT NULL
+ AND(
+ st_area(
+ st_envelope(geom)
+ )> POWER(( 78270 / POWER( 2, 12 )), 2 )
+ ) WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_waterway_z11 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_waterway_z11 AS SELECT
+ id,
+ tags,
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 11 )
+ ) AS geom
+ FROM
+ osm_waterway_simplified
+ WHERE
+ geom IS NOT NULL
+ AND(
+ st_area(
+ st_envelope(geom)
+ )> POWER(( 78270 / POWER( 2, 11 )), 2 )
+ ) WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_waterway_z10 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_waterway_z10 AS SELECT
+ id,
+ tags,
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 10 )
+ ) AS geom
+ FROM
+ osm_waterway_simplified
+ WHERE
+ geom IS NOT NULL
+ AND(
+ st_area(
+ st_envelope(geom)
+ )> POWER(( 78270 / POWER( 2, 10 )), 2 )
+ ) WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_waterway_z9 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_waterway_z9 AS SELECT
+ id,
+ tags,
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 9 )
+ ) AS geom
+ FROM
+ osm_waterway_simplified
+ WHERE
+ geom IS NOT NULL
+ AND(
+ st_area(
+ st_envelope(geom)
+ )> POWER(( 78270 / POWER( 2, 9 )), 2 )
+ ) WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_waterway_z8 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_waterway_z8 AS SELECT
+ id,
+ tags,
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 8 )
+ ) AS geom
+ FROM
+ osm_waterway_simplified
+ WHERE
+ geom IS NOT NULL
+ AND(
+ st_area(
+ st_envelope(geom)
+ )> POWER(( 78270 / POWER( 2, 8 )), 2 )
+ ) WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_waterway_z7 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_waterway_z7 AS SELECT
+ id,
+ tags,
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 7 )
+ ) AS geom
+ FROM
+ osm_waterway_simplified
+ WHERE
+ geom IS NOT NULL
+ AND(
+ st_area(
+ st_envelope(geom)
+ )> POWER(( 78270 / POWER( 2, 7 )), 2 )
+ ) WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_waterway_z6 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_waterway_z6 AS SELECT
+ id,
+ tags,
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 6 )
+ ) AS geom
+ FROM
+ osm_waterway_simplified
+ WHERE
+ geom IS NOT NULL
+ AND(
+ st_area(
+ st_envelope(geom)
+ )> POWER(( 78270 / POWER( 2, 6 )), 2 )
+ ) WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_waterway_z5 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_waterway_z5 AS SELECT
+ id,
+ tags,
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 5 )
+ ) AS geom
+ FROM
+ osm_waterway_simplified
+ WHERE
+ geom IS NOT NULL
+ AND(
+ st_area(
+ st_envelope(geom)
+ )> POWER(( 78270 / POWER( 2, 5 )), 2 )
+ ) WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_waterway_z4 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_waterway_z4 AS SELECT
+ id,
+ tags,
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 4 )
+ ) AS geom
+ FROM
+ osm_waterway_simplified
+ WHERE
+ geom IS NOT NULL
+ AND(
+ st_area(
+ st_envelope(geom)
+ )> POWER(( 78270 / POWER( 2, 4 )), 2 )
+ ) WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_waterway_z3 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_waterway_z3 AS SELECT
+ id,
+ tags,
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 3 )
+ ) AS geom
+ FROM
+ osm_waterway_simplified
+ WHERE
+ geom IS NOT NULL
+ AND(
+ st_area(
+ st_envelope(geom)
+ )> POWER(( 78270 / POWER( 2, 3 )), 2 )
+ ) WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_waterway_z2 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_waterway_z2 AS SELECT
+ id,
+ tags,
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 2 )
+ ) AS geom
+ FROM
+ osm_waterway_simplified
+ WHERE
+ geom IS NOT NULL
+ AND(
+ st_area(
+ st_envelope(geom)
+ )> POWER(( 78270 / POWER( 2, 2 )), 2 )
+ ) WITH NO DATA;
+
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_waterway_z1 CASCADE;
+
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS osm_waterway_z1 AS SELECT
+ id,
+ tags,
+ st_simplifypreservetopology(
+ geom,
+ 78270 / POWER( 2, 1 )
+ ) AS geom
+ FROM
+ osm_waterway_simplified
+ WHERE
+ geom IS NOT NULL
+ AND(
+ st_area(
+ st_envelope(geom)
+ )> POWER(( 78270 / POWER( 2, 1 )), 2 )
+ ) WITH NO DATA;
diff --git a/basemap/layers/waterway/index.sql b/basemap/layers/waterway/index.sql
deleted file mode 100644
index 06e1484b3..000000000
--- a/basemap/layers/waterway/index.sql
+++ /dev/null
@@ -1,27 +0,0 @@
--- Licensed to the Apache Software Foundation (ASF) under one or more
--- contributor license agreements. See the NOTICE file distributed with
--- this work for additional information regarding copyright ownership.
--- The ASF licenses this file to you under the Apache License, Version 2.0
--- (the "License"); you may not use this file except in compliance with
--- the License. You may obtain a copy of the License at
---
--- http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing, software
--- distributed under the License is distributed on an "AS IS" BASIS,
--- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--- See the License for the specific language governing permissions and
--- limitations under the License.
-
-CREATE INDEX IF NOT EXISTS osm_waterway_geom_z12_index ON osm_waterway_z12 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_waterway_geom_z11_index ON osm_waterway_z11 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_waterway_geom_z10_index ON osm_waterway_z10 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_waterway_geom_z9_index ON osm_waterway_z9 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_waterway_geom_z8_index ON osm_waterway_z8 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_waterway_geom_z7_index ON osm_waterway_z7 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_waterway_geom_z6_index ON osm_waterway_z6 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_waterway_geom_z5_index ON osm_waterway_z5 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_waterway_geom_z4_index ON osm_waterway_z4 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_waterway_geom_z3_index ON osm_waterway_z3 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_waterway_geom_z2_index ON osm_waterway_z2 USING SPGIST (geom);
-CREATE INDEX IF NOT EXISTS osm_waterway_geom_z1_index ON osm_waterway_z1 USING SPGIST (geom);
diff --git a/basemap/layers/waterway/prepare.sql b/basemap/layers/waterway/prepare.sql
deleted file mode 100644
index 1e079d36c..000000000
--- a/basemap/layers/waterway/prepare.sql
+++ /dev/null
@@ -1,63 +0,0 @@
--- Licensed to the Apache Software Foundation (ASF) under one or more
--- contributor license agreements. See the NOTICE file distributed with
--- this work for additional information regarding copyright ownership.
--- The ASF licenses this file to you under the Apache License, Version 2.0
--- (the "License"); you may not use this file except in compliance with
--- the License. You may obtain a copy of the License at
---
--- http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing, software
--- distributed under the License is distributed on an "AS IS" BASIS,
--- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--- See the License for the specific language governing permissions and
--- limitations under the License.
-
-DROP MATERIALIZED VIEW IF EXISTS osm_waterway CASCADE;
-
-CREATE MATERIALIZED VIEW osm_waterway AS
-WITH
- -- Filter the linestrings
- filtered AS (
- SELECT
- tags -> 'waterway' AS waterway,
- geom AS geom
- FROM osm_linestring
- WHERE tags ->> 'waterway' IN ('river', 'stream', 'canal', 'drain', 'ditch')
- AND NOT tags ? 'intermittent'
- ),
- -- Cluster the linestrings
- clustered AS (
- SELECT
- waterway AS waterway,
- geom as geom,
- ST_ClusterDBSCAN(geom, 0, 1) OVER (PARTITION BY waterway) AS cluster
- FROM
- filtered
- ),
- -- Merge the linestrings into a single geometry per cluster
- merged AS (
- SELECT
- waterway AS waterway,
- ST_LineMerge(ST_Collect(geom)) AS geom
- FROM
- clustered
- GROUP BY
- waterway, cluster
- ),
- -- Explode the merged linestrings into individual linestrings
- exploded AS (
- SELECT
- waterway AS waterway,
- (ST_Dump(geom)).geom AS geom
- FROM
- merged
- )
-SELECT
- row_number() OVER () AS id,
- jsonb_build_object('waterway', waterway) AS tags,
- geom AS geom
-FROM exploded;
-
-CREATE INDEX IF NOT EXISTS osm_waterway_tags_index ON osm_waterway USING gin (tags);
-CREATE INDEX IF NOT EXISTS osm_waterway_geom_index ON osm_waterway USING gist (geom);
diff --git a/basemap/layers/waterway/refresh.sql b/basemap/layers/waterway/refresh.sql
index b18034ba6..d88331e44 100644
--- a/basemap/layers/waterway/refresh.sql
+++ b/basemap/layers/waterway/refresh.sql
@@ -12,18 +12,152 @@
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
+DROP
+ INDEX IF EXISTS osm_waterway_filtered_geom;
-REFRESH MATERIALIZED VIEW osm_waterway;
+REFRESH MATERIALIZED VIEW osm_waterway_filtered;
+
+CREATE
+ INDEX IF NOT EXISTS osm_waterway_filtered_geom ON
+ osm_waterway_filtered
+ USING GIST(geom);
+
+DROP
+ INDEX IF EXISTS osm_waterway_clustered_geom;
+
+REFRESH MATERIALIZED VIEW osm_waterway_clustered;
+
+CREATE
+ INDEX IF NOT EXISTS osm_waterway_clustered_geom ON
+ osm_waterway_clustered
+ USING GIST(geom);
+
+DROP
+ INDEX IF EXISTS osm_waterway_simplified_geom;
+
+REFRESH MATERIALIZED VIEW osm_waterway_simplified;
+
+CREATE
+ INDEX IF NOT EXISTS osm_waterway_simplified_geom ON
+ osm_waterway_simplified
+ USING GIST(geom);
+
+DROP
+ INDEX IF EXISTS osm_waterway_z12_geom_idx;
REFRESH MATERIALIZED VIEW osm_waterway_z12;
+
+CREATE
+ INDEX IF NOT EXISTS osm_waterway_z12_geom_idx ON
+ osm_waterway_z12
+ USING GIST(geom);
+
+DROP
+ INDEX IF EXISTS osm_waterway_z11_geom_idx;
+
REFRESH MATERIALIZED VIEW osm_waterway_z11;
+
+CREATE
+ INDEX IF NOT EXISTS osm_waterway_z11_geom_idx ON
+ osm_waterway_z11
+ USING GIST(geom);
+
+DROP
+ INDEX IF EXISTS osm_waterway_z10_geom_idx;
+
REFRESH MATERIALIZED VIEW osm_waterway_z10;
+
+CREATE
+ INDEX IF NOT EXISTS osm_waterway_z10_geom_idx ON
+ osm_waterway_z10
+ USING GIST(geom);
+
+DROP
+ INDEX IF EXISTS osm_waterway_z9_geom_idx;
+
REFRESH MATERIALIZED VIEW osm_waterway_z9;
+
+CREATE
+ INDEX IF NOT EXISTS osm_waterway_z9_geom_idx ON
+ osm_waterway_z9
+ USING GIST(geom);
+
+DROP
+ INDEX IF EXISTS osm_waterway_z8_geom_idx;
+
REFRESH MATERIALIZED VIEW osm_waterway_z8;
+
+CREATE
+ INDEX IF NOT EXISTS osm_waterway_z8_geom_idx ON
+ osm_waterway_z8
+ USING GIST(geom);
+
+DROP
+ INDEX IF EXISTS osm_waterway_z7_geom_idx;
+
REFRESH MATERIALIZED VIEW osm_waterway_z7;
+
+CREATE
+ INDEX IF NOT EXISTS osm_waterway_z7_geom_idx ON
+ osm_waterway_z7
+ USING GIST(geom);
+
+DROP
+ INDEX IF EXISTS osm_waterway_z6_geom_idx;
+
REFRESH MATERIALIZED VIEW osm_waterway_z6;
+
+CREATE
+ INDEX IF NOT EXISTS osm_waterway_z6_geom_idx ON
+ osm_waterway_z6
+ USING GIST(geom);
+
+DROP
+ INDEX IF EXISTS osm_waterway_z5_geom_idx;
+
REFRESH MATERIALIZED VIEW osm_waterway_z5;
+
+CREATE
+ INDEX IF NOT EXISTS osm_waterway_z5_geom_idx ON
+ osm_waterway_z5
+ USING GIST(geom);
+
+DROP
+ INDEX IF EXISTS osm_waterway_z4_geom_idx;
+
REFRESH MATERIALIZED VIEW osm_waterway_z4;
+
+CREATE
+ INDEX IF NOT EXISTS osm_waterway_z4_geom_idx ON
+ osm_waterway_z4
+ USING GIST(geom);
+
+DROP
+ INDEX IF EXISTS osm_waterway_z3_geom_idx;
+
REFRESH MATERIALIZED VIEW osm_waterway_z3;
+
+CREATE
+ INDEX IF NOT EXISTS osm_waterway_z3_geom_idx ON
+ osm_waterway_z3
+ USING GIST(geom);
+
+DROP
+ INDEX IF EXISTS osm_waterway_z2_geom_idx;
+
REFRESH MATERIALIZED VIEW osm_waterway_z2;
+
+CREATE
+ INDEX IF NOT EXISTS osm_waterway_z2_geom_idx ON
+ osm_waterway_z2
+ USING GIST(geom);
+
+DROP
+ INDEX IF EXISTS osm_waterway_z1_geom_idx;
+
REFRESH MATERIALIZED VIEW osm_waterway_z1;
+
+CREATE
+ INDEX IF NOT EXISTS osm_waterway_z1_geom_idx ON
+ osm_waterway_z1
+ USING GIST(geom);
diff --git a/basemap/layers/waterway/simplify.sql b/basemap/layers/waterway/simplify.sql
deleted file mode 100644
index 10182a56f..000000000
--- a/basemap/layers/waterway/simplify.sql
+++ /dev/null
@@ -1,97 +0,0 @@
--- Licensed to the Apache Software Foundation (ASF) under one or more
--- contributor license agreements. See the NOTICE file distributed with
--- this work for additional information regarding copyright ownership.
--- The ASF licenses this file to you under the Apache License, Version 2.0
--- (the "License"); you may not use this file except in compliance with
--- the License. You may obtain a copy of the License at
---
--- http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing, software
--- distributed under the License is distributed on an "AS IS" BASIS,
--- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--- See the License for the specific language governing permissions and
--- limitations under the License.
-CREATE VIEW osm_waterway_z20 AS
-SELECT id, tags, geom FROM osm_waterway;
-
-CREATE VIEW osm_waterway_z19 AS
-SELECT id, tags, geom FROM osm_waterway;
-
-CREATE VIEW osm_waterway_z18 AS
-SELECT id, tags, geom FROM osm_waterway;
-
-CREATE VIEW osm_waterway_z17 AS
-SELECT id, tags, geom FROM osm_waterway;
-
-CREATE VIEW osm_waterway_z16 AS
-SELECT id, tags, geom FROM osm_waterway;
-
-CREATE VIEW osm_waterway_z15 AS
-SELECT id, tags, geom FROM osm_waterway;
-
-CREATE VIEW osm_waterway_z14 AS
-SELECT id, tags, geom FROM osm_waterway;
-
-CREATE VIEW osm_waterway_z13 AS
-SELECT id, tags, geom FROM osm_waterway;
-
-CREATE MATERIALIZED VIEW osm_waterway_z12 AS
-SELECT id, tags, geom
-FROM (SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 12)) AS geom FROM osm_waterway) AS osm_waterway
-WHERE geom IS NOT NULL AND (st_area(st_envelope(geom)) > power((78270 / power(2, 12)), 2));
-
-CREATE MATERIALIZED VIEW osm_waterway_z11 AS
-SELECT id, tags, geom
-FROM (SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 11)) AS geom FROM osm_waterway) AS osm_waterway
-WHERE geom IS NOT NULL AND (st_area(st_envelope(geom)) > power((78270 / power(2, 11)), 2));
-
-CREATE MATERIALIZED VIEW osm_waterway_z10 AS
-SELECT id, tags, geom
-FROM (SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 10)) AS geom FROM osm_waterway) AS osm_waterway
-WHERE geom IS NOT NULL AND (st_area(st_envelope(geom)) > power((78270 / power(2, 10)), 2));
-
-CREATE MATERIALIZED VIEW osm_waterway_z9 AS
-SELECT id, tags, geom
-FROM (SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 9)) AS geom FROM osm_waterway) AS osm_waterway
-WHERE geom IS NOT NULL AND (st_area(st_envelope(geom)) > power((78270 / power(2, 9)), 2));
-
-CREATE MATERIALIZED VIEW osm_waterway_z8 AS
-SELECT id, tags, geom
-FROM (SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 8)) AS geom FROM osm_waterway) AS osm_waterway
-WHERE geom IS NOT NULL AND (st_area(st_envelope(geom)) > power((78270 / power(2, 8)), 2));
-
-CREATE MATERIALIZED VIEW osm_waterway_z7 AS
-SELECT id, tags, geom
-FROM (SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 7)) AS geom FROM osm_waterway) AS osm_waterway
-WHERE geom IS NOT NULL AND (st_area(st_envelope(geom)) > power((78270 / power(2, 7)), 2));
-
-CREATE MATERIALIZED VIEW osm_waterway_z6 AS
-SELECT id, tags, geom
-FROM (SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 6)) AS geom FROM osm_waterway) AS osm_waterway
-WHERE geom IS NOT NULL AND (st_area(st_envelope(geom)) > power((78270 / power(2, 6)), 2));
-
-CREATE MATERIALIZED VIEW osm_waterway_z5 AS
-SELECT id, tags, geom
-FROM (SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 5)) AS geom FROM osm_waterway) AS osm_waterway
-WHERE geom IS NOT NULL AND (st_area(st_envelope(geom)) > power((78270 / power(2, 5)), 2));
-
-CREATE MATERIALIZED VIEW osm_waterway_z4 AS
-SELECT id, tags, geom
-FROM (SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 4)) AS geom FROM osm_waterway) AS osm_waterway
-WHERE geom IS NOT NULL AND (st_area(st_envelope(geom)) > power((78270 / power(2, 4)), 2));
-
-CREATE MATERIALIZED VIEW osm_waterway_z3 AS
-SELECT id, tags, geom
-FROM (SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 3)) AS geom FROM osm_waterway) AS osm_waterway
-WHERE geom IS NOT NULL AND (st_area(st_envelope(geom)) > power((78270 / power(2, 3)), 2));
-
-CREATE MATERIALIZED VIEW osm_waterway_z2 AS
-SELECT id, tags, geom
-FROM (SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 2)) AS geom FROM osm_waterway) AS osm_waterway
-WHERE geom IS NOT NULL AND (st_area(st_envelope(geom)) > power((78270 / power(2, 2)), 2));
-
-CREATE MATERIALIZED VIEW osm_waterway_z1 AS
-SELECT id, tags, geom
-FROM (SELECT id, tags, st_simplifypreservetopology(geom, 78270 / power(2, 1)) AS geom FROM osm_waterway) AS osm_waterway
-WHERE geom IS NOT NULL AND (st_area(st_envelope(geom)) > power((78270 / power(2, 1)), 2));
diff --git a/basemap/layers/waterway/tileset.js b/basemap/layers/waterway/tileset.js
index 241874324..a95e49e82 100644
--- a/basemap/layers/waterway/tileset.js
+++ b/basemap/layers/waterway/tileset.js
@@ -30,7 +30,7 @@ export default {
{
"minzoom": 13,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_ways WHERE tags ? 'waterway'"
+ "sql": "SELECT id, tags, geom FROM osm_way WHERE tags ? 'waterway'"
}
]
}
diff --git a/basemap/layers/way/create.sql b/basemap/layers/way/create.sql
new file mode 100644
index 000000000..ab634e58e
--- /dev/null
+++ b/basemap/layers/way/create.sql
@@ -0,0 +1,30 @@
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements. See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to you under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License. You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+DROP
+ TABLE
+ IF EXISTS osm_way CASCADE;
+
+CREATE
+ TABLE
+ IF NOT EXISTS osm_way(
+ id int8 PRIMARY KEY,
+ version INT,
+ uid INT,
+ TIMESTAMP TIMESTAMP WITHOUT TIME ZONE,
+ changeset int8,
+ tags jsonb,
+ nodes int8 [],
+ geom geometry
+ );
diff --git a/basemap/layers/polygon/refresh.sql b/basemap/layers/way/refresh.sql
similarity index 74%
rename from basemap/layers/polygon/refresh.sql
rename to basemap/layers/way/refresh.sql
index 580d6f9e8..023c9f338 100644
--- a/basemap/layers/polygon/refresh.sql
+++ b/basemap/layers/way/refresh.sql
@@ -12,5 +12,18 @@
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
+DROP
+ INDEX IF EXISTS osm_way_geom_index;
-REFRESH MATERIALIZED VIEW osm_polygon;
\ No newline at end of file
+DROP
+ INDEX IF EXISTS osm_way_tags_index;
+
+CREATE
+ INDEX IF NOT EXISTS osm_way_geom_index ON
+ osm_way
+ USING GIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS osm_way_tags_index ON
+ osm_way
+ USING GIN(tags);
diff --git a/basemap/queries/assertions.sql b/basemap/queries/assertions.sql
index 7a2019c1e..6c9cdc933 100644
--- a/basemap/queries/assertions.sql
+++ b/basemap/queries/assertions.sql
@@ -12,37 +12,107 @@
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-
-- Asserts that the test function raises the expected exception.
-CREATE OR REPLACE FUNCTION assert_exception(test_query text, expected_exception text)
- RETURNS void AS $$
-BEGIN
- BEGIN
- -- Execute the test query using dynamic SQL
- EXECUTE test_query;
-
- -- If no exception is raised, fail the test
- RAISE EXCEPTION 'Assertion Failed: Expected exception %, but no exception was raised', expected_exception;
- EXCEPTION
- WHEN OTHERS THEN
- -- Check if the raised exception matches the expected exception
- IF SQLERRM NOT LIKE expected_exception THEN
- RAISE EXCEPTION 'Assertion Failed: Expected exception %, but was %', expected_exception, SQLERRM;
- END IF;
- END;
+CREATE
+ OR REPLACE FUNCTION assert_exception(
+ test_query text,
+ expected_exception text
+ ) RETURNS void AS $$ BEGIN BEGIN -- Execute the test query using dynamic SQL
+EXECUTE test_query;
+
+-- If no exception is raised, fail the test
+
+RAISE EXCEPTION 'Assertion Failed: Expected exception %, but no exception was raised',
+expected_exception;
+
+EXCEPTION
+WHEN OTHERS THEN -- Check if the raised exception matches the expected exception
+IF SQLERRM NOT LIKE expected_exception THEN RAISE EXCEPTION 'Assertion Failed: Expected exception %, but was %',
+expected_exception,
+SQLERRM;
+END IF;
END;
+END;
+
$$ LANGUAGE plpgsql;
-- Asserts that the actual value is equal to the expected value.
-CREATE OR REPLACE FUNCTION assert_equals(actual numeric, expected numeric)
- RETURNS void AS $$
-BEGIN
- IF actual != expected THEN
- RAISE EXCEPTION 'Assertion Failed: Expected %, but was %', expected, actual;
- END IF;
+CREATE
+ OR REPLACE FUNCTION assert_equals(
+ actual NUMERIC,
+ expected NUMERIC
+ ) RETURNS void AS $$ BEGIN IF actual != expected THEN RAISE EXCEPTION 'Assertion Failed: Expected %, but was %',
+ expected,
+ actual;
+END IF;
END;
+
$$ LANGUAGE plpgsql;
-- Test cases for the assert_equals function
-SELECT assert_equals(1, 1);
-SELECT assert_exception('SELECT assert_equals(1, 2)', 'Assertion Failed: Expected 2, but was 1');
\ No newline at end of file
+SELECT
+ assert_equals(
+ 1,
+ 1
+ );
+
+SELECT
+ assert_exception(
+ 'SELECT assert_equals(1, 2)',
+ 'Assertion Failed: Expected 2, but was 1'
+ );
+
+-- Test cases for the convert_to_number function
+SELECT
+ assert_equals(
+ convert_to_number(
+ '1',
+ 0
+ ),
+ 1
+ );
+
+SELECT
+ assert_equals(
+ convert_to_number(
+ '2.3',
+ 0
+ ),
+ 2.3
+ );
+
+SELECT
+ assert_equals(
+ convert_to_number(
+ '3,4',
+ 0
+ ),
+ 3.4
+ );
+
+SELECT
+ assert_equals(
+ convert_to_number(
+ '1.5m',
+ 0
+ ),
+ 1.5
+ );
+
+SELECT
+ assert_equals(
+ convert_to_number(
+ '6.6 m',
+ 0
+ ),
+ 6.6
+ );
+
+SELECT
+ assert_equals(
+ convert_to_number(
+ 'abc',
+ 0
+ ),
+ 0
+ );
\ No newline at end of file
diff --git a/basemap/queries/functions.sql b/basemap/queries/functions.sql
index f07d33627..0e383098b 100644
--- a/basemap/queries/functions.sql
+++ b/basemap/queries/functions.sql
@@ -12,38 +12,36 @@
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-
-- Converts a string to a number
-CREATE OR REPLACE FUNCTION convert_to_number(input_string text, default_value numeric)
- RETURNS numeric AS $$
-DECLARE
- result numeric;
-BEGIN
- -- Replace comma with dot
- input_string := REPLACE(input_string, ',', '.');
+CREATE
+ OR REPLACE FUNCTION convert_to_number(
+ input_string text,
+ default_value NUMERIC
+ ) RETURNS NUMERIC AS $$ DECLARE RESULT NUMERIC;
+
+BEGIN -- Replace comma with dot
+
+input_string := REPLACE(
+ input_string,
+ ',',
+ '.'
+);
+
+-- Use a regular expression to extract the first number from the string
- -- Use a regular expression to extract the first number from the string
- input_string := SUBSTRING(input_string FROM '^[0-9]+\.?[0-9]*');
+input_string := SUBSTRING( input_string FROM '^[0-9]+\.?[0-9]*' );
- -- Convert the extracted string to a numeric type
- result := input_string::numeric;
+-- Convert the extracted string to a numeric type
+RESULT := input_string::NUMERIC;
- IF result IS NULL THEN
- RETURN default_value;
- END IF;
+IF RESULT IS NULL THEN RETURN default_value;
+END IF;
+
+RETURN RESULT;
- RETURN result;
EXCEPTION
- WHEN others THEN
- -- Return the default value in case of any error
- RETURN default_value;
+WHEN OTHERS THEN -- Return the default value in case of any error
+RETURN default_value;
END;
-$$ LANGUAGE plpgsql;
--- Test cases for the convert_to_number function
-SELECT assert_equals(convert_to_number('1', 0), 1);
-SELECT assert_equals(convert_to_number('2.3', 0), 2.3);
-SELECT assert_equals(convert_to_number('3,4', 0), 3.4);
-SELECT assert_equals(convert_to_number('1.5m', 0), 1.5);
-SELECT assert_equals(convert_to_number('6.6 m', 0), 6.6);
-SELECT assert_equals(convert_to_number('abc', 0), 0);
\ No newline at end of file
+$$ LANGUAGE plpgsql;
diff --git a/basemap/queries/initialize.sql b/basemap/queries/initialize.sql
index 99c99ac71..b774e5c67 100644
--- a/basemap/queries/initialize.sql
+++ b/basemap/queries/initialize.sql
@@ -12,5 +12,5 @@
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-
-CREATE EXTENSION IF NOT EXISTS postgis;
+CREATE
+ EXTENSION IF NOT EXISTS postgis;
diff --git a/basemap/queries/ne_index.sql b/basemap/queries/ne_index.sql
deleted file mode 100644
index 3c70fc019..000000000
--- a/basemap/queries/ne_index.sql
+++ /dev/null
@@ -1,150 +0,0 @@
--- Licensed to the Apache Software Foundation (ASF) under one or more
--- contributor license agreements. See the NOTICE file distributed with
--- this work for additional information regarding copyright ownership.
--- The ASF licenses this file to you under the Apache License, Version 2.0
--- (the "License"); you may not use this file except in compliance with
--- the License. You may obtain a copy of the License at
---
--- http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing, software
--- distributed under the License is distributed on an "AS IS" BASIS,
--- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--- See the License for the specific language governing permissions and
--- limitations under the License.
-
-CREATE INDEX IF NOT EXISTS ne_10m_admin_0_antarctic_claim_limit_lines_geom_index ON ne_10m_admin_0_antarctic_claim_limit_lines USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_admin_0_antarctic_claims_geom_index ON ne_10m_admin_0_antarctic_claims USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_admin_0_boundary_lines_disputed_areas_geom_index ON ne_10m_admin_0_boundary_lines_disputed_areas USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_admin_0_boundary_lines_land_geom_index ON ne_10m_admin_0_boundary_lines_land USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_admin_0_boundary_lines_map_units_geom_index ON ne_10m_admin_0_boundary_lines_map_units USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_admin_0_boundary_lines_maritime_indicator_geom_index ON ne_10m_admin_0_boundary_lines_maritime_indicator USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_admin_0_countries_geom_index ON ne_10m_admin_0_countries USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_admin_0_countries_lakes_geom_index ON ne_10m_admin_0_countries_lakes USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_admin_0_disputed_areas_geom_index ON ne_10m_admin_0_disputed_areas USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_admin_0_disputed_areas_scale_rank_minor_islands_geom_index ON ne_10m_admin_0_disputed_areas_scale_rank_minor_islands USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_admin_0_label_points_geom_index ON ne_10m_admin_0_label_points USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_admin_0_map_subunits_geom_index ON ne_10m_admin_0_map_subunits USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_admin_0_map_units_geom_index ON ne_10m_admin_0_map_units USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_admin_0_pacific_groupings_geom_index ON ne_10m_admin_0_pacific_groupings USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_admin_0_scale_rank_geom_index ON ne_10m_admin_0_scale_rank USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_admin_0_scale_rank_minor_islands_geom_index ON ne_10m_admin_0_scale_rank_minor_islands USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_admin_0_seams_geom_index ON ne_10m_admin_0_seams USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_admin_0_sovereignty_geom_index ON ne_10m_admin_0_sovereignty USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_admin_1_label_points_details_geom_index ON ne_10m_admin_1_label_points_details USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_admin_1_label_points_geom_index ON ne_10m_admin_1_label_points USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_admin_1_seams_geom_index ON ne_10m_admin_1_seams USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_admin_1_states_provinces_geom_index ON ne_10m_admin_1_states_provinces USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_admin_1_states_provinces_lakes_geom_index ON ne_10m_admin_1_states_provinces_lakes USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_admin_1_states_provinces_lines_geom_index ON ne_10m_admin_1_states_provinces_lines USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_admin_1_states_provinces_scale_rank_geom_index ON ne_10m_admin_1_states_provinces_scale_rank USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_admin_1_states_provinces_scale_rank_minor_islands_geom_index ON ne_10m_admin_1_states_provinces_scale_rank_minor_islands USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_airports_geom_index ON ne_10m_airports USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_antarctic_ice_shelves_lines_geom_index ON ne_10m_antarctic_ice_shelves_lines USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_antarctic_ice_shelves_polys_geom_index ON ne_10m_antarctic_ice_shelves_polys USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_coastline_geom_index ON ne_10m_coastline USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_geographic_lines_geom_index ON ne_10m_geographic_lines USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_geography_marine_polys_geom_index ON ne_10m_geography_marine_polys USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_geography_regions_elevation_points_geom_index ON ne_10m_geography_regions_elevation_points USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_geography_regions_points_geom_index ON ne_10m_geography_regions_points USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_geography_regions_polys_geom_index ON ne_10m_geography_regions_polys USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_glaciated_areas_geom_index ON ne_10m_glaciated_areas USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_lakes_europe_geom_index ON ne_10m_lakes_europe USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_lakes_geom_index ON ne_10m_lakes USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_lakes_historic_geom_index ON ne_10m_lakes_historic USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_lakes_north_america_geom_index ON ne_10m_lakes_north_america USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_lakes_pluvial_geom_index ON ne_10m_lakes_pluvial USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_land_geom_index ON ne_10m_land USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_land_ocean_label_points_geom_index ON ne_10m_land_ocean_label_points USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_land_ocean_seams_geom_index ON ne_10m_land_ocean_seams USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_land_scale_rank_geom_index ON ne_10m_land_scale_rank USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_minor_islands_coastline_geom_index ON ne_10m_minor_islands_coastline USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_minor_islands_geom_index ON ne_10m_minor_islands USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_minor_islands_label_points_geom_index ON ne_10m_minor_islands_label_points USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_ocean_geom_index ON ne_10m_ocean USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_ocean_scale_rank_geom_index ON ne_10m_ocean_scale_rank USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_parks_and_protected_lands_area_geom_index ON ne_10m_parks_and_protected_lands_area USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_parks_and_protected_lands_line_geom_index ON ne_10m_parks_and_protected_lands_line USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_parks_and_protected_lands_point_geom_index ON ne_10m_parks_and_protected_lands_point USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_parks_and_protected_lands_scale_rank_geom_index ON ne_10m_parks_and_protected_lands_scale_rank USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_playas_geom_index ON ne_10m_playas USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_populated_places_geom_index ON ne_10m_populated_places USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_populated_places_simple_geom_index ON ne_10m_populated_places_simple USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_ports_geom_index ON ne_10m_ports USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_railroads_geom_index ON ne_10m_railroads USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_railroads_north_america_geom_index ON ne_10m_railroads_north_america USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_reefs_geom_index ON ne_10m_reefs USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_rivers_europe_geom_index ON ne_10m_rivers_europe USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_rivers_lake_centerlines_geom_index ON ne_10m_rivers_lake_centerlines USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_rivers_lake_centerlines_scale_rank_geom_index ON ne_10m_rivers_lake_centerlines_scale_rank USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_rivers_north_america_geom_index ON ne_10m_rivers_north_america USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_roads_geom_index ON ne_10m_roads USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_roads_north_america_geom_index ON ne_10m_roads_north_america USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_time_zones_geom_index ON ne_10m_time_zones USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_urban_areas_geom_index ON ne_10m_urban_areas USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_urban_areas_landscan_geom_index ON ne_10m_urban_areas_landscan USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_110m_admin_0_boundary_lines_land_geom_index ON ne_110m_admin_0_boundary_lines_land USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_110m_admin_0_countries_geom_index ON ne_110m_admin_0_countries USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_110m_admin_0_countries_lakes_geom_index ON ne_110m_admin_0_countries_lakes USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_110m_admin_0_map_units_geom_index ON ne_110m_admin_0_map_units USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_110m_admin_0_pacific_groupings_geom_index ON ne_110m_admin_0_pacific_groupings USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_110m_admin_0_scale_rank_geom_index ON ne_110m_admin_0_scale_rank USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_110m_admin_0_sovereignty_geom_index ON ne_110m_admin_0_sovereignty USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_110m_admin_0_tiny_countries_geom_index ON ne_110m_admin_0_tiny_countries USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_110m_admin_1_states_provinces_geom_index ON ne_110m_admin_1_states_provinces USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_110m_admin_1_states_provinces_lakes_geom_index ON ne_110m_admin_1_states_provinces_lakes USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_110m_admin_1_states_provinces_lines_geom_index ON ne_110m_admin_1_states_provinces_lines USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_110m_admin_1_states_provinces_scale_rank_geom_index ON ne_110m_admin_1_states_provinces_scale_rank USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_110m_coastline_geom_index ON ne_110m_coastline USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_110m_geographic_lines_geom_index ON ne_110m_geographic_lines USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_110m_geography_marine_polys_geom_index ON ne_110m_geography_marine_polys USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_110m_geography_regions_elevation_points_geom_index ON ne_110m_geography_regions_elevation_points USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_110m_geography_regions_points_geom_index ON ne_110m_geography_regions_points USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_110m_geography_regions_polys_geom_index ON ne_110m_geography_regions_polys USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_110m_glaciated_areas_geom_index ON ne_110m_glaciated_areas USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_110m_lakes_geom_index ON ne_110m_lakes USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_110m_land_geom_index ON ne_110m_land USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_110m_ocean_geom_index ON ne_110m_ocean USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_110m_populated_places_geom_index ON ne_110m_populated_places USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_110m_populated_places_simple_geom_index ON ne_110m_populated_places_simple USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_110m_rivers_lake_centerlines_geom_index ON ne_110m_rivers_lake_centerlines USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_admin_0_boundary_lines_disputed_areas_geom_index ON ne_50m_admin_0_boundary_lines_disputed_areas USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_admin_0_boundary_lines_land_geom_index ON ne_50m_admin_0_boundary_lines_land USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_admin_0_boundary_lines_maritime_indicator_geom_index ON ne_50m_admin_0_boundary_lines_maritime_indicator USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_admin_0_boundary_map_units_geom_index ON ne_50m_admin_0_boundary_map_units USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_admin_0_breakaway_disputed_areas_geom_index ON ne_50m_admin_0_breakaway_disputed_areas USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_admin_0_breakaway_disputed_areas_scale_rank_geom_index ON ne_50m_admin_0_breakaway_disputed_areas_scale_rank USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_admin_0_countries_geom_index ON ne_50m_admin_0_countries USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_admin_0_countries_lakes_geom_index ON ne_50m_admin_0_countries_lakes USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_admin_0_map_subunits_geom_index ON ne_50m_admin_0_map_subunits USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_admin_0_map_units_geom_index ON ne_50m_admin_0_map_units USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_admin_0_pacific_groupings_geom_index ON ne_50m_admin_0_pacific_groupings USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_admin_0_scale_rank_geom_index ON ne_50m_admin_0_scale_rank USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_admin_0_sovereignty_geom_index ON ne_50m_admin_0_sovereignty USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_admin_0_tiny_countries_geom_index ON ne_50m_admin_0_tiny_countries USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_admin_0_tiny_countries_scale_rank_geom_index ON ne_50m_admin_0_tiny_countries_scale_rank USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_admin_1_states_provinces_geom_index ON ne_50m_admin_1_states_provinces USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_admin_1_states_provinces_lakes_geom_index ON ne_50m_admin_1_states_provinces_lakes USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_admin_1_states_provinces_lines_geom_index ON ne_50m_admin_1_states_provinces_lines USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_admin_1_states_provinces_scale_rank_geom_index ON ne_50m_admin_1_states_provinces_scale_rank USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_airports_geom_index ON ne_50m_airports USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_antarctic_ice_shelves_lines_geom_index ON ne_50m_antarctic_ice_shelves_lines USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_antarctic_ice_shelves_polys_geom_index ON ne_50m_antarctic_ice_shelves_polys USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_coastline_geom_index ON ne_50m_coastline USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_geographic_lines_geom_index ON ne_50m_geographic_lines USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_geography_marine_polys_geom_index ON ne_50m_geography_marine_polys USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_geography_regions_elevation_points_geom_index ON ne_50m_geography_regions_elevation_points USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_geography_regions_points_geom_index ON ne_50m_geography_regions_points USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_geography_regions_polys_geom_index ON ne_50m_geography_regions_polys USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_glaciated_areas_geom_index ON ne_50m_glaciated_areas USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_lakes_geom_index ON ne_50m_lakes USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_lakes_historic_geom_index ON ne_50m_lakes_historic USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_land_geom_index ON ne_50m_land USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_ocean_geom_index ON ne_50m_ocean USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_playas_geom_index ON ne_50m_playas USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_populated_places_geom_index ON ne_50m_populated_places USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_populated_places_simple_geom_index ON ne_50m_populated_places_simple USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_ports_geom_index ON ne_50m_ports USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_rivers_lake_centerlines_geom_index ON ne_50m_rivers_lake_centerlines USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_rivers_lake_centerlines_scale_rank_geom_index ON ne_50m_rivers_lake_centerlines_scale_rank USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_urban_areas_geom_index ON ne_50m_urban_areas USING SPGIST(geom);
diff --git a/basemap/queries/osm_drop_indexes.sql b/basemap/queries/osm_drop_indexes.sql
deleted file mode 100644
index 713c2438e..000000000
--- a/basemap/queries/osm_drop_indexes.sql
+++ /dev/null
@@ -1,26 +0,0 @@
--- Licensed to the Apache Software Foundation (ASF) under one or more
--- contributor license agreements. See the NOTICE file distributed with
--- this work for additional information regarding copyright ownership.
--- The ASF licenses this file to you under the Apache License, Version 2.0
--- (the "License"); you may not use this file except in compliance with
--- the License. You may obtain a copy of the License at
---
--- http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing, software
--- distributed under the License is distributed on an "AS IS" BASIS,
--- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--- See the License for the specific language governing permissions and
--- limitations under the License.
-
-DROP INDEX IF EXISTS osm_nodes_tags_index;
-DROP INDEX IF EXISTS osm_nodes_tags_tsvector_index;
-DROP INDEX IF EXISTS osm_nodes_geom_index;
-
-DROP INDEX IF EXISTS osm_ways_tags_index;
-DROP INDEX IF EXISTS osm_ways_tags_tsvector_index;
-DROP INDEX IF EXISTS osm_ways_geom_index;
-
-DROP INDEX IF EXISTS osm_relations_tags_index;
-DROP INDEX IF EXISTS osm_relations_tags_tsvector_index;
-DROP INDEX IF EXISTS osm_relations_geom_index;
diff --git a/basemap/queries/osm_entities.sql b/basemap/queries/osm_entities.sql
deleted file mode 100644
index 7349c81c7..000000000
--- a/basemap/queries/osm_entities.sql
+++ /dev/null
@@ -1,25 +0,0 @@
--- Licensed to the Apache Software Foundation (ASF) under one or more
--- contributor license agreements. See the NOTICE file distributed with
--- this work for additional information regarding copyright ownership.
--- The ASF licenses this file to you under the Apache License, Version 2.0
--- (the "License"); you may not use this file except in compliance with
--- the License. You may obtain a copy of the License at
---
--- http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing, software
--- distributed under the License is distributed on an "AS IS" BASIS,
--- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--- See the License for the specific language governing permissions and
--- limitations under the License.
-
-CREATE VIEW osm_entities AS (
- SELECT 'node' as type, id, tags, geom
- FROM osm_nodes
- UNION
- SELECT 'way' as type, id, tags, geom
- FROM osm_ways
- UNION
- SELECT 'relation' as type, id, tags, geom
- FROM osm_relations
-);
diff --git a/basemap/queries/osm_nodes.sql b/basemap/queries/osm_nodes.sql
deleted file mode 100644
index 26ba537a0..000000000
--- a/basemap/queries/osm_nodes.sql
+++ /dev/null
@@ -1,18 +0,0 @@
--- Licensed to the Apache Software Foundation (ASF) under one or more
--- contributor license agreements. See the NOTICE file distributed with
--- this work for additional information regarding copyright ownership.
--- The ASF licenses this file to you under the Apache License, Version 2.0
--- (the "License"); you may not use this file except in compliance with
--- the License. You may obtain a copy of the License at
---
--- http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing, software
--- distributed under the License is distributed on an "AS IS" BASIS,
--- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--- See the License for the specific language governing permissions and
--- limitations under the License.
-
-CREATE INDEX IF NOT EXISTS osm_nodes_geom_index ON osm_nodes USING gist (geom);
-CREATE INDEX IF NOT EXISTS osm_nodes_tags_index ON osm_nodes USING gin (tags);
--- CREATE INDEX IF NOT EXISTS osm_nodes_tags_tsvector_index ON osm_nodes USING gin (to_tsvector('english', tags));
diff --git a/basemap/queries/osm_relations.sql b/basemap/queries/osm_relations.sql
deleted file mode 100644
index 80d735f6e..000000000
--- a/basemap/queries/osm_relations.sql
+++ /dev/null
@@ -1,18 +0,0 @@
--- Licensed to the Apache Software Foundation (ASF) under one or more
--- contributor license agreements. See the NOTICE file distributed with
--- this work for additional information regarding copyright ownership.
--- The ASF licenses this file to you under the Apache License, Version 2.0
--- (the "License"); you may not use this file except in compliance with
--- the License. You may obtain a copy of the License at
---
--- http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing, software
--- distributed under the License is distributed on an "AS IS" BASIS,
--- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--- See the License for the specific language governing permissions and
--- limitations under the License.
-
-CREATE INDEX IF NOT EXISTS osm_relations_geom_index ON osm_relations USING gist (geom);
-CREATE INDEX IF NOT EXISTS osm_relations_tags_index ON osm_relations USING gin (tags);
---CREATE INDEX IF NOT EXISTS osm_relations_tags_tsvector_index ON osm_relations USING gin (to_tsvector('english', tags));
\ No newline at end of file
diff --git a/basemap/queries/osm_ways.sql b/basemap/queries/osm_ways.sql
deleted file mode 100644
index f64cf7034..000000000
--- a/basemap/queries/osm_ways.sql
+++ /dev/null
@@ -1,18 +0,0 @@
--- Licensed to the Apache Software Foundation (ASF) under one or more
--- contributor license agreements. See the NOTICE file distributed with
--- this work for additional information regarding copyright ownership.
--- The ASF licenses this file to you under the Apache License, Version 2.0
--- (the "License"); you may not use this file except in compliance with
--- the License. You may obtain a copy of the License at
---
--- http://www.apache.org/licenses/LICENSE-2.0
---
--- Unless required by applicable law or agreed to in writing, software
--- distributed under the License is distributed on an "AS IS" BASIS,
--- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--- See the License for the specific language governing permissions and
--- limitations under the License.
-
-CREATE INDEX IF NOT EXISTS osm_ways_geom_index ON osm_ways USING gist (geom);
-CREATE INDEX IF NOT EXISTS osm_ways_tags_index ON osm_ways USING gin (tags);
---CREATE INDEX IF NOT EXISTS osm_ways_tags_tsvector_index ON osm_ways USING gin (to_tsvector('english', tags));
diff --git a/basemap/queries/statistics.sql b/basemap/queries/statistics.sql
index 38e1ff2c4..ff45236d6 100644
--- a/basemap/queries/statistics.sql
+++ b/basemap/queries/statistics.sql
@@ -12,11 +12,21 @@
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
+SELECT
+ oid::regclass::text AS objectname,
+ relkind AS objecttype,
+ reltuples AS entries,
+ pg_size_pretty(
+ pg_table_size(oid)
+ ) AS SIZE -- depending - see below
-SELECT oid::regclass::text AS objectname
- , relkind AS objecttype
- , reltuples AS entries
- , pg_size_pretty(pg_table_size(oid)) AS size -- depending - see below
-FROM pg_class
-WHERE relkind IN ('r', 'i', 'm')
-ORDER BY pg_table_size(oid) DESC;
+FROM
+ pg_class
+WHERE
+ relkind IN(
+ 'r',
+ 'i',
+ 'm'
+ )
+ORDER BY
+ pg_table_size(oid) DESC;
diff --git a/basemap/refresh.js b/basemap/refresh.js
index 7afa917f0..a24f2116c 100644
--- a/basemap/refresh.js
+++ b/basemap/refresh.js
@@ -19,125 +19,30 @@ import config from "./config.js";
export default {
"steps": [
{
- "id": "openstreetmap-member",
+ "id": "refresh-node",
"needs": [],
"tasks": [
- {
- "type": "ExecuteSql",
- "file": "layers/member/refresh.sql",
- "database": config.database,
- },
- ]
- },
- {
- "id": "openstreetmap-point",
- "needs": ["openstreetmap-member"],
- "tasks": [
- {
- "type": "ExecuteSql",
- "file": "layers/point/refresh.sql",
- "database": config.database,
- },
- ]
- },
- {
- "id": "openstreetmap-linestring",
- "needs": ["openstreetmap-member"],
- "tasks": [
- {
- "type": "ExecuteSql",
- "file": "layers/linestring/refresh.sql",
- "database": config.database,
- },
- ]
- },
- {
- "id": "openstreetmap-polygon",
- "needs": ["openstreetmap-member"],
- "tasks": [
- {
- "type": "ExecuteSql",
- "file": "layers/polygon/refresh.sql",
- "database": config.database,
- },
- ]
- },
- {
- "id": "openstreetmap-highway",
- "needs": ["openstreetmap-linestring"],
- "tasks": [
- {
- "type": "ExecuteSql",
- "file": "layers/highway/refresh.sql",
- "database": config.database,
- },
- ]
- },
- {
- "id": "openstreetmap-railway",
- "needs": ["openstreetmap-linestring"],
- "tasks": [
- {
- "type": "ExecuteSql",
- "file": "layers/railway/refresh.sql",
- "database": config.database,
- },
- ]
- },
- {
- "id": "openstreetmap-route",
- "needs": ["openstreetmap-linestring"],
- "tasks": [
- {
- "type": "ExecuteSql",
- "file": "layers/route/refresh.sql",
- "database": config.database,
- },
- ]
- },
- {
- "id": "openstreetmap-waterway",
- "needs": ["openstreetmap-linestring"],
- "tasks": [
- {
- "type": "ExecuteSql",
- "file": "layers/waterway/refresh.sql",
- "database": config.database,
- },
- ]
- },
- {
- "id": "openstreetmap-natural",
- "needs": ["openstreetmap-polygon"],
- "tasks": [
- {
- "type": "ExecuteSql",
- "file": "layers/natural/refresh.sql",
- "database": config.database,
- },
- ]
- },
- {
- "id": "openstreetmap-landuse",
- "needs": ["openstreetmap-polygon"],
- "tasks": [
- {
- "type": "ExecuteSql",
- "file": "layers/landuse/refresh.sql",
- "database": config.database,
- },
- ]
- },
- {
- "id": "openstreetmap-leisure",
- "needs": ["openstreetmap-polygon"],
- "tasks": [
- {
- "type": "ExecuteSql",
- "file": "layers/leisure/refresh.sql",
- "database": config.database,
- },
- ]
+ "layers/node/refresh.sql",
+ "layers/way/refresh.sql",
+ "layers/relation/refresh.sql",
+ "layers/member/refresh.sql",
+ "layers/amenity/refresh.sql",
+ "layers/ocean/refresh.sql",
+ "layers/highway/refresh.sql",
+ "layers/landuse/refresh.sql",
+ "layers/leisure/refresh.sql",
+ "layers/natural/refresh.sql",
+ "layers/point/refresh.sql",
+ "layers/railway/refresh.sql",
+ "layers/route/refresh.sql",
+ "layers/waterway/refresh.sql"
+ ].map(file => {
+ return {
+ "type": "ExecuteSql",
+ "file": file,
+ "database": config.database,
+ }
+ })
},
]
}
diff --git a/basemap/style.js b/basemap/style.js
index 10ceaff9b..bc03a82d4 100644
--- a/basemap/style.js
+++ b/basemap/style.js
@@ -106,9 +106,9 @@ export default {
highway_tunnel_line,
building_fill,
highway_construction_line,
+ highway_fill,
highway_outline,
highway_line,
- highway_fill,
railway_line,
attraction_line,
highway_bridge_outline,
diff --git a/basemap/themes/default.js b/basemap/themes/default.js
index 914365eb7..1ba134aed 100644
--- a/basemap/themes/default.js
+++ b/basemap/themes/default.js
@@ -28,7 +28,9 @@ export default {
aerialwayLineColor: 'rgb(145, 144, 143)',
aerowayPolygonColor: 'rgba(213, 213, 220, 1.0)',
aerowayRunwayLineColor: 'rgba(187, 187, 204, 1.0)',
+ aerowayRunwayLineWidth: [12, 0.5, 16, 10],
aerowayTaxiwayLineColor: 'rgba(187, 187, 204, 1.0)',
+ aerowayTaxiwayLineWidth: [12, 0.5, 16, 4],
amenityAtmIconColor: 'rgba(115, 74, 10, 1)',
amenityAtmIconHaloColor: 'rgba(255, 255, 255, 0.8)',
amenityAtmTextColor: 'rgba(115, 74, 10, 1)',
@@ -317,12 +319,14 @@ export default {
leisureSwimmingPoolOverlayOutlineColor: 'rgb(120, 183, 202)',
leisureTrackBackgroundFillColor: 'rgb(196, 224, 203)',
leisureTrackBackgroundFillOutlineColor: 'rgba(101, 206, 166, 1.0)',
+ leisureTrackLineColor: "rgb(196, 224, 203)",
+ leisureTrackLineWidth: [5, 0.5, 16, 2],
manMadeBridgeFillColor: 'rgb(184, 184, 184)',
manMadeGroyneFillColor: 'rgb(184, 184, 184)',
manMadeIconColor: 'rgb(85, 85, 85)',
manMadePierFillColor: 'rgb(184, 184, 184)',
manMadePierLineColor: 'rgb(242, 239, 233)',
- manMadePierLineWidth: [5, 0.5, 16, 3],
+ manMadePierLineWidth: [5, 0.5, 16, 2],
manMadePierTextHaloColor: 'rgba(255,255,255,0.8)',
manMadeWasteWaterPlantFillColor: 'rgb(235, 219, 231)',
naturalBareRockBackgroundFillColor: 'rgb(217, 212, 206)',
@@ -414,4 +418,5 @@ export default {
waterwayTextColor: 'rgba(26, 109, 187, 1)',
waterwayTextHaloColor: 'rgba(255, 255, 255, 0.8)',
waterwayTunnelColor: 'rgb(216,237,250)',
+
};
diff --git a/basemap/tileset.js b/basemap/tileset.js
index 31d5520c3..f2a123543 100644
--- a/basemap/tileset.js
+++ b/basemap/tileset.js
@@ -40,7 +40,7 @@ export default {
"center": [...config.center, config.zoom],
"bounds": [...config.bounds],
"minzoom": 0.0,
- "maxzoom": 14.0,
+ "maxzoom": 16.0,
"tiles": [
`${config.host}/tiles/{z}/{x}/{y}.mvt`
],
diff --git a/daylight/layers/coastline/prepare.sql b/daylight/layers/coastline/prepare.sql
index c0f2c0eeb..ba588bb5f 100644
--- a/daylight/layers/coastline/prepare.sql
+++ b/daylight/layers/coastline/prepare.sql
@@ -7,17 +7,42 @@
-- is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
-- or implied. See the License for the specific language governing permissions and limitations under
-- the License.
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_coastline CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_coastline CASCADE;
+DROP
+ MATERIALIZED VIEW IF EXISTS osm_coastline_simplified CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS osm_coastline_simplified CASCADE;
+CREATE
+ MATERIALIZED VIEW osm_coastline AS SELECT
+ ROW_NUMBER() OVER() AS id,
+ '{"ocean":"water"}'::jsonb AS tags,
+ st_setsrid(
+ geometry,
+ 3857
+ ) AS geom
+ FROM
+ water_polygons_shp;
-CREATE MATERIALIZED VIEW osm_coastline AS
-SELECT row_number() OVER () as id, '{"ocean":"water"}'::jsonb as tags, st_setsrid(geometry, 3857) AS geom FROM water_polygons_shp;
+CREATE
+ MATERIALIZED VIEW osm_coastline_simplified AS SELECT
+ id,
+ tags,
+ st_simplifypreservetopology(
+ geom,
+ 300
+ ) AS geom
+ FROM
+ osm_coastline
+ WHERE
+ ST_Area(geom)> 300000;
-CREATE MATERIALIZED VIEW osm_coastline_simplified AS
-SELECT id, tags, st_simplifypreservetopology(geom, 300) as geom FROM osm_coastline WHERE ST_Area(geom) > 300000;
+CREATE
+ INDEX IF NOT EXISTS osm_coastline_index ON
+ osm_coastline
+ USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS osm_coastline_index ON osm_coastline USING SPGIST (geom);
-
-CREATE INDEX IF NOT EXISTS osm_coastline_simplified_index ON osm_coastline_simplified USING SPGIST (geom);
+CREATE
+ INDEX IF NOT EXISTS osm_coastline_simplified_index ON
+ osm_coastline_simplified
+ USING SPGIST(geom);
diff --git a/daylight/layers/landcover/prepare.sql b/daylight/layers/landcover/prepare.sql
index 927e30400..3803924fe 100644
--- a/daylight/layers/landcover/prepare.sql
+++ b/daylight/layers/landcover/prepare.sql
@@ -7,11 +7,21 @@
-- is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
-- or implied. See the License for the specific language governing permissions and limitations under
-- the License.
+DROP
+ MATERIALIZED VIEW IF EXISTS esa_landcover CASCADE;
-DROP MATERIALIZED VIEW IF EXISTS esa_landcover CASCADE;
+CREATE
+ MATERIALIZED VIEW esa_landcover AS SELECT
+ id AS id,
+ jsonb_build_object(
+ 'landcover',
+ class
+ ) AS tags,
+ geometry AS geom
+ FROM
+ low_shp;
-CREATE MATERIALIZED VIEW esa_landcover AS
-SELECT id as id, jsonb_build_object('landcover', class) as tags, geometry as geom
-FROM low_shp;
-
-CREATE INDEX IF NOT EXISTS esa_landcover_index ON esa_landcover USING SPGIST (geom);
+CREATE
+ INDEX IF NOT EXISTS esa_landcover_index ON
+ esa_landcover
+ USING SPGIST(geom);
diff --git a/daylight/workflow.js b/daylight/workflow.js
index 62bde2fc6..e3fced7a3 100644
--- a/daylight/workflow.js
+++ b/daylight/workflow.js
@@ -144,7 +144,7 @@ export default {
"tasks": [
{
"type": "ExecuteSql",
- "file": "../basemap/queries/osm_nodes.sql",
+ "file": "../basemap/queries/osm_node.sql",
"database": config.database,
"parallel": true,
},
@@ -156,7 +156,7 @@ export default {
"tasks": [
{
"type": "ExecuteSql",
- "file": "../basemap/queries/osm_ways.sql",
+ "file": "../basemap/queries/osm_way.sql",
"database": config.database,
"parallel": true,
},
@@ -168,7 +168,7 @@ export default {
"tasks": [
{
"type": "ExecuteSql",
- "file": "../basemap/queries/osm_relations.sql",
+ "file": "../basemap/queries/osm_relation.sql",
"database": config.database,
"parallel": true,
},
diff --git a/examples/extrusion/indexes.sql b/examples/extrusion/indexes.sql
index b46089ddc..c59d73f79 100644
--- a/examples/extrusion/indexes.sql
+++ b/examples/extrusion/indexes.sql
@@ -12,8 +12,27 @@
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-CREATE INDEX CONCURRENTLY IF NOT EXISTS osm_ways_gin ON osm_ways USING gin (nodes);
-CREATE INDEX CONCURRENTLY IF NOT EXISTS osm_relations_gin ON osm_relations USING gin (member_refs);
-CREATE INDEX CONCURRENTLY IF NOT EXISTS osm_nodes_gix ON osm_nodes USING GIST (geom);
-CREATE INDEX CONCURRENTLY IF NOT EXISTS osm_ways_gix ON osm_ways USING GIST (geom);
-CREATE INDEX CONCURRENTLY IF NOT EXISTS osm_relations_gix ON osm_relations USING GIST (geom);
\ No newline at end of file
+CREATE
+ INDEX CONCURRENTLY IF NOT EXISTS osm_way_gin ON
+ osm_way
+ USING gin(nodes);
+
+CREATE
+ INDEX CONCURRENTLY IF NOT EXISTS osm_relation_gin ON
+ osm_relation
+ USING gin(member_refs);
+
+CREATE
+ INDEX CONCURRENTLY IF NOT EXISTS osm_node_gix ON
+ osm_node
+ USING GIST(geom);
+
+CREATE
+ INDEX CONCURRENTLY IF NOT EXISTS osm_way_gix ON
+ osm_way
+ USING GIST(geom);
+
+CREATE
+ INDEX CONCURRENTLY IF NOT EXISTS osm_relation_gix ON
+ osm_relation
+ USING GIST(geom);
\ No newline at end of file
diff --git a/examples/extrusion/tileset.json b/examples/extrusion/tileset.json
index 5af76cece..f86b5dd1a 100644
--- a/examples/extrusion/tileset.json
+++ b/examples/extrusion/tileset.json
@@ -24,7 +24,7 @@
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags || jsonb_build_object('building:height', (CASE WHEN tags ->> 'building:levels' ~ '^[0-9\\\\.]+$' THEN tags ->> 'building:levels' ELSE '1' END)::real * 3) as tags, geom FROM osm_ways WHERE tags ? 'building'"
+ "sql": "SELECT id, tags || jsonb_build_object('building:height', (CASE WHEN tags ->> 'building:levels' ~ '^[0-9\\\\.]+$' THEN tags ->> 'building:levels' ELSE '1' END)::real * 3) as tags, geom FROM osm_way WHERE tags ? 'building'"
}
]
}
diff --git a/examples/naturalearth/indexes.sql b/examples/naturalearth/indexes.sql
index 2d6efd30d..112d868c0 100644
--- a/examples/naturalearth/indexes.sql
+++ b/examples/naturalearth/indexes.sql
@@ -12,138 +12,677 @@
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-CREATE INDEX IF NOT EXISTS ne_10m_admin_0_antarctic_claim_limit_lines_gix ON ne_10m_admin_0_antarctic_claim_limit_lines USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_admin_0_antarctic_claims_gix ON ne_10m_admin_0_antarctic_claims USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_admin_0_boundary_lines_disputed_areas_gix ON ne_10m_admin_0_boundary_lines_disputed_areas USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_admin_0_boundary_lines_land_gix ON ne_10m_admin_0_boundary_lines_land USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_admin_0_boundary_lines_map_units_gix ON ne_10m_admin_0_boundary_lines_map_units USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_admin_0_boundary_lines_maritime_indicator_gix ON ne_10m_admin_0_boundary_lines_maritime_indicator USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_admin_0_countries_gix ON ne_10m_admin_0_countries USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_admin_0_countries_lakes_gix ON ne_10m_admin_0_countries_lakes USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_admin_0_disputed_areas_gix ON ne_10m_admin_0_disputed_areas USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_admin_0_disputed_areas_scale_rank_minor_islands_gix ON ne_10m_admin_0_disputed_areas_scale_rank_minor_islands USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_admin_0_label_points_gix ON ne_10m_admin_0_label_points USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_admin_0_map_subunits_gix ON ne_10m_admin_0_map_subunits USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_admin_0_map_units_gix ON ne_10m_admin_0_map_units USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_admin_0_pacific_groupings_gix ON ne_10m_admin_0_pacific_groupings USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_admin_0_scale_rank_gix ON ne_10m_admin_0_scale_rank USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_admin_0_scale_rank_minor_islands_gix ON ne_10m_admin_0_scale_rank_minor_islands USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_admin_0_seams_gix ON ne_10m_admin_0_seams USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_admin_0_sovereignty_gix ON ne_10m_admin_0_sovereignty USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_admin_1_label_points_details_gix ON ne_10m_admin_1_label_points_details USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_admin_1_label_points_gix ON ne_10m_admin_1_label_points USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_admin_1_seams_gix ON ne_10m_admin_1_seams USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_admin_1_states_provinces_gix ON ne_10m_admin_1_states_provinces USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_admin_1_states_provinces_lakes_gix ON ne_10m_admin_1_states_provinces_lakes USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_admin_1_states_provinces_lines_gix ON ne_10m_admin_1_states_provinces_lines USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_admin_1_states_provinces_scale_rank_gix ON ne_10m_admin_1_states_provinces_scale_rank USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_admin_1_states_provinces_scale_rank_minor_islands_gix ON ne_10m_admin_1_states_provinces_scale_rank_minor_islands USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_airports_gix ON ne_10m_airports USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_antarctic_ice_shelves_lines_gix ON ne_10m_antarctic_ice_shelves_lines USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_antarctic_ice_shelves_polys_gix ON ne_10m_antarctic_ice_shelves_polys USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_coastline_gix ON ne_10m_coastline USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_geographic_lines_gix ON ne_10m_geographic_lines USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_geography_marine_polys_gix ON ne_10m_geography_marine_polys USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_geography_regions_elevation_points_gix ON ne_10m_geography_regions_elevation_points USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_geography_regions_points_gix ON ne_10m_geography_regions_points USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_geography_regions_polys_gix ON ne_10m_geography_regions_polys USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_glaciated_areas_gix ON ne_10m_glaciated_areas USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_lakes_europe_gix ON ne_10m_lakes_europe USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_lakes_gix ON ne_10m_lakes USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_lakes_historic_gix ON ne_10m_lakes_historic USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_lakes_north_america_gix ON ne_10m_lakes_north_america USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_lakes_pluvial_gix ON ne_10m_lakes_pluvial USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_land_gix ON ne_10m_land USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_land_ocean_label_points_gix ON ne_10m_land_ocean_label_points USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_land_ocean_seams_gix ON ne_10m_land_ocean_seams USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_land_scale_rank_gix ON ne_10m_land_scale_rank USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_minor_islands_coastline_gix ON ne_10m_minor_islands_coastline USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_minor_islands_gix ON ne_10m_minor_islands USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_minor_islands_label_points_gix ON ne_10m_minor_islands_label_points USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_ocean_gix ON ne_10m_ocean USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_ocean_scale_rank_gix ON ne_10m_ocean_scale_rank USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_parks_and_protected_lands_area_gix ON ne_10m_parks_and_protected_lands_area USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_parks_and_protected_lands_line_gix ON ne_10m_parks_and_protected_lands_line USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_parks_and_protected_lands_point_gix ON ne_10m_parks_and_protected_lands_point USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_parks_and_protected_lands_scale_rank_gix ON ne_10m_parks_and_protected_lands_scale_rank USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_playas_gix ON ne_10m_playas USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_populated_places_gix ON ne_10m_populated_places USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_populated_places_simple_gix ON ne_10m_populated_places_simple USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_ports_gix ON ne_10m_ports USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_railroads_gix ON ne_10m_railroads USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_railroads_north_america_gix ON ne_10m_railroads_north_america USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_reefs_gix ON ne_10m_reefs USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_rivers_europe_gix ON ne_10m_rivers_europe USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_rivers_lake_centerlines_gix ON ne_10m_rivers_lake_centerlines USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_rivers_lake_centerlines_scale_rank_gix ON ne_10m_rivers_lake_centerlines_scale_rank USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_rivers_north_america_gix ON ne_10m_rivers_north_america USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_roads_gix ON ne_10m_roads USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_roads_north_america_gix ON ne_10m_roads_north_america USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_time_zones_gix ON ne_10m_time_zones USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_urban_areas_gix ON ne_10m_urban_areas USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_10m_urban_areas_landscan_gix ON ne_10m_urban_areas_landscan USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_110m_admin_0_boundary_lines_land_gix ON ne_110m_admin_0_boundary_lines_land USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_110m_admin_0_countries_gix ON ne_110m_admin_0_countries USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_110m_admin_0_countries_lakes_gix ON ne_110m_admin_0_countries_lakes USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_110m_admin_0_map_units_gix ON ne_110m_admin_0_map_units USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_110m_admin_0_pacific_groupings_gix ON ne_110m_admin_0_pacific_groupings USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_110m_admin_0_scale_rank_gix ON ne_110m_admin_0_scale_rank USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_110m_admin_0_sovereignty_gix ON ne_110m_admin_0_sovereignty USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_110m_admin_0_tiny_countries_gix ON ne_110m_admin_0_tiny_countries USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_110m_admin_1_states_provinces_gix ON ne_110m_admin_1_states_provinces USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_110m_admin_1_states_provinces_lakes_gix ON ne_110m_admin_1_states_provinces_lakes USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_110m_admin_1_states_provinces_lines_gix ON ne_110m_admin_1_states_provinces_lines USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_110m_admin_1_states_provinces_scale_rank_gix ON ne_110m_admin_1_states_provinces_scale_rank USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_110m_coastline_gix ON ne_110m_coastline USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_110m_geographic_lines_gix ON ne_110m_geographic_lines USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_110m_geography_marine_polys_gix ON ne_110m_geography_marine_polys USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_110m_geography_regions_elevation_points_gix ON ne_110m_geography_regions_elevation_points USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_110m_geography_regions_points_gix ON ne_110m_geography_regions_points USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_110m_geography_regions_polys_gix ON ne_110m_geography_regions_polys USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_110m_glaciated_areas_gix ON ne_110m_glaciated_areas USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_110m_lakes_gix ON ne_110m_lakes USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_110m_land_gix ON ne_110m_land USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_110m_ocean_gix ON ne_110m_ocean USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_110m_populated_places_gix ON ne_110m_populated_places USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_110m_populated_places_simple_gix ON ne_110m_populated_places_simple USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_110m_rivers_lake_centerlines_gix ON ne_110m_rivers_lake_centerlines USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_admin_0_boundary_lines_disputed_areas_gix ON ne_50m_admin_0_boundary_lines_disputed_areas USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_admin_0_boundary_lines_land_gix ON ne_50m_admin_0_boundary_lines_land USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_admin_0_boundary_lines_maritime_indicator_gix ON ne_50m_admin_0_boundary_lines_maritime_indicator USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_admin_0_boundary_map_units_gix ON ne_50m_admin_0_boundary_map_units USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_admin_0_breakaway_disputed_areas_gix ON ne_50m_admin_0_breakaway_disputed_areas USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_admin_0_breakaway_disputed_areas_scale_rank_gix ON ne_50m_admin_0_breakaway_disputed_areas_scale_rank USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_admin_0_countries_gix ON ne_50m_admin_0_countries USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_admin_0_countries_lakes_gix ON ne_50m_admin_0_countries_lakes USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_admin_0_map_subunits_gix ON ne_50m_admin_0_map_subunits USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_admin_0_map_units_gix ON ne_50m_admin_0_map_units USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_admin_0_pacific_groupings_gix ON ne_50m_admin_0_pacific_groupings USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_admin_0_scale_rank_gix ON ne_50m_admin_0_scale_rank USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_admin_0_sovereignty_gix ON ne_50m_admin_0_sovereignty USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_admin_0_tiny_countries_gix ON ne_50m_admin_0_tiny_countries USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_admin_0_tiny_countries_scale_rank_gix ON ne_50m_admin_0_tiny_countries_scale_rank USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_admin_1_states_provinces_gix ON ne_50m_admin_1_states_provinces USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_admin_1_states_provinces_lakes_gix ON ne_50m_admin_1_states_provinces_lakes USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_admin_1_states_provinces_lines_gix ON ne_50m_admin_1_states_provinces_lines USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_admin_1_states_provinces_scale_rank_gix ON ne_50m_admin_1_states_provinces_scale_rank USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_airports_gix ON ne_50m_airports USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_antarctic_ice_shelves_lines_gix ON ne_50m_antarctic_ice_shelves_lines USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_antarctic_ice_shelves_polys_gix ON ne_50m_antarctic_ice_shelves_polys USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_coastline_gix ON ne_50m_coastline USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_geographic_lines_gix ON ne_50m_geographic_lines USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_geography_marine_polys_gix ON ne_50m_geography_marine_polys USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_geography_regions_elevation_points_gix ON ne_50m_geography_regions_elevation_points USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_geography_regions_points_gix ON ne_50m_geography_regions_points USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_geography_regions_polys_gix ON ne_50m_geography_regions_polys USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_glaciated_areas_gix ON ne_50m_glaciated_areas USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_lakes_gix ON ne_50m_lakes USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_lakes_historic_gix ON ne_50m_lakes_historic USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_land_gix ON ne_50m_land USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_ocean_gix ON ne_50m_ocean USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_playas_gix ON ne_50m_playas USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_populated_places_gix ON ne_50m_populated_places USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_populated_places_simple_gix ON ne_50m_populated_places_simple USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_ports_gix ON ne_50m_ports USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_rivers_lake_centerlines_gix ON ne_50m_rivers_lake_centerlines USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_rivers_lake_centerlines_scale_rank_gix ON ne_50m_rivers_lake_centerlines_scale_rank USING SPGIST(geom);
-CREATE INDEX IF NOT EXISTS ne_50m_urban_areas_gix ON ne_50m_urban_areas USING SPGIST(geom);
+CREATE
+ INDEX IF NOT EXISTS ne_10m_admin_0_antarctic_claim_limit_lines_gix ON
+ ne_10m_admin_0_antarctic_claim_limit_lines
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_10m_admin_0_antarctic_claims_gix ON
+ ne_10m_admin_0_antarctic_claims
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_10m_admin_0_boundary_lines_disputed_areas_gix ON
+ ne_10m_admin_0_boundary_lines_disputed_areas
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_10m_admin_0_boundary_lines_land_gix ON
+ ne_10m_admin_0_boundary_lines_land
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_10m_admin_0_boundary_lines_map_units_gix ON
+ ne_10m_admin_0_boundary_lines_map_units
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_10m_admin_0_boundary_lines_maritime_indicator_gix ON
+ ne_10m_admin_0_boundary_lines_maritime_indicator
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_10m_admin_0_countries_gix ON
+ ne_10m_admin_0_countries
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_10m_admin_0_countries_lakes_gix ON
+ ne_10m_admin_0_countries_lakes
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_10m_admin_0_disputed_areas_gix ON
+ ne_10m_admin_0_disputed_areas
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_10m_admin_0_disputed_areas_scale_rank_minor_islands_gix ON
+ ne_10m_admin_0_disputed_areas_scale_rank_minor_islands
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_10m_admin_0_label_points_gix ON
+ ne_10m_admin_0_label_points
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_10m_admin_0_map_subunits_gix ON
+ ne_10m_admin_0_map_subunits
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_10m_admin_0_map_units_gix ON
+ ne_10m_admin_0_map_units
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_10m_admin_0_pacific_groupings_gix ON
+ ne_10m_admin_0_pacific_groupings
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_10m_admin_0_scale_rank_gix ON
+ ne_10m_admin_0_scale_rank
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_10m_admin_0_scale_rank_minor_islands_gix ON
+ ne_10m_admin_0_scale_rank_minor_islands
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_10m_admin_0_seams_gix ON
+ ne_10m_admin_0_seams
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_10m_admin_0_sovereignty_gix ON
+ ne_10m_admin_0_sovereignty
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_10m_admin_1_label_points_details_gix ON
+ ne_10m_admin_1_label_points_details
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_10m_admin_1_label_points_gix ON
+ ne_10m_admin_1_label_points
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_10m_admin_1_seams_gix ON
+ ne_10m_admin_1_seams
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_10m_admin_1_states_provinces_gix ON
+ ne_10m_admin_1_states_provinces
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_10m_admin_1_states_provinces_lakes_gix ON
+ ne_10m_admin_1_states_provinces_lakes
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_10m_admin_1_states_provinces_lines_gix ON
+ ne_10m_admin_1_states_provinces_lines
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_10m_admin_1_states_provinces_scale_rank_gix ON
+ ne_10m_admin_1_states_provinces_scale_rank
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_10m_admin_1_states_provinces_scale_rank_minor_islands_gix ON
+ ne_10m_admin_1_states_provinces_scale_rank_minor_islands
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_10m_airports_gix ON
+ ne_10m_airports
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_10m_antarctic_ice_shelves_lines_gix ON
+ ne_10m_antarctic_ice_shelves_lines
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_10m_antarctic_ice_shelves_polys_gix ON
+ ne_10m_antarctic_ice_shelves_polys
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_10m_coastline_gix ON
+ ne_10m_coastline
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_10m_geographic_lines_gix ON
+ ne_10m_geographic_lines
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_10m_geography_marine_polys_gix ON
+ ne_10m_geography_marine_polys
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_10m_geography_regions_elevation_points_gix ON
+ ne_10m_geography_regions_elevation_points
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_10m_geography_regions_points_gix ON
+ ne_10m_geography_regions_points
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_10m_geography_regions_polys_gix ON
+ ne_10m_geography_regions_polys
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_10m_glaciated_areas_gix ON
+ ne_10m_glaciated_areas
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_10m_lakes_europe_gix ON
+ ne_10m_lakes_europe
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_10m_lakes_gix ON
+ ne_10m_lakes
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_10m_lakes_historic_gix ON
+ ne_10m_lakes_historic
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_10m_lakes_north_america_gix ON
+ ne_10m_lakes_north_america
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_10m_lakes_pluvial_gix ON
+ ne_10m_lakes_pluvial
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_10m_land_gix ON
+ ne_10m_land
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_10m_land_ocean_label_points_gix ON
+ ne_10m_land_ocean_label_points
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_10m_land_ocean_seams_gix ON
+ ne_10m_land_ocean_seams
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_10m_land_scale_rank_gix ON
+ ne_10m_land_scale_rank
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_10m_minor_islands_coastline_gix ON
+ ne_10m_minor_islands_coastline
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_10m_minor_islands_gix ON
+ ne_10m_minor_islands
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_10m_minor_islands_label_points_gix ON
+ ne_10m_minor_islands_label_points
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_10m_ocean_gix ON
+ ne_10m_ocean
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_10m_ocean_scale_rank_gix ON
+ ne_10m_ocean_scale_rank
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_10m_parks_and_protected_lands_area_gix ON
+ ne_10m_parks_and_protected_lands_area
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_10m_parks_and_protected_lands_line_gix ON
+ ne_10m_parks_and_protected_lands_line
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_10m_parks_and_protected_lands_point_gix ON
+ ne_10m_parks_and_protected_lands_point
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_10m_parks_and_protected_lands_scale_rank_gix ON
+ ne_10m_parks_and_protected_lands_scale_rank
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_10m_playas_gix ON
+ ne_10m_playas
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_10m_populated_places_gix ON
+ ne_10m_populated_places
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_10m_populated_places_simple_gix ON
+ ne_10m_populated_places_simple
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_10m_ports_gix ON
+ ne_10m_ports
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_10m_railroads_gix ON
+ ne_10m_railroads
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_10m_railroads_north_america_gix ON
+ ne_10m_railroads_north_america
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_10m_reefs_gix ON
+ ne_10m_reefs
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_10m_rivers_europe_gix ON
+ ne_10m_rivers_europe
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_10m_rivers_lake_centerlines_gix ON
+ ne_10m_rivers_lake_centerlines
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_10m_rivers_lake_centerlines_scale_rank_gix ON
+ ne_10m_rivers_lake_centerlines_scale_rank
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_10m_rivers_north_america_gix ON
+ ne_10m_rivers_north_america
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_10m_roads_gix ON
+ ne_10m_roads
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_10m_roads_north_america_gix ON
+ ne_10m_roads_north_america
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_10m_time_zones_gix ON
+ ne_10m_time_zones
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_10m_urban_areas_gix ON
+ ne_10m_urban_areas
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_10m_urban_areas_landscan_gix ON
+ ne_10m_urban_areas_landscan
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_110m_admin_0_boundary_lines_land_gix ON
+ ne_110m_admin_0_boundary_lines_land
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_110m_admin_0_countries_gix ON
+ ne_110m_admin_0_countries
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_110m_admin_0_countries_lakes_gix ON
+ ne_110m_admin_0_countries_lakes
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_110m_admin_0_map_units_gix ON
+ ne_110m_admin_0_map_units
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_110m_admin_0_pacific_groupings_gix ON
+ ne_110m_admin_0_pacific_groupings
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_110m_admin_0_scale_rank_gix ON
+ ne_110m_admin_0_scale_rank
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_110m_admin_0_sovereignty_gix ON
+ ne_110m_admin_0_sovereignty
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_110m_admin_0_tiny_countries_gix ON
+ ne_110m_admin_0_tiny_countries
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_110m_admin_1_states_provinces_gix ON
+ ne_110m_admin_1_states_provinces
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_110m_admin_1_states_provinces_lakes_gix ON
+ ne_110m_admin_1_states_provinces_lakes
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_110m_admin_1_states_provinces_lines_gix ON
+ ne_110m_admin_1_states_provinces_lines
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_110m_admin_1_states_provinces_scale_rank_gix ON
+ ne_110m_admin_1_states_provinces_scale_rank
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_110m_coastline_gix ON
+ ne_110m_coastline
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_110m_geographic_lines_gix ON
+ ne_110m_geographic_lines
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_110m_geography_marine_polys_gix ON
+ ne_110m_geography_marine_polys
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_110m_geography_regions_elevation_points_gix ON
+ ne_110m_geography_regions_elevation_points
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_110m_geography_regions_points_gix ON
+ ne_110m_geography_regions_points
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_110m_geography_regions_polys_gix ON
+ ne_110m_geography_regions_polys
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_110m_glaciated_areas_gix ON
+ ne_110m_glaciated_areas
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_110m_lakes_gix ON
+ ne_110m_lakes
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_110m_land_gix ON
+ ne_110m_land
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_110m_ocean_gix ON
+ ne_110m_ocean
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_110m_populated_places_gix ON
+ ne_110m_populated_places
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_110m_populated_places_simple_gix ON
+ ne_110m_populated_places_simple
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_110m_rivers_lake_centerlines_gix ON
+ ne_110m_rivers_lake_centerlines
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_50m_admin_0_boundary_lines_disputed_areas_gix ON
+ ne_50m_admin_0_boundary_lines_disputed_areas
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_50m_admin_0_boundary_lines_land_gix ON
+ ne_50m_admin_0_boundary_lines_land
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_50m_admin_0_boundary_lines_maritime_indicator_gix ON
+ ne_50m_admin_0_boundary_lines_maritime_indicator
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_50m_admin_0_boundary_map_units_gix ON
+ ne_50m_admin_0_boundary_map_units
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_50m_admin_0_breakaway_disputed_areas_gix ON
+ ne_50m_admin_0_breakaway_disputed_areas
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_50m_admin_0_breakaway_disputed_areas_scale_rank_gix ON
+ ne_50m_admin_0_breakaway_disputed_areas_scale_rank
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_50m_admin_0_countries_gix ON
+ ne_50m_admin_0_countries
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_50m_admin_0_countries_lakes_gix ON
+ ne_50m_admin_0_countries_lakes
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_50m_admin_0_map_subunits_gix ON
+ ne_50m_admin_0_map_subunits
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_50m_admin_0_map_units_gix ON
+ ne_50m_admin_0_map_units
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_50m_admin_0_pacific_groupings_gix ON
+ ne_50m_admin_0_pacific_groupings
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_50m_admin_0_scale_rank_gix ON
+ ne_50m_admin_0_scale_rank
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_50m_admin_0_sovereignty_gix ON
+ ne_50m_admin_0_sovereignty
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_50m_admin_0_tiny_countries_gix ON
+ ne_50m_admin_0_tiny_countries
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_50m_admin_0_tiny_countries_scale_rank_gix ON
+ ne_50m_admin_0_tiny_countries_scale_rank
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_50m_admin_1_states_provinces_gix ON
+ ne_50m_admin_1_states_provinces
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_50m_admin_1_states_provinces_lakes_gix ON
+ ne_50m_admin_1_states_provinces_lakes
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_50m_admin_1_states_provinces_lines_gix ON
+ ne_50m_admin_1_states_provinces_lines
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_50m_admin_1_states_provinces_scale_rank_gix ON
+ ne_50m_admin_1_states_provinces_scale_rank
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_50m_airports_gix ON
+ ne_50m_airports
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_50m_antarctic_ice_shelves_lines_gix ON
+ ne_50m_antarctic_ice_shelves_lines
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_50m_antarctic_ice_shelves_polys_gix ON
+ ne_50m_antarctic_ice_shelves_polys
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_50m_coastline_gix ON
+ ne_50m_coastline
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_50m_geographic_lines_gix ON
+ ne_50m_geographic_lines
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_50m_geography_marine_polys_gix ON
+ ne_50m_geography_marine_polys
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_50m_geography_regions_elevation_points_gix ON
+ ne_50m_geography_regions_elevation_points
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_50m_geography_regions_points_gix ON
+ ne_50m_geography_regions_points
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_50m_geography_regions_polys_gix ON
+ ne_50m_geography_regions_polys
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_50m_glaciated_areas_gix ON
+ ne_50m_glaciated_areas
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_50m_lakes_gix ON
+ ne_50m_lakes
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_50m_lakes_historic_gix ON
+ ne_50m_lakes_historic
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_50m_land_gix ON
+ ne_50m_land
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_50m_ocean_gix ON
+ ne_50m_ocean
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_50m_playas_gix ON
+ ne_50m_playas
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_50m_populated_places_gix ON
+ ne_50m_populated_places
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_50m_populated_places_simple_gix ON
+ ne_50m_populated_places_simple
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_50m_ports_gix ON
+ ne_50m_ports
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_50m_rivers_lake_centerlines_gix ON
+ ne_50m_rivers_lake_centerlines
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_50m_rivers_lake_centerlines_scale_rank_gix ON
+ ne_50m_rivers_lake_centerlines_scale_rank
+ USING SPGIST(geom);
+
+CREATE
+ INDEX IF NOT EXISTS ne_50m_urban_areas_gix ON
+ ne_50m_urban_areas
+ USING SPGIST(geom);
diff --git a/examples/openstreetmap/indexes.sql b/examples/openstreetmap/indexes.sql
index b46089ddc..c59d73f79 100644
--- a/examples/openstreetmap/indexes.sql
+++ b/examples/openstreetmap/indexes.sql
@@ -12,8 +12,27 @@
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-CREATE INDEX CONCURRENTLY IF NOT EXISTS osm_ways_gin ON osm_ways USING gin (nodes);
-CREATE INDEX CONCURRENTLY IF NOT EXISTS osm_relations_gin ON osm_relations USING gin (member_refs);
-CREATE INDEX CONCURRENTLY IF NOT EXISTS osm_nodes_gix ON osm_nodes USING GIST (geom);
-CREATE INDEX CONCURRENTLY IF NOT EXISTS osm_ways_gix ON osm_ways USING GIST (geom);
-CREATE INDEX CONCURRENTLY IF NOT EXISTS osm_relations_gix ON osm_relations USING GIST (geom);
\ No newline at end of file
+CREATE
+ INDEX CONCURRENTLY IF NOT EXISTS osm_way_gin ON
+ osm_way
+ USING gin(nodes);
+
+CREATE
+ INDEX CONCURRENTLY IF NOT EXISTS osm_relation_gin ON
+ osm_relation
+ USING gin(member_refs);
+
+CREATE
+ INDEX CONCURRENTLY IF NOT EXISTS osm_node_gix ON
+ osm_node
+ USING GIST(geom);
+
+CREATE
+ INDEX CONCURRENTLY IF NOT EXISTS osm_way_gix ON
+ osm_way
+ USING GIST(geom);
+
+CREATE
+ INDEX CONCURRENTLY IF NOT EXISTS osm_relation_gix ON
+ osm_relation
+ USING GIST(geom);
\ No newline at end of file
diff --git a/examples/openstreetmap/tiles.json b/examples/openstreetmap/tiles.json
index 51650f832..45b69a44a 100644
--- a/examples/openstreetmap/tiles.json
+++ b/examples/openstreetmap/tiles.json
@@ -1 +1 @@
-{"tilejson":"2.2.0","tiles":["http://localhost:9000/tiles/{z}/{x}/{y}.mvt"],"minzoom":12,"maxzoom":14,"bounds":[9.471078,47.04774,9.636217,47.27128],"center":[9.5554,47.166,14.0],"database":"jdbc:postgresql://localhost:5432/baremaps?&user=baremaps&password=baremaps","vector_layers":[{"id":"aeroway","queries":[{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'aeroway'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_ways WHERE tags ? 'aeroway'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_relations WHERE tags ? 'aeroway' AND tags ->> 'type' = 'multipolygon'"}]},{"id":"waterway","queries":[{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'waterway'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_ways WHERE tags ? 'waterway'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_relations WHERE tags ? 'waterway' AND tags ->> 'type' = 'multipolygon'"}]},{"id":"landuse","queries":[{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'landuse'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_ways WHERE tags ? 'landuse'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_relations WHERE tags ? 'landuse' AND tags ->> 'type' = 'multipolygon'"}]},{"id":"railway","queries":[{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'railway'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_ways WHERE tags ? 'railway'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_relations WHERE tags ? 'railway' AND tags ->> 'type' = 'multipolygon'"}]},{"id":"highway","queries":[{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'highway'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_ways WHERE tags ? 'highway'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_relations WHERE tags ? 'highway' AND tags ->> 'type' = 'multipolygon'"}]},{"id":"public_transport","queries":[{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'public_transport'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_ways WHERE tags ? 'public_transport'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_relations WHERE tags ? 'public_transport' AND tags ->> 'type' = 'multipolygon'"}]},{"id":"aerialway","queries":[{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'aerialway'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_ways WHERE tags ? 'aerialway'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_relations WHERE tags ? 'aerialway' AND tags ->> 'type' = 'multipolygon'"}]},{"id":"geological","queries":[{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'geological'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_ways WHERE tags ? 'geological'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_relations WHERE tags ? 'geological' AND tags ->> 'type' = 'multipolygon'"}]},{"id":"building","queries":[{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'building'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_ways WHERE tags ? 'building'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_relations WHERE tags ? 'building' AND tags ->> 'type' = 'multipolygon'"}]},{"id":"amenity","queries":[{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'amenity'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_ways WHERE tags ? 'amenity'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_relations WHERE tags ? 'amenity' AND tags ->> 'type' = 'multipolygon'"}]},{"id":"craft","queries":[{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'craft'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_ways WHERE tags ? 'craft'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_relations WHERE tags ? 'craft' AND tags ->> 'type' = 'multipolygon'"}]},{"id":"emergency","queries":[{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'emergency'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_ways WHERE tags ? 'emergency'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_relations WHERE tags ? 'emergency' AND tags ->> 'type' = 'multipolygon'"}]},{"id":"historic","queries":[{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'historic'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_ways WHERE tags ? 'historic'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_relations WHERE tags ? 'historic' AND tags ->> 'type' = 'multipolygon'"}]},{"id":"leisure","queries":[{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'leisure'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_ways WHERE tags ? 'leisure'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_relations WHERE tags ? 'leisure' AND tags ->> 'type' = 'multipolygon'"}]},{"id":"man_made","queries":[{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'man_made'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_ways WHERE tags ? 'man_made'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_relations WHERE tags ? 'man_made' AND tags ->> 'type' = 'multipolygon'"}]},{"id":"military","queries":[{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'military'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_ways WHERE tags ? 'military'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_relations WHERE tags ? 'military' AND tags ->> 'type' = 'multipolygon'"}]},{"id":"natural","queries":[{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'natural'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_ways WHERE tags ? 'natural'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_relations WHERE tags ? 'natural' AND tags ->> 'type' = 'multipolygon'"}]},{"id":"office","queries":[{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'office'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_ways WHERE tags ? 'office'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_relations WHERE tags ? 'office' AND tags ->> 'type' = 'multipolygon'"}]},{"id":"place","queries":[{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'place'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_ways WHERE tags ? 'place'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_relations WHERE tags ? 'place' AND tags ->> 'type' = 'multipolygon'"}]},{"id":"power","queries":[{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'power'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_ways WHERE tags ? 'power'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_relations WHERE tags ? 'power' AND tags ->> 'type' = 'multipolygon'"}]},{"id":"route","queries":[{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'route'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_ways WHERE tags ? 'route'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_relations WHERE tags ? 'route' AND tags ->> 'type' = 'multipolygon'"}]},{"id":"shop","queries":[{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'shop'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_ways WHERE tags ? 'shop'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_relations WHERE tags ? 'shop' AND tags ->> 'type' = 'multipolygon'"}]},{"id":"sport","queries":[{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'sport'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_ways WHERE tags ? 'sport'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_relations WHERE tags ? 'sport' AND tags ->> 'type' = 'multipolygon'"}]},{"id":"telecom","queries":[{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'telecom'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_ways WHERE tags ? 'telecom'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_relations WHERE tags ? 'telecom' AND tags ->> 'type' = 'multipolygon'"}]},{"id":"tourism","queries":[{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'tourism'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_ways WHERE tags ? 'tourism'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_relations WHERE tags ? 'tourism' AND tags ->> 'type' = 'multipolygon'"}]}]}
\ No newline at end of file
+{"tilejson":"2.2.0","tiles":["http://localhost:9000/tiles/{z}/{x}/{y}.mvt"],"minzoom":12,"maxzoom":14,"bounds":[9.471078,47.04774,9.636217,47.27128],"center":[9.5554,47.166,14.0],"database":"jdbc:postgresql://localhost:5432/baremaps?&user=baremaps&password=baremaps","vector_layers":[{"id":"aeroway","queries":[{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_node WHERE tags ? 'aeroway'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_way WHERE tags ? 'aeroway'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_relation WHERE tags ? 'aeroway' AND tags ->> 'type' = 'multipolygon'"}]},{"id":"waterway","queries":[{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_node WHERE tags ? 'waterway'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_way WHERE tags ? 'waterway'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_relation WHERE tags ? 'waterway' AND tags ->> 'type' = 'multipolygon'"}]},{"id":"landuse","queries":[{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_node WHERE tags ? 'landuse'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_way WHERE tags ? 'landuse'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_relation WHERE tags ? 'landuse' AND tags ->> 'type' = 'multipolygon'"}]},{"id":"railway","queries":[{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_node WHERE tags ? 'railway'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_way WHERE tags ? 'railway'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_relation WHERE tags ? 'railway' AND tags ->> 'type' = 'multipolygon'"}]},{"id":"highway","queries":[{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_node WHERE tags ? 'highway'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_way WHERE tags ? 'highway'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_relation WHERE tags ? 'highway' AND tags ->> 'type' = 'multipolygon'"}]},{"id":"public_transport","queries":[{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_node WHERE tags ? 'public_transport'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_way WHERE tags ? 'public_transport'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_relation WHERE tags ? 'public_transport' AND tags ->> 'type' = 'multipolygon'"}]},{"id":"aerialway","queries":[{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_node WHERE tags ? 'aerialway'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_way WHERE tags ? 'aerialway'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_relation WHERE tags ? 'aerialway' AND tags ->> 'type' = 'multipolygon'"}]},{"id":"geological","queries":[{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_node WHERE tags ? 'geological'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_way WHERE tags ? 'geological'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_relation WHERE tags ? 'geological' AND tags ->> 'type' = 'multipolygon'"}]},{"id":"building","queries":[{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_node WHERE tags ? 'building'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_way WHERE tags ? 'building'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_relation WHERE tags ? 'building' AND tags ->> 'type' = 'multipolygon'"}]},{"id":"amenity","queries":[{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_node WHERE tags ? 'amenity'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_way WHERE tags ? 'amenity'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_relation WHERE tags ? 'amenity' AND tags ->> 'type' = 'multipolygon'"}]},{"id":"craft","queries":[{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_node WHERE tags ? 'craft'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_way WHERE tags ? 'craft'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_relation WHERE tags ? 'craft' AND tags ->> 'type' = 'multipolygon'"}]},{"id":"emergency","queries":[{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_node WHERE tags ? 'emergency'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_way WHERE tags ? 'emergency'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_relation WHERE tags ? 'emergency' AND tags ->> 'type' = 'multipolygon'"}]},{"id":"historic","queries":[{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_node WHERE tags ? 'historic'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_way WHERE tags ? 'historic'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_relation WHERE tags ? 'historic' AND tags ->> 'type' = 'multipolygon'"}]},{"id":"leisure","queries":[{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_node WHERE tags ? 'leisure'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_way WHERE tags ? 'leisure'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_relation WHERE tags ? 'leisure' AND tags ->> 'type' = 'multipolygon'"}]},{"id":"man_made","queries":[{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_node WHERE tags ? 'man_made'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_way WHERE tags ? 'man_made'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_relation WHERE tags ? 'man_made' AND tags ->> 'type' = 'multipolygon'"}]},{"id":"military","queries":[{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_node WHERE tags ? 'military'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_way WHERE tags ? 'military'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_relation WHERE tags ? 'military' AND tags ->> 'type' = 'multipolygon'"}]},{"id":"natural","queries":[{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_node WHERE tags ? 'natural'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_way WHERE tags ? 'natural'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_relation WHERE tags ? 'natural' AND tags ->> 'type' = 'multipolygon'"}]},{"id":"office","queries":[{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_node WHERE tags ? 'office'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_way WHERE tags ? 'office'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_relation WHERE tags ? 'office' AND tags ->> 'type' = 'multipolygon'"}]},{"id":"place","queries":[{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_node WHERE tags ? 'place'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_way WHERE tags ? 'place'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_relation WHERE tags ? 'place' AND tags ->> 'type' = 'multipolygon'"}]},{"id":"power","queries":[{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_node WHERE tags ? 'power'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_way WHERE tags ? 'power'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_relation WHERE tags ? 'power' AND tags ->> 'type' = 'multipolygon'"}]},{"id":"route","queries":[{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_node WHERE tags ? 'route'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_way WHERE tags ? 'route'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_relation WHERE tags ? 'route' AND tags ->> 'type' = 'multipolygon'"}]},{"id":"shop","queries":[{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_node WHERE tags ? 'shop'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_way WHERE tags ? 'shop'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_relation WHERE tags ? 'shop' AND tags ->> 'type' = 'multipolygon'"}]},{"id":"sport","queries":[{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_node WHERE tags ? 'sport'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_way WHERE tags ? 'sport'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_relation WHERE tags ? 'sport' AND tags ->> 'type' = 'multipolygon'"}]},{"id":"telecom","queries":[{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_node WHERE tags ? 'telecom'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_way WHERE tags ? 'telecom'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_relation WHERE tags ? 'telecom' AND tags ->> 'type' = 'multipolygon'"}]},{"id":"tourism","queries":[{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_node WHERE tags ? 'tourism'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_way WHERE tags ? 'tourism'"},{"minzoom":12,"maxzoom":20,"sql":"SELECT id, tags, geom FROM osm_relation WHERE tags ? 'tourism' AND tags ->> 'type' = 'multipolygon'"}]}]}
\ No newline at end of file
diff --git a/examples/openstreetmap/tileset.json b/examples/openstreetmap/tileset.json
index 8d0c82382..b7b16fae5 100644
--- a/examples/openstreetmap/tileset.json
+++ b/examples/openstreetmap/tileset.json
@@ -24,17 +24,17 @@
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'aeroway'"
+ "sql": "SELECT id, tags, geom FROM osm_node WHERE tags ? 'aeroway'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_ways WHERE tags ? 'aeroway'"
+ "sql": "SELECT id, tags, geom FROM osm_way WHERE tags ? 'aeroway'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_relations WHERE tags ? 'aeroway' AND tags ->> 'type' = 'multipolygon'"
+ "sql": "SELECT id, tags, geom FROM osm_relation WHERE tags ? 'aeroway' AND tags ->> 'type' = 'multipolygon'"
}
]
},
@@ -44,17 +44,17 @@
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'waterway'"
+ "sql": "SELECT id, tags, geom FROM osm_node WHERE tags ? 'waterway'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_ways WHERE tags ? 'waterway'"
+ "sql": "SELECT id, tags, geom FROM osm_way WHERE tags ? 'waterway'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_relations WHERE tags ? 'waterway' AND tags ->> 'type' = 'multipolygon'"
+ "sql": "SELECT id, tags, geom FROM osm_relation WHERE tags ? 'waterway' AND tags ->> 'type' = 'multipolygon'"
}
]
},
@@ -64,17 +64,17 @@
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'landuse'"
+ "sql": "SELECT id, tags, geom FROM osm_node WHERE tags ? 'landuse'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_ways WHERE tags ? 'landuse'"
+ "sql": "SELECT id, tags, geom FROM osm_way WHERE tags ? 'landuse'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_relations WHERE tags ? 'landuse' AND tags ->> 'type' = 'multipolygon'"
+ "sql": "SELECT id, tags, geom FROM osm_relation WHERE tags ? 'landuse' AND tags ->> 'type' = 'multipolygon'"
}
]
},
@@ -84,17 +84,17 @@
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'railway'"
+ "sql": "SELECT id, tags, geom FROM osm_node WHERE tags ? 'railway'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_ways WHERE tags ? 'railway'"
+ "sql": "SELECT id, tags, geom FROM osm_way WHERE tags ? 'railway'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_relations WHERE tags ? 'railway' AND tags ->> 'type' = 'multipolygon'"
+ "sql": "SELECT id, tags, geom FROM osm_relation WHERE tags ? 'railway' AND tags ->> 'type' = 'multipolygon'"
}
]
},
@@ -104,17 +104,17 @@
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'highway'"
+ "sql": "SELECT id, tags, geom FROM osm_node WHERE tags ? 'highway'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_ways WHERE tags ? 'highway'"
+ "sql": "SELECT id, tags, geom FROM osm_way WHERE tags ? 'highway'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_relations WHERE tags ? 'highway' AND tags ->> 'type' = 'multipolygon'"
+ "sql": "SELECT id, tags, geom FROM osm_relation WHERE tags ? 'highway' AND tags ->> 'type' = 'multipolygon'"
}
]
},
@@ -124,17 +124,17 @@
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'public_transport'"
+ "sql": "SELECT id, tags, geom FROM osm_node WHERE tags ? 'public_transport'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_ways WHERE tags ? 'public_transport'"
+ "sql": "SELECT id, tags, geom FROM osm_way WHERE tags ? 'public_transport'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_relations WHERE tags ? 'public_transport' AND tags ->> 'type' = 'multipolygon'"
+ "sql": "SELECT id, tags, geom FROM osm_relation WHERE tags ? 'public_transport' AND tags ->> 'type' = 'multipolygon'"
}
]
},
@@ -144,17 +144,17 @@
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'aerialway'"
+ "sql": "SELECT id, tags, geom FROM osm_node WHERE tags ? 'aerialway'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_ways WHERE tags ? 'aerialway'"
+ "sql": "SELECT id, tags, geom FROM osm_way WHERE tags ? 'aerialway'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_relations WHERE tags ? 'aerialway' AND tags ->> 'type' = 'multipolygon'"
+ "sql": "SELECT id, tags, geom FROM osm_relation WHERE tags ? 'aerialway' AND tags ->> 'type' = 'multipolygon'"
}
]
},
@@ -164,17 +164,17 @@
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'geological'"
+ "sql": "SELECT id, tags, geom FROM osm_node WHERE tags ? 'geological'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_ways WHERE tags ? 'geological'"
+ "sql": "SELECT id, tags, geom FROM osm_way WHERE tags ? 'geological'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_relations WHERE tags ? 'geological' AND tags ->> 'type' = 'multipolygon'"
+ "sql": "SELECT id, tags, geom FROM osm_relation WHERE tags ? 'geological' AND tags ->> 'type' = 'multipolygon'"
}
]
},
@@ -184,17 +184,17 @@
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'building'"
+ "sql": "SELECT id, tags, geom FROM osm_node WHERE tags ? 'building'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_ways WHERE tags ? 'building'"
+ "sql": "SELECT id, tags, geom FROM osm_way WHERE tags ? 'building'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_relations WHERE tags ? 'building' AND tags ->> 'type' = 'multipolygon'"
+ "sql": "SELECT id, tags, geom FROM osm_relation WHERE tags ? 'building' AND tags ->> 'type' = 'multipolygon'"
}
]
},
@@ -204,17 +204,17 @@
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'amenity'"
+ "sql": "SELECT id, tags, geom FROM osm_node WHERE tags ? 'amenity'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_ways WHERE tags ? 'amenity'"
+ "sql": "SELECT id, tags, geom FROM osm_way WHERE tags ? 'amenity'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_relations WHERE tags ? 'amenity' AND tags ->> 'type' = 'multipolygon'"
+ "sql": "SELECT id, tags, geom FROM osm_relation WHERE tags ? 'amenity' AND tags ->> 'type' = 'multipolygon'"
}
]
},
@@ -224,17 +224,17 @@
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'craft'"
+ "sql": "SELECT id, tags, geom FROM osm_node WHERE tags ? 'craft'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_ways WHERE tags ? 'craft'"
+ "sql": "SELECT id, tags, geom FROM osm_way WHERE tags ? 'craft'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_relations WHERE tags ? 'craft' AND tags ->> 'type' = 'multipolygon'"
+ "sql": "SELECT id, tags, geom FROM osm_relation WHERE tags ? 'craft' AND tags ->> 'type' = 'multipolygon'"
}
]
},
@@ -244,17 +244,17 @@
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'emergency'"
+ "sql": "SELECT id, tags, geom FROM osm_node WHERE tags ? 'emergency'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_ways WHERE tags ? 'emergency'"
+ "sql": "SELECT id, tags, geom FROM osm_way WHERE tags ? 'emergency'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_relations WHERE tags ? 'emergency' AND tags ->> 'type' = 'multipolygon'"
+ "sql": "SELECT id, tags, geom FROM osm_relation WHERE tags ? 'emergency' AND tags ->> 'type' = 'multipolygon'"
}
]
},
@@ -264,17 +264,17 @@
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'historic'"
+ "sql": "SELECT id, tags, geom FROM osm_node WHERE tags ? 'historic'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_ways WHERE tags ? 'historic'"
+ "sql": "SELECT id, tags, geom FROM osm_way WHERE tags ? 'historic'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_relations WHERE tags ? 'historic' AND tags ->> 'type' = 'multipolygon'"
+ "sql": "SELECT id, tags, geom FROM osm_relation WHERE tags ? 'historic' AND tags ->> 'type' = 'multipolygon'"
}
]
},
@@ -284,17 +284,17 @@
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'leisure'"
+ "sql": "SELECT id, tags, geom FROM osm_node WHERE tags ? 'leisure'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_ways WHERE tags ? 'leisure'"
+ "sql": "SELECT id, tags, geom FROM osm_way WHERE tags ? 'leisure'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_relations WHERE tags ? 'leisure' AND tags ->> 'type' = 'multipolygon'"
+ "sql": "SELECT id, tags, geom FROM osm_relation WHERE tags ? 'leisure' AND tags ->> 'type' = 'multipolygon'"
}
]
},
@@ -304,17 +304,17 @@
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'man_made'"
+ "sql": "SELECT id, tags, geom FROM osm_node WHERE tags ? 'man_made'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_ways WHERE tags ? 'man_made'"
+ "sql": "SELECT id, tags, geom FROM osm_way WHERE tags ? 'man_made'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_relations WHERE tags ? 'man_made' AND tags ->> 'type' = 'multipolygon'"
+ "sql": "SELECT id, tags, geom FROM osm_relation WHERE tags ? 'man_made' AND tags ->> 'type' = 'multipolygon'"
}
]
},
@@ -324,17 +324,17 @@
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'military'"
+ "sql": "SELECT id, tags, geom FROM osm_node WHERE tags ? 'military'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_ways WHERE tags ? 'military'"
+ "sql": "SELECT id, tags, geom FROM osm_way WHERE tags ? 'military'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_relations WHERE tags ? 'military' AND tags ->> 'type' = 'multipolygon'"
+ "sql": "SELECT id, tags, geom FROM osm_relation WHERE tags ? 'military' AND tags ->> 'type' = 'multipolygon'"
}
]
},
@@ -344,17 +344,17 @@
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'natural'"
+ "sql": "SELECT id, tags, geom FROM osm_node WHERE tags ? 'natural'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_ways WHERE tags ? 'natural'"
+ "sql": "SELECT id, tags, geom FROM osm_way WHERE tags ? 'natural'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_relations WHERE tags ? 'natural' AND tags ->> 'type' = 'multipolygon'"
+ "sql": "SELECT id, tags, geom FROM osm_relation WHERE tags ? 'natural' AND tags ->> 'type' = 'multipolygon'"
}
]
},
@@ -364,17 +364,17 @@
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'office'"
+ "sql": "SELECT id, tags, geom FROM osm_node WHERE tags ? 'office'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_ways WHERE tags ? 'office'"
+ "sql": "SELECT id, tags, geom FROM osm_way WHERE tags ? 'office'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_relations WHERE tags ? 'office' AND tags ->> 'type' = 'multipolygon'"
+ "sql": "SELECT id, tags, geom FROM osm_relation WHERE tags ? 'office' AND tags ->> 'type' = 'multipolygon'"
}
]
},
@@ -384,17 +384,17 @@
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'place'"
+ "sql": "SELECT id, tags, geom FROM osm_node WHERE tags ? 'place'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_ways WHERE tags ? 'place'"
+ "sql": "SELECT id, tags, geom FROM osm_way WHERE tags ? 'place'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_relations WHERE tags ? 'place' AND tags ->> 'type' = 'multipolygon'"
+ "sql": "SELECT id, tags, geom FROM osm_relation WHERE tags ? 'place' AND tags ->> 'type' = 'multipolygon'"
}
]
},
@@ -404,17 +404,17 @@
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'power'"
+ "sql": "SELECT id, tags, geom FROM osm_node WHERE tags ? 'power'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_ways WHERE tags ? 'power'"
+ "sql": "SELECT id, tags, geom FROM osm_way WHERE tags ? 'power'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_relations WHERE tags ? 'power' AND tags ->> 'type' = 'multipolygon'"
+ "sql": "SELECT id, tags, geom FROM osm_relation WHERE tags ? 'power' AND tags ->> 'type' = 'multipolygon'"
}
]
},
@@ -424,17 +424,17 @@
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'route'"
+ "sql": "SELECT id, tags, geom FROM osm_node WHERE tags ? 'route'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_ways WHERE tags ? 'route'"
+ "sql": "SELECT id, tags, geom FROM osm_way WHERE tags ? 'route'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_relations WHERE tags ? 'route' AND tags ->> 'type' = 'multipolygon'"
+ "sql": "SELECT id, tags, geom FROM osm_relation WHERE tags ? 'route' AND tags ->> 'type' = 'multipolygon'"
}
]
},
@@ -444,17 +444,17 @@
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'shop'"
+ "sql": "SELECT id, tags, geom FROM osm_node WHERE tags ? 'shop'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_ways WHERE tags ? 'shop'"
+ "sql": "SELECT id, tags, geom FROM osm_way WHERE tags ? 'shop'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_relations WHERE tags ? 'shop' AND tags ->> 'type' = 'multipolygon'"
+ "sql": "SELECT id, tags, geom FROM osm_relation WHERE tags ? 'shop' AND tags ->> 'type' = 'multipolygon'"
}
]
},
@@ -464,17 +464,17 @@
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'sport'"
+ "sql": "SELECT id, tags, geom FROM osm_node WHERE tags ? 'sport'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_ways WHERE tags ? 'sport'"
+ "sql": "SELECT id, tags, geom FROM osm_way WHERE tags ? 'sport'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_relations WHERE tags ? 'sport' AND tags ->> 'type' = 'multipolygon'"
+ "sql": "SELECT id, tags, geom FROM osm_relation WHERE tags ? 'sport' AND tags ->> 'type' = 'multipolygon'"
}
]
},
@@ -484,17 +484,17 @@
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'telecom'"
+ "sql": "SELECT id, tags, geom FROM osm_node WHERE tags ? 'telecom'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_ways WHERE tags ? 'telecom'"
+ "sql": "SELECT id, tags, geom FROM osm_way WHERE tags ? 'telecom'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_relations WHERE tags ? 'telecom' AND tags ->> 'type' = 'multipolygon'"
+ "sql": "SELECT id, tags, geom FROM osm_relation WHERE tags ? 'telecom' AND tags ->> 'type' = 'multipolygon'"
}
]
},
@@ -504,17 +504,17 @@
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_nodes WHERE tags ? 'tourism'"
+ "sql": "SELECT id, tags, geom FROM osm_node WHERE tags ? 'tourism'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_ways WHERE tags ? 'tourism'"
+ "sql": "SELECT id, tags, geom FROM osm_way WHERE tags ? 'tourism'"
},
{
"minzoom": 12,
"maxzoom": 20,
- "sql": "SELECT id, tags, geom FROM osm_relations WHERE tags ? 'tourism' AND tags ->> 'type' = 'multipolygon'"
+ "sql": "SELECT id, tags, geom FROM osm_relation WHERE tags ? 'tourism' AND tags ->> 'type' = 'multipolygon'"
}
]
}
diff --git a/examples/overture/indexes.sql b/examples/overture/indexes.sql
index b7b7e5dbd..784a9f7f4 100644
--- a/examples/overture/indexes.sql
+++ b/examples/overture/indexes.sql
@@ -12,4 +12,7 @@
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-CREATE INDEX IF NOT EXISTS overture_admins_administrative_boundary_materialized_view_gist ON overture_admins_administrative_boundary_materialized_view USING GIST(geom);
\ No newline at end of file
+CREATE
+ INDEX IF NOT EXISTS overture_admins_administrative_boundary_materialized_view_gist ON
+ overture_admins_administrative_boundary_materialized_view
+ USING GIST(geom);
\ No newline at end of file
diff --git a/examples/overture/views.sql b/examples/overture/views.sql
index 202585300..1749f299d 100644
--- a/examples/overture/views.sql
+++ b/examples/overture/views.sql
@@ -12,20 +12,23 @@
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-CREATE MATERIALIZED VIEW IF NOT EXISTS overture_admins_administrative_boundary_materialized_view AS
-SELECT
- -- Generate a unique id for each row
- row_number() OVER () AS id,
-
- -- Rename the geometry column
- st_simplifypreservetopology(geometry, 78270 / power(2, 2)) AS geom,
-
- -- Aggregate other fields into a jsonb tags field
- jsonb_build_object(
- 'admin_level', admin_level,
- 'version', version,
- 'sources', sources,
- 'population', population,
- 'names', names
- ) AS tags
-FROM overture_admins_administrative_boundary;
\ No newline at end of file
+CREATE
+ MATERIALIZED VIEW IF NOT EXISTS overture_admins_administrative_boundary_materialized_view AS SELECT -- Generate a unique id for each rowROW_NUMBER() OVER() AS id, -- Rename the geometry column
+ st_simplifypreservetopology(
+ geometry,
+ 78270 / POWER( 2, 2 )
+ ) AS geom, -- Aggregate other fields into a jsonb tags field
+ jsonb_build_object(
+ 'admin_level',
+ admin_level,
+ 'version',
+ version,
+ 'sources',
+ sources,
+ 'population',
+ population,
+ 'names',
+ names
+ ) AS tags
+ FROM
+ overture_admins_administrative_boundary;
\ No newline at end of file
diff --git a/examples/postgresql-join/init.sql b/examples/postgresql-join/init.sql
index 799e06c6a..c3ddc9df3 100644
--- a/examples/postgresql-join/init.sql
+++ b/examples/postgresql-join/init.sql
@@ -12,22 +12,29 @@
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-
-CREATE EXTENSION IF NOT EXISTS postgis;
+CREATE
+ EXTENSION IF NOT EXISTS postgis;
-- Drop and create schema
-DROP SCHEMA IF EXISTS baremaps CASCADE;
-CREATE SCHEMA baremaps;
+DROP
+ SCHEMA IF EXISTS baremaps CASCADE;
+
+CREATE
+ SCHEMA baremaps;
-- Create table baremaps.tree_type
-CREATE TABLE IF NOT EXISTS baremaps.tree_type (
- id SERIAL PRIMARY KEY,
- type VARCHAR(255) NOT NULL
-);
+CREATE
+ TABLE
+ IF NOT EXISTS baremaps.tree_type(
+ id SERIAL PRIMARY KEY,
+ TYPE VARCHAR(255) NOT NULL
+ );
-- Populate baremaps.tree_type with 10 different types of trees
-INSERT INTO baremaps.tree_type (type) VALUES
- ('Oak'),
+INSERT
+ INTO
+ baremaps.tree_type(TYPE)
+ VALUES('Oak'),
('Maple'),
('Pine'),
('Birch'),
@@ -39,23 +46,47 @@ INSERT INTO baremaps.tree_type (type) VALUES
('Cedar');
-- Create table baremaps.point_trees
-CREATE TABLE IF NOT EXISTS baremaps.point_trees (
- id SERIAL PRIMARY KEY,
- geom GEOMETRY(Point, 3857) NOT NULL,
- size INTEGER,
- tree_type_id INTEGER REFERENCES baremaps.tree_type(id)
-);
+CREATE
+ TABLE
+ IF NOT EXISTS baremaps.point_trees(
+ id SERIAL PRIMARY KEY,
+ geom GEOMETRY(
+ Point,
+ 3857
+ ) NOT NULL,
+ SIZE INTEGER,
+ tree_type_id INTEGER REFERENCES baremaps.tree_type(id)
+ );
-- Populate baremaps.point_trees with 1000 random points in France
-INSERT INTO baremaps.point_trees (geom, size, tree_type_id)
-SELECT
- ST_Transform(
- ST_SetSRID(ST_MakePoint(
- random() * (5.5 - 0.5) + 0.5, -- Longitude range for France
- random() * (51.1 - 41.1) + 41.1 -- Latitude range for France
- ), 4326)
- ,3857),
- floor(random() * 100) + 1, -- Random size between 1 and 100
- floor(random() * 10) + 1 -- Random tree_type_id between 1 and 10
-FROM generate_series(1, 1000); -- Number of points to generate
+INSERT
+ INTO
+ baremaps.point_trees(
+ geom,
+ SIZE,
+ tree_type_id
+ ) SELECT
+ ST_Transform(
+ ST_SetSRID(
+ ST_MakePoint(
+ random()*(
+ 5.5 - 0.5
+ )+ 0.5, -- Longitude range for France
+ random()*(
+ 51.1 - 41.1
+ )+ 41.1 -- Latitude range for France
+
+ ),
+ 4326
+ ),
+ 3857
+ ),
+ FLOOR( random()* 100 )+ 1, -- Random size between 1 and 100FLOOR( random()* 10 )+ 1 -- Random tree_type_id between 1 and 10
+ FROM
+ generate_series(
+ 1,
+ 1000
+ );
+
+-- Number of points to generate
diff --git a/pom.xml b/pom.xml
index 0dd070fbc..e8da932e2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -680,6 +680,12 @@ limitations under the License.
**/StateReader.java
+
+
+ **/*.sql
+
+
+