Skip to content

Commit

Permalink
Avoid landuse=trailer_park
Browse files Browse the repository at this point in the history
  • Loading branch information
dch0ph committed Oct 16, 2024
1 parent ec84293 commit 513878f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
9 changes: 4 additions & 5 deletions openstreetmap-carto.lua
Original file line number Diff line number Diff line change
Expand Up @@ -666,11 +666,10 @@ function filter_tags_generic(tags)
tags['area'] = 'yes'
end

-- Normalise residential caravan site to new landuse type
if (tags['landuse'] == "residential") and (tags['residential'] == 'trailer_park') then
tags['landuse'] = 'trailer_park'
elseif ((tags['tourism'] == 'caravan_site') and (tags['static_caravans'] == 'only')) or (tags['tourism'] == 'holiday_park') then
tags['landuse'] = 'trailer_park'
-- Normalise residential caravan site
if ((tags['tourism'] == 'caravan_site') and (tags['static_caravans'] == 'only')) or (tags['tourism'] == 'holiday_park') then
tags['landuse'] = 'residential'
tags['residential'] = 'trailer_park'
tags['tourism'] = nil
end

Expand Down
11 changes: 6 additions & 5 deletions project.mml
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,14 @@ Layer:
NULL::text AS pasture
FROM (SELECT
way,
('landuse_' || (CASE WHEN landuse IN ('forest', 'farmland', 'residential', 'trailer_park', 'commercial', 'retail', 'industrial',
('landuse_' || (CASE WHEN landuse IN ('forest', 'farmland', 'residential', 'commercial', 'retail', 'industrial',
'meadow', 'pasture', 'grass', 'village_green', 'vineyard', 'orchard') THEN landuse END)) AS landuse,
('natural_' || (CASE WHEN "natural" IN ('mud', 'wetland', 'wood', 'sand', 'scree', 'shingle', 'bare_rock', 'heath', 'grassland', 'scrub') THEN "natural" END)) AS "natural",
tags->'wetland' AS wetland,
way_area/NULLIF(POW(!scale_denominator!*0.001*0.28,2),0) AS way_pixels,
way_area
FROM planet_osm_polygon
WHERE (landuse IN ('forest', 'farmland', 'residential', 'trailer_park', 'commercial', 'retail', 'industrial', 'meadow', 'pasture', 'grass', 'village_green', 'vineyard', 'orchard')
WHERE (landuse IN ('forest', 'farmland', 'residential', 'commercial', 'retail', 'industrial', 'meadow', 'pasture', 'grass', 'village_green', 'vineyard', 'orchard')
OR "natural" IN ('wood', 'wetland', 'mud', 'sand', 'scree', 'shingle', 'bare_rock', 'heath', 'grassland', 'scrub'))
AND way_area > 0.01*!pixel_width!::real*!pixel_height!::real
AND building IS NULL
Expand All @@ -102,7 +102,7 @@ Layer:
<<: *osm2pgsql
table: |-
(SELECT
way, name, historic, religion, way_pixels, is_building, wetland, pasture,
way, name, historic, religion, way_pixels, is_building, wetland, pasture, residential,
COALESCE(aeroway, golf, amenity, power, landuse, leisure, man_made, "natural", shop, tourism, highway, railway) AS feature
FROM (SELECT
way, COALESCE(name, '') AS name,
Expand All @@ -113,7 +113,7 @@ Layer:
'marketplace', 'community_centre', 'social_facility', 'arts_centre', 'parking_space', 'bus_station',
'fire_station', 'police')
OR amenity IN ('parking') AND (tags->'parking' NOT IN ('underground') OR (tags->'parking') IS NULL) THEN amenity END)) AS amenity,
('landuse_' || (CASE WHEN landuse IN ('quarry', 'vineyard', 'orchard', 'cemetery', 'residential', 'trailer_park', 'garages', 'meadow', 'pasture', 'grass',
('landuse_' || (CASE WHEN landuse IN ('quarry', 'vineyard', 'orchard', 'cemetery', 'residential', 'garages', 'meadow', 'pasture', 'grass',
'allotments', 'forest', 'farmyard', 'farmland', 'greenhouse_horticulture',
'recreation_ground', 'village_green', 'retail', 'industrial', 'railway', 'commercial',
'brownfield', 'landfill', 'salt_pond', 'construction', 'plant_nursery', 'religious', 'flowerbed') THEN landuse END)) AS landuse,
Expand All @@ -133,6 +133,7 @@ Layer:
CASE WHEN building IS NULL THEN 'no' ELSE 'yes' END AS is_building,
tags->'wetland' AS wetland,
tags->'pasture' AS pasture,
tags->'residential' AS residential,
way_area
FROM planet_osm_polygon
WHERE (landuse IS NOT NULL
Expand Down Expand Up @@ -1759,7 +1760,7 @@ Layer:
'telescope', 'tower', 'wastewater_plant', 'water_tower', 'water_works', 'windmill', 'works')
AND (tags->'location' NOT IN ('roof', 'rooftop') OR NOT (tags ? 'location'))) THEN man_made END,
'landuse_' || CASE WHEN landuse IN ('reservoir', 'basin', 'recreation_ground', 'village_green', 'quarry', 'vineyard', 'orchard', 'cemetery',
'residential', 'trailer_park', 'garages', 'meadow', 'pasture', 'grass', 'allotments', 'forest', 'farmyard', 'farmland',
'residential', 'garages', 'meadow', 'pasture', 'grass', 'allotments', 'forest', 'farmyard', 'farmland',
'greenhouse_horticulture', 'retail', 'industrial', 'railway', 'commercial', 'brownfield', 'landfill',
'construction', 'salt_pond', 'military', 'plant_nursery') THEN landuse END,
'natural_' || CASE WHEN "natural" IN ('peak', 'volcano', 'saddle', 'cave_entrance', 'sinkhole') AND way_area IS NULL THEN "natural" END,
Expand Down
5 changes: 2 additions & 3 deletions style/landcover.mss
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,7 @@
line-opacity: 0.329;
}

[feature = 'landuse_residential'][zoom >= 8],
[feature = 'landuse_trailer_park'][zoom >= 8] {
[feature = 'landuse_residential'][zoom >= 8] {
polygon-fill: @built-up-lowzoom;
[zoom >= 12] { polygon-fill: @residential; }
[zoom >= 16] {
Expand All @@ -311,7 +310,7 @@
line-width: 0.7;
}
}
[feature = 'landuse_trailer_park'][zoom >= 12] {
[residential = 'trailer_park'][zoom >= 12] {
polygon-fill: @campsite;
[zoom >= 13] {
line-color: @campsite-line;
Expand Down

0 comments on commit 513878f

Please sign in to comment.