Merge pull request #58 from openmaptiles/poi_polygon_fix46

Poi polygon fix #46
pull/66/head
Lukas Martinelli 2016-11-28 15:26:48 +01:00 zatwierdzone przez GitHub
commit aed323bb99
5 zmienionych plików z 357 dodań i 277 usunięć

Wyświetl plik

@ -1,11 +1,9 @@
version: "2" version: "2"
volumes:
pgdata:
services: services:
postgres: postgres:
image: "openmaptiles/postgis:2.2" image: "openmaptiles/postgis:2.2"
volumes: volumes:
- pgdata:/var/lib/postgresql/data - ./pgdata:/var/lib/postgresql/data
ports: ports:
- "5432" - "5432"
env_file: .env env_file: .env

Wyświetl plik

@ -7,12 +7,20 @@ RETURNS TABLE(osm_id bigint, geometry geometry, name text, name_en text, class t
SELECT osm_id, geometry, name, NULLIF(name_en, ''), poi_class(subclass) AS class, subclass, SELECT osm_id, geometry, name, NULLIF(name_en, ''), poi_class(subclass) AS class, subclass,
row_number() OVER ( row_number() OVER (
PARTITION BY LabelGrid(geometry, 100 * pixel_width) PARTITION BY LabelGrid(geometry, 100 * pixel_width)
ORDER BY poi_class_rank(poi_class(subclass)) ASC, length(name) DESC ORDER BY poi_class_rank(poi_class(subclass)) ASC,
length(name) DESC NULLS LAST
)::int AS "rank" )::int AS "rank"
-- etldoc: osm_poi_point -> layer_poi:z14_ FROM (
FROM osm_poi_point -- etldoc: osm_poi_point -> layer_poi:z14
SELECT * FROM osm_poi_point
WHERE geometry && bbox WHERE geometry && bbox
AND zoom_level >= 14 AND zoom_level >= 14
AND name <> '' UNION ALL
ORDER BY "rank"; -- etldoc: osm_poi_polygon -> layer_poi:z14
SELECT * FROM osm_poi_polygon
WHERE geometry && bbox
AND zoom_level >= 14
) as poi_union
ORDER BY "rank"
;
$$ LANGUAGE SQL IMMUTABLE; $$ LANGUAGE SQL IMMUTABLE;

Wyświetl plik

@ -1,189 +1,108 @@
tables:
# etldoc: imposm3 -> osm_poi_point # imposm3 mapping file for https://github.com/osm2vectortiles/imposm3
poi_point: # Warning: this is not the official imposm3
type: point
fields: # aerialway values , see http://taginfo.openstreetmap.org/keys/aerialway#values
- name: osm_id def_poi_mapping_aerialway: &poi_mapping_aerialway
type: id - station
- name: geometry
type: geometry # amenity values , see http://taginfo.openstreetmap.org/keys/amenity#values
- name: name def_poi_mapping_amenity: &poi_mapping_amenity
key: name
type: string
- name: name_en
key: name:en
type: string
- name: subclass
type: mapping_value
mapping:
amenity:
- arts_centre - arts_centre
- police - bank
- bar
- bbq
- bicycle_rental
- biergarten
- bus_station
- cafe
- cinema
- college
- community_centre
- courthouse
- dentist
- doctors
- embassy
- fast_food
- ferry_terminal
- fire_station - fire_station
- food_court
- fuel
- grave_yard
- hospital
- ice_cream
- kindergarten
- library
- marketplace
- nightclub
- nursing_home
- pharmacy
- place_of_worship
- police
- post_box - post_box
- post_office - post_office
- telephone
- library
- townhall
- courthouse
- prison - prison
- place_of_worship
- embassy
- community_centre
- nursing_home
- university
- school
- kindergarten
- college
- public_building
- pharmacy
- hospital
- doctors
- dentist
- veterinary
- theatre
- nightclub
- cinema
- restaurant
- recycling
- fast_food
- cafe
- pub - pub
- bar - public_building
- food_court - recycling
- biergarten - restaurant
- swimming_pool - school
- shelter - shelter
- grave_yard
- bank
- ferry_terminal
- fuel
- waste_basket
- bicycle_rental
- bbq
- taxi
- bus_station
- marketplace
- toilets
leisure:
- park
- playground
- dog_park
- sports_centre
- pitch
- swimming_pool - swimming_pool
- swimming_area - taxi
- water_park - telephone
- golf_course - theatre
- miniature_golf - toilets
- marina - townhall
- stadium - university
- ice_rink - veterinary
- garden - waste_basket
landuse:
- cemetery # barrier values , see http://taginfo.openstreetmap.org/keys/barrier#values
def_poi_mapping_barrier: &poi_mapping_barrier
- bollard
- border_control
- cycle_barrier
- gate
- lift_gate
- sally_port
- stile
- toll_booth
# highway values , see http://taginfo.openstreetmap.org/keys/highway#values
def_poi_mapping_highway: &poi_mapping_highway
- bus_stop
# historic values , see http://taginfo.openstreetmap.org/keys/historic#values
def_poi_mapping_historic: &poi_mapping_historic
- monument
# landuse values , see http://taginfo.openstreetmap.org/keys/landuse#values
def_poi_mapping_landuse: &poi_mapping_landuse
- basin - basin
- reservoir
- brownfield - brownfield
sport: - cemetery
- swimming - reservoir
- tennis
- soccer # leisure values , see http://taginfo.openstreetmap.org/keys/leisure#values
- baseball def_poi_mapping_leisure: &poi_mapping_leisure
- basketball - dog_park
- multi - garden
- golf - golf_course
- equestrian - ice_rink
- athletics - marina
- volleyball - miniature_golf
- climbing - park
- bowls - pitch
- american_football - playground
- skateboard - sports_centre
- shooting - stadium
- skiing - swimming_area
- boules - swimming_pool
- beachvolleyball - water_park
- cricket
- table_tennis # shop values , see http://taginfo.openstreetmap.org/keys/shop#values
- hockey def_poi_mapping_shop: &poi_mapping_shop
- gymnastics
- running
- canoe
- rugby_union
- skating
- scuba_diving
- motor
- horse_racing
- handball
- team_handball
- karting
- cycling
- archery
- motocross
- pelota
- rugby
- gaelic_games
- model_aerodrome
- netball
- rugby_league
- free_flying
- rowing
- chess
- australian_football
- cricket_nets
- racquet
- bmx
- sailing
- ice_stock
- badminton
- paddle_tennis
- dog_racing
- fatsal
- billiards
- ice_hockey
- yoga
- disc_golf
- orienteering
- toboggan
- horseshoes
- paragliding
- korfball
- diving
- rc_car
- canadian_football
- field_hockey
- shooting_range
- boxing
- curling
- surfing
- water_ski
- judo
- croquet
- paintball
- climbing_adventure
- long_jump
- table_soccer
tourism:
- attraction
- artwork
- gallery
- hotel
- motel
- bed_and_breakfast
- guest_house
- hostel
- chalet
- camp_site
- alpine_hut
- caravan_site
- museum
- viewpoint
- zoo
- theme_park
- information
- picnic_site
shop:
- accessories - accessories
- alcohol - alcohol
- antiques - antiques
@ -211,19 +130,17 @@ tables:
- convenience - convenience
- copyshop - copyshop
- cosmetics - cosmetics
- garden_centre
- deli - deli
- delicatessen - delicatessen
- department_store - department_store
- doityourself - doityourself
- dry_cleaning - dry_cleaning
- video
- electronics - electronics
- erotic - erotic
- fabric - fabric
- florist - florist
- furniture - furniture
- video_games - garden_centre
- general - general
- gift - gift
- greengrocer - greengrocer
@ -246,8 +163,8 @@ tables:
- newsagent - newsagent
- optician - optician
- outdoor - outdoor
- perfumery
- perfume - perfume
- perfumery
- pet - pet
- photo - photo
- second_hand - second_hand
@ -261,24 +178,175 @@ tables:
- tobacco - tobacco
- toys - toys
- travel_agency - travel_agency
- video
- video_games
- watches - watches
- weapons - weapons
- wholesale - wholesale
- wine - wine
highway:
- bus_stop # sport values , see http://taginfo.openstreetmap.org/keys/sport#values
barrier: def_poi_mapping_sport: &poi_mapping_sport
- sally_port - american_football
- lift_gate - archery
- gate - athletics
- bollard - australian_football
- stile - badminton
- cycle_barrier - baseball
- toll_booth - basketball
- border_control - beachvolleyball
historic: - billiards
- monument - bmx
waterway: - boules
- bowls
- boxing
- canadian_football
- canoe
- chess
- climbing
- climbing_adventure
- cricket
- cricket_nets
- croquet
- curling
- cycling
- disc_golf
- diving
- dog_racing
- equestrian
- fatsal
- field_hockey
- free_flying
- gaelic_games
- golf
- gymnastics
- handball
- hockey
- horse_racing
- horseshoes
- ice_hockey
- ice_stock
- judo
- karting
- korfball
- long_jump
- model_aerodrome
- motocross
- motor
- multi
- netball
- orienteering
- paddle_tennis
- paintball
- paragliding
- pelota
- racquet
- rc_car
- rowing
- rugby
- rugby_league
- rugby_union
- running
- sailing
- scuba_diving
- shooting
- shooting_range
- skateboard
- skating
- skiing
- soccer
- surfing
- swimming
- table_soccer
- table_tennis
- team_handball
- tennis
- toboggan
- volleyball
- water_ski
- yoga
# tourism values , see http://taginfo.openstreetmap.org/keys/tourism#values
def_poi_mapping_tourism: &poi_mapping_tourism
- alpine_hut
- artwork
- attraction
- bed_and_breakfast
- camp_site
- caravan_site
- chalet
- gallery
- guest_house
- hostel
- hotel
- information
- motel
- museum
- picnic_site
- theme_park
- viewpoint
- zoo
# waterway values , see http://taginfo.openstreetmap.org/keys/waterway#values
def_poi_mapping_waterway: &poi_mapping_waterway
- dock - dock
aerialway:
- station tables:
# etldoc: imposm3 -> osm_poi_point
poi_point:
type: point
fields:
- name: osm_id
type: id
- name: geometry
type: geometry
- name: name
key: name
type: string
- name: name_en
key: name:en
type: string
- name: subclass
type: mapping_value
mapping:
aerialway: *poi_mapping_aerialway
amenity: *poi_mapping_amenity
barrier: *poi_mapping_barrier
highway: *poi_mapping_highway
historic: *poi_mapping_historic
landuse: *poi_mapping_landuse
leisure: *poi_mapping_leisure
shop: *poi_mapping_shop
sport: *poi_mapping_sport
tourism: *poi_mapping_tourism
waterway: *poi_mapping_waterway
# etldoc: imposm3 -> osm_poi_polygon
poi_polygon:
type: polygon
fields:
- name: osm_id
type: id
- name: geometry
type: geometry
- name: name
key: name
type: string
- name: name_en
key: name:en
type: string
- name: subclass
type: mapping_value
mapping:
aerialway: *poi_mapping_aerialway
amenity: *poi_mapping_amenity
barrier: *poi_mapping_barrier
highway: *poi_mapping_highway
historic: *poi_mapping_historic
landuse: *poi_mapping_landuse
leisure: *poi_mapping_leisure
shop: *poi_mapping_shop
sport: *poi_mapping_sport
tourism: *poi_mapping_tourism
waterway: *poi_mapping_waterway

Wyświetl plik

@ -32,6 +32,7 @@ layer:
srid: 900913 srid: 900913
query: (SELECT geometry, name, name_en, class, subclass, rank FROM layer_poi(!bbox!, z(!scale_denominator!), !pixel_width!)) AS t query: (SELECT geometry, name, name_en, class, subclass, rank FROM layer_poi(!bbox!, z(!scale_denominator!), !pixel_width!)) AS t
schema: schema:
- ./poi_polygon_update.sql
- ./class.sql - ./class.sql
- ./layer.sql - ./layer.sql
datasources: datasources:

Wyświetl plik

@ -0,0 +1,5 @@
-- etldoc: osm_poi_polygon -> osm_poi_polygon
UPDATE osm_poi_polygon SET geometry=topoint(geometry)
WHERE ST_GeometryType(geometry) <> 'ST_Point';
ANALYZE osm_poi_polygon;