Skip to content

Instantly share code, notes, and snippets.

@Komzpa
Created October 31, 2014 08:50
Show Gist options
  • Save Komzpa/36187853c36273231f6b to your computer and use it in GitHub Desktop.
Save Komzpa/36187853c36273231f6b to your computer and use it in GitHub Desktop.
drop table place_point;
create table place_point as (
select
osm_id,
place,
coalesce(tags->'short_name:en', tags->'name:en', tags->'int_name', name, tags->'name:ru', tags->'name:be', name) as name,
tags,
(case
when
((capital = '2') or
(admin_level = '2' and capital = 'yes') or
(admin_level is null and capital = 'yes'))
then 2
else null
end) as capital,
parse_integer(population) as population,
way as geom
from
planet_osm_point
where
place = 'city'
or place = 'town'
or place = 'village'
or place = 'hamlet'
);
create index place_point_geom_idx on place_point using gist(geom);
cluster place_point USING place_point_geom_idx;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment