Created
May 16, 2014 05:33
-
-
Save pnorman/475075d60ba93a37b86f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#placenames-medium { | |
[capital = 'yes'] { | |
[zoom >= 5][zoom < 15] { | |
text-name: "[name]"; | |
text-size: 10; | |
text-fill: @placenames; | |
text-face-name: @book-fonts; | |
text-halo-radius: 1.5; | |
text-min-distance: 10; | |
[zoom >= 6] { | |
text-size: 12; | |
} | |
[zoom >= 11] { | |
text-size: 15; | |
} | |
} | |
} | |
[place = 'city'] { | |
[zoom >= 6][zoom < 15] { | |
text-name: "[name]"; | |
text-size: 9; | |
text-fill: @placenames; | |
text-face-name: @book-fonts; | |
text-halo-radius: 1.5; | |
text-min-distance: 10; | |
[zoom >= 9] { | |
text-size: 12; | |
} | |
[zoom >= 11] { | |
text-size: 15; | |
} | |
} | |
} | |
[place = 'town'] { | |
[zoom >= 9] { | |
text-name: "[name]"; | |
text-size: 9; | |
text-fill: @placenames; | |
text-face-name: @book-fonts; | |
text-halo-radius: 1.5; | |
text-wrap-width: 20; | |
text-min-distance: 10; | |
} | |
[zoom >= 11] { | |
text-size: 11; | |
} | |
[zoom >= 14] { | |
text-size: 15; | |
text-fill: @placenames-light; | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT place,name,capital,population FROM (SELECT way,place,name,capital,population,way_area | |
FROM | |
(SELECT | |
way,place,name,NULL AS capital,way_area, -- The polygon table doesn't have the capital information with the default style | |
CASE WHEN population~E'^\\d{1,9}$' THEN population::integer ELSE NULL END AS population | |
-- We need to filter out population values that might cause exceptions. This is a fairly rigerous filtering as it will remove population=1,000 | |
FROM planet_osm_polygon | |
UNION ALL -- Join the two together | |
SELECT | |
way,place,name,capital,NULL AS way_area, -- Points don't have an area | |
CASE WHEN population~E'^\\d{1,9}$' AND length(population)<10 THEN population::integer ELSE NULL END AS population -- as above | |
FROM planet_osm_point) AS p | |
WHERE place IN ('city','town') -- This condition is brought inside by the query optimizer | |
ORDER BY | |
CASE place WHEN 'city' THEN 0 ELSE 10 END, -- We don't actually need this at moment with the current MSS | |
CASE capital WHEN 'yes' THEN 0 ELSE 10 END, -- Nor this | |
way_area DESC NULLS LAST, -- Put physically larger first | |
population DESC NULLS LAST -- For points (no area) put larger population first | |
) AS placenames_medium WHERE "way" && ST_SetSRID('BOX3D(-13932330.01959565 6105178.323193599,-12993071.8160274 7044436.526761843)'::box3d, 900913) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
┌───────┬──────────────────────────────┬─────────┬────────────┐ | |
│ place │ name │ capital │ population │ | |
├───────┼──────────────────────────────┼─────────┼────────────┤ | |
│ city │ Sumas │ ¤ │ ¤ │ | |
│ city │ Vancouver │ ¤ │ 2100000 │ | |
│ city │ Surrey │ ¤ │ 400000 │ | |
│ city │ Victoria │ 4 │ 330088 │ | |
│ city │ Kamloops │ ¤ │ 85678 │ | |
│ city │ New Westminster │ ¤ │ 58000 │ | |
│ city │ Whistler │ ¤ │ 11000 │ | |
│ city │ Revelstoke │ ¤ │ ¤ │ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment