Basic poi layer

pull/24/head
lukasmartinelli 2016-10-28 17:46:10 +02:00
rodzic 4e64becbb8
commit dbec752ed1
5 zmienionych plików z 345 dodań i 0 usunięć

Wyświetl plik

@ -0,0 +1,35 @@
CREATE OR REPLACE FUNCTION poi_class(subclass TEXT)
RETURNS TEXT AS $$
SELECT CASE
WHEN subclass IN ('accessories','antiques','art','beauty','bed','boutique','camera','carpet','charity','chemist','chocolate','coffee','computer','confectionery','convenience','copyshop','cosmetics','garden_centre','doityourself','erotic','electronics','fabric','florist','furniture','video_games','video','general','gift','hardware','hearing_aids','hifi','ice_cream','interior_decoration','jewelry','kiosk','lamps','mall','massage','motorcycle','mobile_phone','newsagent','optician','outdoor','perfumery','perfume','pet','photo','second_hand','shoes','sports','stationery','tailor','tattoo','ticket','tobacco','toys','travel_agency','watches','weapons','wholesale') THEN 'shop'
WHEN subclass IN ('townhall','public_building','courthouse','community_centre') THEN 'town_hall'
WHEN subclass IN ('golf','golf_course','miniature_golf') THEN 'golf'
WHEN subclass IN ('fast_food','food_court') THEN 'fast_food'
WHEN subclass IN ('park','bbq') THEN 'park'
WHEN subclass IN ('bus_stop','bus_station') THEN 'bus'
WHEN subclass IN ('camp_site','caravan_site') THEN 'campsite'
WHEN subclass IN ('laundry','dry_cleaning') THEN 'laundry'
WHEN subclass IN ('supermarket','deli','delicatessen','department_store','greengrocer','marketplace') THEN 'grocery'
WHEN subclass IN ('books','library') THEN 'library'
WHEN subclass IN ('university','college') THEN 'college'
WHEN subclass IN ('hotel','motel','bed_and_breakfast','guest_house','hostel','chalet','alpine_hut','camp_site') THEN 'lodging'
WHEN subclass IN ('chocolate','confectionery') THEN 'ice_cream'
WHEN subclass IN ('post_box','post_office') THEN 'post'
WHEN subclass IN ('cafe') THEN 'cafe'
WHEN subclass IN ('school','kindergarten') THEN 'school'
WHEN subclass IN ('alcohol','beverages','wine') THEN 'alcohol_shop'
WHEN subclass IN ('bar','nightclub') THEN 'bar'
WHEN subclass IN ('marina','dock') THEN 'harbor'
WHEN subclass IN ('car','car_repair','taxi') THEN 'car'
WHEN subclass IN ('hospital','nursing_home') THEN 'hospital'
WHEN subclass IN ('grave_yard','cemetery') THEN 'cemetery'
WHEN subclass IN ('attraction','viewpoint') THEN 'attraction'
WHEN subclass IN ('biergarten','pub') THEN 'beer'
WHEN subclass IN ('music','musical_instrument') THEN 'music'
WHEN subclass IN ('american_football','stadium','soccer','pitch') THEN 'stadium'
WHEN subclass IN ('accessories','antiques','art','artwork','gallery','arts_centre') THEN 'art_gallery'
WHEN subclass IN ('bag','clothes') THEN 'clothing_store'
WHEN subclass IN ('swimming_area','swimming') THEN 'swimming'
ELSE subclass
END;
$$ LANGUAGE SQL IMMUTABLE;

Wyświetl plik

@ -0,0 +1,8 @@
CREATE OR REPLACE FUNCTION layer_poi(bbox geometry, zoom_level integer)
RETURNS TABLE(osm_id bigint, geometry geometry, name text, name_en text, class text, subclass text) AS $$
SELECT id, geometry, name, NULLIF(name_en, ''), poi_class(subclass) AS class, subclass
FROM osm_poi_point
WHERE geometry && bbox
AND name <> ''
AND (zoom_level >= 14);
$$ LANGUAGE SQL IMMUTABLE;

Wyświetl plik

@ -0,0 +1,283 @@
tables:
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:
amenity:
- arts_centre
- police
- fire_station
- post_box
- post_office
- telephone
- library
- townhall
- courthouse
- 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
- bar
- food_court
- biergarten
- swimming_pool
- 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_area
- water_park
- golf_course
- miniature_golf
- marina
- stadium
- ice_rink
- garden
landuse:
- cemetery
- basin
- reservoir
- brownfield
sport:
- swimming
- tennis
- soccer
- baseball
- basketball
- multi
- golf
- equestrian
- athletics
- volleyball
- climbing
- bowls
- american_football
- skateboard
- shooting
- skiing
- boules
- beachvolleyball
- cricket
- table_tennis
- hockey
- 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
- alcohol
- antiques
- art
- bag
- bakery
- beauty
- bed
- beverages
- bicycle
- books
- boutique
- butcher
- camera
- car
- car_repair
- carpet
- charity
- chemist
- chocolate
- clothes
- coffee
- computer
- confectionery
- convenience
- copyshop
- cosmetics
- garden_centre
- deli
- delicatessen
- department_store
- doityourself
- dry_cleaning
- video
- electronics
- erotic
- fabric
- florist
- furniture
- video_games
- general
- gift
- greengrocer
- hairdresser
- hardware
- hearing_aids
- hifi
- ice_cream
- interior_decoration
- jewelry
- kiosk
- lamps
- laundry
- mall
- massage
- mobile_phone
- motorcycle
- music
- musical_instrument
- newsagent
- optician
- outdoor
- perfumery
- perfume
- pet
- photo
- second_hand
- shoes
- sports
- stationery
- supermarket
- tailor
- tattoo
- ticket
- tobacco
- toys
- travel_agency
- watches
- weapons
- wholesale
- wine
highway:
- bus_stop
barrier:
- sally_port
- lift_gate
- gate
- bollard
- stile
- cycle_barrier
- toll_booth
- border_control
historic:
- monument
waterway:
- dock
aerialway:
- station

Wyświetl plik

@ -0,0 +1,18 @@
layer:
id: "poi"
description: |
POIs.
buffer_size: 8
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
fields:
class: String
datasource:
geometry_field: geometry
srid: 900913
query: (SELECT geometry, name, name_en, class, subclass FROM layer_poi(!bbox!, z(!scale_denominator!))) AS t
schema:
- ./class.sql
- ./layer.sql
datasources:
- type: imposm3
mapping_file: ./mapping.yaml

Wyświetl plik

@ -7,6 +7,7 @@ tileset:
# housenumbers are quite heavy on the tile size (up to +30KB)
#- layers/housenumber/housenumber.yaml
- layers/place/place.yaml
- layers/poi/poi.yaml
- layers/railway/railway.yaml
- layers/water_name/water_name.yaml
- layers/water/water.yaml