You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@baremaps.apache.org by bc...@apache.org on 2023/09/28 19:44:27 UTC
[incubator-baremaps] 26/35: wFix queries
This is an automated email from the ASF dual-hosted git repository.
bchapuis pushed a commit to branch 745-daylight
in repository https://gitbox.apache.org/repos/asf/incubator-baremaps.git
commit 16ff98048985a4e07739110f95befc1de076c5e2
Author: Bertil Chapuis <bc...@gmail.com>
AuthorDate: Mon Sep 18 20:44:40 2023 +0200
wFix queries
---
basemap/daylight-workflow.js | 137 ++++++++++++++++++++++++++++++++++
basemap/layers/highway/prepare.sql | 3 +-
basemap/layers/linestring/prepare.sql | 4 +-
3 files changed, 141 insertions(+), 3 deletions(-)
diff --git a/basemap/daylight-workflow.js b/basemap/daylight-workflow.js
index 414b6a60..ac5a2ddb 100644
--- a/basemap/daylight-workflow.js
+++ b/basemap/daylight-workflow.js
@@ -14,6 +14,110 @@ import config from "./config.js";
export default {
"steps": [
+ /*
+ {
+ "id": "openstreetmap-data",
+ "needs": [],
+ "tasks": [
+ {
+ "type": "DownloadUrl",
+ "url": "https://download.geofabrik.de/europe/liechtenstein-latest.osm.pbf",
+ "path": "data/data.osm.pbf"
+ },
+ {
+ "type": "ImportOsmPbf",
+ "file": "data/data.osm.pbf",
+ "database": config.database,
+ "databaseSrid": 3857
+ },
+ ]
+ },
+ {
+ "id": "openstreetmap-download",
+ "needs": ["openstreetmap-data"],
+ "tasks": [
+ {
+ "type": "DownloadUrl",
+ "url": "https://daylight-map-distribution.s3.us-west-1.amazonaws.com/release/v1.29/fb-ml-roads-v1.29.osc.bz2",
+ "path": "data/roads.osc.bz2"
+ },
+ {
+ "type": "DownloadUrl",
+ "url": "https://daylight-map-distribution.s3.us-west-1.amazonaws.com/release/v1.29/admin-v1.29.osc.bz2",
+ "path": "data/admin.osc.bz2"
+ },
+ {
+ "type": "DownloadUrl",
+ "url": "https://daylight-map-distribution.s3.us-west-1.amazonaws.com/release/v1.29/coastlines-v1.29.tgz",
+ "path": "data/coastlines.tgz"
+ },
+ {
+ "type": "DownloadUrl",
+ "url": "https://daylight-map-distribution.s3.us-west-1.amazonaws.com/release/v1.29/preferred-localization-v1.29.tsv",
+ "path": "data/preferred-localization.tsv"
+ },
+ {
+ "type": "DownloadUrl",
+ "url": "https://daylight-map-distribution.s3.us-west-1.amazonaws.com/release/v1.29/important-features-v1.29.json",
+ "path": "data/important-features.json"
+ },
+ ]
+ },
+ {
+ "id": "openstreetmap-decompress",
+ "needs": ["openstreetmap-download"],
+ "tasks": [
+ {
+ "type": "DecompressFile",
+ "compression": "bzip2",
+ "source": "data/roads.osc.bz2",
+ "target": "data/roads.osc"
+ },
+ {
+ "type": "DecompressFile",
+ "compression": "bzip2",
+ "source": "data/admin.osc.bz2",
+ "target": "data/admin.osc"
+ },
+ {
+ "type": "DecompressFile",
+ "compression": "targz",
+ "source": "data/coastlines.tgz",
+ "target": "data/coastlines"
+ },
+ ]
+ },
+ {
+ "id": "openstreetmap-import",
+ "needs": [],
+ "tasks": [
+ {
+ "type": "ImportOsmChange",
+ "file": "data/roads.osc",
+ "database": config.database,
+ "srid": 3857
+ },
+ {
+ "type": "ImportOsmChange",
+ "file": "data/admin.osc",
+ "database": config.database,
+ "srid": 3857
+ },
+ ]
+ },
+ {
+ "id": "openstreetmap-coastlines",
+ "needs": [],
+ "tasks": [
+ {
+ "type": "ImportShapefile",
+ "file": "data/coastlines/water_polygons.shp",
+ "database": config.database,
+ "sourceSRID": 4326,
+ "targetSRID": 3857
+ },
+ ]
+ }
{
"id": "openstreetmap-pbf",
"needs": [],
@@ -256,6 +360,7 @@ export default {
},
]
},
+ */
{
"id": "openstreetmap-highway",
"needs": ["openstreetmap-linestring"],
@@ -284,6 +389,7 @@ export default {
},
]
},
+ /*
{
"id": "openstreetmap-railway",
"needs": ["openstreetmap-linestring"],
@@ -424,5 +530,36 @@ export default {
},
]
},
+<<<<<<< HEAD:basemap/daylight-workflow.js
+=======
+ {
+ "id": "openstreetmap-water",
+ "needs": [],
+ "tasks": [
+ {
+ "type": "ExecuteSql",
+ "file": "layers/water/clean.sql",
+ "database": config.database,
+ },
+ {
+ "type": "ExecuteSql",
+ "file": "layers/water/prepare.sql",
+ "database": config.database,
+ },
+ {
+ "type": "ExecuteSql",
+ "file": "layers/water/simplify.sql",
+ "database": config.database,
+ "parallel": true,
+ },
+ {
+ "type": "ExecuteSql",
+ "file": "layers/water/index.sql",
+ "database": config.database,
+ },
+ ]
+ },
+ */
+>>>>>>> 8d538e1f (Fix queries):basemap/daylight.js
]
}
diff --git a/basemap/layers/highway/prepare.sql b/basemap/layers/highway/prepare.sql
index 3c8b994a..9160e35b 100644
--- a/basemap/layers/highway/prepare.sql
+++ b/basemap/layers/highway/prepare.sql
@@ -18,7 +18,8 @@ WITH
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')
+ WHERE tags ->> 'highway' IN ('motorway', 'motorway_link', 'trunk', 'trunk_link', 'primary', 'primary_link', 'secondary', 'secondary_link', 'tertiary', 'tertiary_link', 'unclassified', 'residential', 'construction')
+ AND changeset != 1000000000 -- Exclude the linestrings that are part of the daylight distribution
),
-- Cluster the linestrings by highway type
clustered AS (
diff --git a/basemap/layers/linestring/prepare.sql b/basemap/layers/linestring/prepare.sql
index 24683658..d24480ad 100644
--- a/basemap/layers/linestring/prepare.sql
+++ b/basemap/layers/linestring/prepare.sql
@@ -7,10 +7,10 @@
-- 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_linestring CASCADE;
+DROP MATERIALIZED VIEW IF EXISTS osm_linestring CASCADE;
CREATE MATERIALIZED VIEW osm_linestring AS
-SELECT id, tags, geom
+SELECT id, tags, geom, changeset
FROM osm_ways
LEFT JOIN osm_member ON id = member_ref
WHERE ST_GeometryType(osm_ways.geom) = 'ST_LineString'