Skip to content

Commit

Permalink
Cleanup aeroway SQL
Browse files Browse the repository at this point in the history
  • Loading branch information
pnorman committed Mar 9, 2015
1 parent 2c3e4ae commit 292c882
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
4 changes: 2 additions & 2 deletions project.mml
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@
"srs": "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over",
"Datasource": {
"extent": "-20037508,-20037508,20037508,20037508",
"table": "(SELECT way, building, amenity, aeroway\n FROM planet_osm_polygon\n WHERE (building IS NOT NULL)\n AND building != 'no'\n AND (aeroway = 'terminal' OR amenity = 'place_of_worship')\n ORDER BY z_order,way_area DESC)\nAS buildings_major",
"table": "(SELECT\n way,\n building,\n amenity,\n aeroway\n FROM planet_osm_polygon\n WHERE (building IS NOT NULL)\n AND building != 'no'\n AND (aeroway = 'terminal' OR amenity = 'place_of_worship')\n ORDER BY z_order, way_area DESC)\nAS buildings_major",
"geometry_field": "way",
"type": "postgis",
"key_field": "",
Expand Down Expand Up @@ -1559,7 +1559,7 @@
"srs": "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over",
"Datasource": {
"extent": "-20037508,-20037508,20037508,20037508",
"table": "(SELECT way, highway, height, width, refs FROM\n (SELECT\n way, highway,\n array_length(refs,1) AS height,\n (SELECT MAX(char_length(ref)) FROM unnest(refs) AS u(ref)) AS width,\n array_to_string(refs, E'\\n') AS refs\n FROM (\n SELECT\n way,\n COALESCE(highway, aeroway) AS highway,\n string_to_array(ref, ';') AS refs\n FROM planet_osm_line\n WHERE (highway IN ('motorway', 'trunk', 'primary', 'secondary', 'tertiary', 'unclassified', 'residential') OR aeroway IN ('runway', 'taxiway'))\n AND ref IS NOT NULL\n ) AS p) AS q\n WHERE height <= 4 AND width <= 11) AS roads_text_ref",
"table": "(SELECT way, highway, height, width, refs FROM\n (SELECT\n way, highway,\n array_length(refs,1) AS height,\n (SELECT MAX(char_length(ref)) FROM unnest(refs) AS u(ref)) AS width,\n array_to_string(refs, E'\\n') AS refs\n FROM (\n SELECT\n way,\n COALESCE(highway, aeroway) AS highway,\n string_to_array(ref, ';') AS refs\n FROM planet_osm_line\n WHERE (highway IN ('motorway', 'trunk', 'primary', 'secondary', 'tertiary', 'unclassified', 'residential') OR aeroway IN ('runway', 'taxiway'))\n AND ref IS NOT NULL\n ) AS p) AS q\n WHERE height <= 4 AND width <= 11) AS roads_text_ref",
"geometry_field": "way",
"type": "postgis",
"key_field": "",
Expand Down
14 changes: 9 additions & 5 deletions project.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -384,12 +384,16 @@ Layer:
Datasource:
<<: *osm2pgsql
table: |-
(SELECT way, building, amenity, aeroway
(SELECT
way,
building,
amenity,
aeroway
FROM planet_osm_polygon
WHERE (building IS NOT NULL)
AND building != 'no'
AND (aeroway = 'terminal' OR amenity = 'place_of_worship')
ORDER BY z_order,way_area DESC)
ORDER BY z_order, way_area DESC)
AS buildings_major
properties:
minzoom: 12
Expand Down Expand Up @@ -1533,9 +1537,9 @@ Layer:
way,
COALESCE(highway, aeroway) AS highway,
string_to_array(ref, ';') AS refs
FROM planet_osm_line
WHERE (highway IN ('motorway', 'trunk', 'primary', 'secondary', 'tertiary', 'unclassified', 'residential') OR aeroway IN ('runway', 'taxiway'))
AND ref IS NOT NULL
FROM planet_osm_line
WHERE (highway IN ('motorway', 'trunk', 'primary', 'secondary', 'tertiary', 'unclassified', 'residential') OR aeroway IN ('runway', 'taxiway'))
AND ref IS NOT NULL
) AS p) AS q
WHERE height <= 4 AND width <= 11) AS roads_text_ref
properties:
Expand Down

0 comments on commit 292c882

Please sign in to comment.