Skip to content

Instantly share code, notes, and snippets.

@das-g
Created July 28, 2016 12:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save das-g/ce273b3f57b6442b65405abd0c033141 to your computer and use it in GitHub Desktop.
Save das-g/ce273b3f57b6442b65405abd0c033141 to your computer and use it in GitHub Desktop.
Query to combine OSMaxx roads and railways (suitable as QGIS virtual layer query)
SELECT
"osm_id", "lastchange", "geomtype", geometry, "type", "name", "label", "tags",
'highway' as "super_type",
"aggtype",
"bridge",
NULL as "frequency",
"oneway",
"ref",
'operational' as "status",
"tunnel",
NULL as "voltage",
"z_order"
FROM road_l
UNION
SELECT
"osm_id", "lastchange", "geomtype", geometry, "type", "name", "label", "tags",
'railway' as "super_type",
"aggtype",
"bridge",
"frequency",
NULL as "oneway",
NULL as "ref",
'operational' as "status",
"tunnel",
"voltage",
"z_order"
FROM railway_l
UNION
SELECT
"osm_id", "lastchange", "geomtype", geometry, "sub_type" as "type", "name", "label", "tags",
"type" as "super_type",
NULL as "aggtype",
NULL as "bridge",
NULL as "frequency",
NULL as "oneway",
"ref",
"status",
NULL as "tunnel",
NULL as "voltage",
"z_order"
FROM nonop_l
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment