Skip to content

Instantly share code, notes, and snippets.

@pnorman
Last active December 20, 2015 16:39
Show Gist options
  • Save pnorman/6162924 to your computer and use it in GitHub Desktop.
Save pnorman/6162924 to your computer and use it in GitHub Desktop.
from HDM rendering
(SELECT
way,
CASE
WHEN place='country' THEN 1
WHEN place='state' THEN 10
WHEN tags->'is_capital'='country' THEN 20
WHEN place='city' THEN 21
WHEN place='town' THEN 30
ELSE 100
END as prio,
place AS type,
name,
z_order,
CASE
WHEN population ~ E'^\\\\d+$' THEN population::integer
ELSE 0
END AS population,
tags->'is_capital' as is_capital
FROM planet_osm_point
WHERE
place in ('country', 'state', 'city', 'town')
AND place IS NOT NULL
ORDER BY prio, population DESC NULLS LAST)
AS data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment