diff --git a/.gitignore b/.gitignore index 9985e51fa..3b0d04286 100644 --- a/.gitignore +++ b/.gitignore @@ -19,11 +19,13 @@ data/*.dbf data/*.prj data/*.shx data/*.qpj +data/*.qmd data/wof_neighbourhoods.pgdump data/*.README.html data/*.VERSION.txt data/*.json data/wikidata_snapshot.sql +data/wof_snapshot.sql # python compiled bytecode and development files *.pyc diff --git a/data/Makefile-prepare-data.jinja2 b/data/Makefile-prepare-data.jinja2 index 1858bd695..588cb094d 100644 --- a/data/Makefile-prepare-data.jinja2 +++ b/data/Makefile-prepare-data.jinja2 @@ -1,7 +1,7 @@ # clip input to the bounds of EPSG:3857 _before_ projecting. this ensures that # there are no unprojectable points, but that the data fills the all the way to # the corners of the world. -OGR_CLIP_OPTS=-clipsrc -180 -85.051128779806604 180 85.051128779806604 +OGR_CLIP_OPTS= all: download shapefiles diff --git a/data/functions.sql b/data/functions.sql index 795519682..cea107f13 100644 --- a/data/functions.sql +++ b/data/functions.sql @@ -127,7 +127,7 @@ FROM ( unnest(tags) AS unnested FROM ( SELECT - mz_modify_network(hstore(tags))->ARRAY['route','network','ref'] AS tags + mz_modify_network(hstore(tags))->ARRAY['route','network','ref','osmc:symbol'] AS tags FROM planet_osm_rels WHERE @@ -135,7 +135,8 @@ FROM ( parts[way_off+1:rel_off] && ARRAY[way_id] AND hstore(tags) ? 'route' AND (hstore(tags) ? 'network' OR - hstore(tags) ? 'ref') + hstore(tags) ? 'ref') AND + hstore(tags) ? 'osmc:symbol' ) inner1 ) inner2; $$ LANGUAGE sql STABLE; diff --git a/data/perform-sql-updates.sh b/data/perform-sql-updates.sh index df5106586..984117919 100755 --- a/data/perform-sql-updates.sh +++ b/data/perform-sql-updates.sh @@ -61,8 +61,8 @@ echo -e "\nFixing short_name region (state) abbreviation labels in OSM" psql $PSQLOPTS $@ -f apply-short_name_fixes.sql # Some major roads in Seattle, Washington, USA are misstagged in Daylight 1.15 -echo -e "\nFixing funky road classification in Seattle, Washington, USA in OSM" -psql $PSQLOPTS $@ -f apply-highway_99_fixes.sql +#echo -e "\nFixing funky road classification in Seattle, Washington, USA in OSM" +#psql $PSQLOPTS $@ -f apply-highway_99_fixes.sql # apply updates in parallel across tables echo -e "\nApplying updates in parallel across tables..." diff --git a/queries.yaml b/queries.yaml index 2fb1a9a89..771a9c5c8 100644 --- a/queries.yaml +++ b/queries.yaml @@ -153,11 +153,15 @@ sources: - template: buffered_land.jinja2 start_zoom: 8 + contours: + - template: contours.jinja2 + start_zoom: 13 + layers: water: geometry_types: [Point, MultiPoint, Polygon, MultiPolygon, LineString, MultiLineString] simplify_before_intersect: true - simplify_start: 0 + simplify_start: 8 transform: - vectordatasource.transform.tags_create_dict - vectordatasource.transform.tags_name_i18n @@ -167,13 +171,13 @@ layers: - vectordatasource.transform.add_id_to_properties - vectordatasource.transform.detect_osm_relation - vectordatasource.transform.remove_feature_id - - vectordatasource.transform.truncate_min_zoom_to_1dp + - vectordatasource.transform.truncate_min_zoom_to_2dp sort: vectordatasource.sort.water area-inclusion-threshold: 1 earth: geometry_types: [Point, MultiPoint, Polygon, MultiPolygon, LineString, MultiLineString] simplify_before_intersect: true - simplify_start: 0 + simplify_start: 8 transform: - vectordatasource.transform.tags_create_dict - vectordatasource.transform.tags_name_i18n @@ -181,7 +185,7 @@ layers: - vectordatasource.transform.detect_osm_relation - vectordatasource.transform.add_id_to_properties - vectordatasource.transform.remove_feature_id - - vectordatasource.transform.truncate_min_zoom_to_1dp + - vectordatasource.transform.truncate_min_zoom_to_2dp sort: vectordatasource.sort.earth area-inclusion-threshold: 1 places: @@ -216,13 +220,13 @@ layers: - vectordatasource.transform.remove_feature_id - vectordatasource.transform.normalize_operator_values - vectordatasource.transform.major_airport_detector - - vectordatasource.transform.truncate_min_zoom_to_1dp + - vectordatasource.transform.truncate_min_zoom_to_2dp sort: vectordatasource.sort.landuse area-inclusion-threshold: 1 roads: geometry_types: [LineString, MultiLineString] - simplify_start: 4 - tolerance: 1.0 + simplify_start: 8 + tolerance: 2.0 transform: - vectordatasource.transform.tags_create_dict - vectordatasource.transform.tags_name_i18n @@ -241,7 +245,7 @@ layers: - vectordatasource.transform.road_trim_properties - vectordatasource.transform.remove_feature_id - vectordatasource.transform.tags_remove - - vectordatasource.transform.truncate_min_zoom_to_1dp + - vectordatasource.transform.truncate_min_zoom_to_2dp sort: vectordatasource.sort.roads area-inclusion-threshold: 1 buildings: @@ -263,7 +267,7 @@ layers: - vectordatasource.transform.normalize_tourism_kind - vectordatasource.transform.building_trim_properties - vectordatasource.transform.remove_feature_id - - vectordatasource.transform.truncate_min_zoom_to_1dp + - vectordatasource.transform.truncate_min_zoom_to_2dp sort: vectordatasource.sort.buildings area-inclusion-threshold: 1 pois: @@ -288,14 +292,14 @@ layers: - vectordatasource.transform.major_airport_detector - vectordatasource.transform.elevation_to_meters - vectordatasource.transform.normalize_operator_values - - vectordatasource.transform.truncate_min_zoom_to_1dp + - vectordatasource.transform.truncate_min_zoom_to_2dp sort: vectordatasource.sort.pois area-inclusion-threshold: 1 boundaries: geometry_types: [Polygon, MultiPolygon, LineString, MultiLineString] simplify_before_intersect: true - simplify_start: 0 - tolerance: 1.0 + simplify_start: 8 + tolerance: 2.0 transform: - vectordatasource.transform.tags_create_dict - vectordatasource.transform.tags_name_i18n @@ -303,7 +307,7 @@ layers: - vectordatasource.transform.add_id_to_properties - vectordatasource.transform.detect_osm_relation - vectordatasource.transform.remove_feature_id - - vectordatasource.transform.truncate_min_zoom_to_1dp + - vectordatasource.transform.truncate_min_zoom_to_2dp - vectordatasource.transform.remap_viewpoint_kinds - vectordatasource.transform.unpack_viewpoint_claims # note: the next line needs to come after anything else that touches the kind:XX values. @@ -314,7 +318,7 @@ layers: area-inclusion-threshold: 1 transit: geometry_types: [LineString, MultiLineString, Polygon, MultiPolygon] - simplify_start: 5 + simplify_start: 8 tolerance: 1.0 transform: - vectordatasource.transform.tags_create_dict @@ -326,7 +330,7 @@ layers: - vectordatasource.transform.route_name - vectordatasource.transform.parse_layer_as_float - vectordatasource.transform.remove_feature_id - - vectordatasource.transform.truncate_min_zoom_to_1dp + - vectordatasource.transform.truncate_min_zoom_to_2dp sort: vectordatasource.sort.transit area-inclusion-threshold: 1 admin_areas: @@ -341,6 +345,15 @@ layers: - vectordatasource.transform.add_id_to_properties - vectordatasource.transform.remove_feature_id area-inclusion-threshold: 1 + contours: + geometry_types: [LineString, MultiLineString] + simplify_start: 999 + tolerance: 2.0 + transform: + - vectordatasource.transform.tags_create_dict + - vectordatasource.transform.tags_name_i18n + - vectordatasource.transform.tags_remove + area-inclusion-threshold: 1 # optional inline layer, if the file is found on disk it will be used landmarks: geometry_types: [Point, Polygon, MultiPolygon] @@ -397,6 +410,7 @@ post_process: scree: barren shingle: barren stone: barren + fell: barren # desert bare_rock: desert @@ -504,6 +518,15 @@ post_process: params: source_layer: transit target_value_type: int + - fn: vectordatasource.transform.csv_match_properties + resources: + matcher: + type: file + init_fn: vectordatasource.transform.CSVMatcher + path: spreadsheets/sort_rank/contours.csv + params: + source_layer: contours + target_value_type: int # this needs to run before the water sort_rank csv matcher - fn: vectordatasource.transform.exterior_boundaries params: @@ -777,7 +800,7 @@ post_process: params: source_layer: boundaries start_zoom: 0 - end_zoom: 14 + end_zoom: 11 properties: - id - "id:left" @@ -947,7 +970,6 @@ post_process: properties: - id - area - - boundary - layer - wikidata_id - osm_relation @@ -1895,7 +1917,6 @@ post_process: - addr_housenumber - addr_street - osm_relation - exclude: ['superseded_by'] # NOTE: max_merged_features is set to keep the time taken for geometry # merging down, as it seems to go up with the square of the number of # features. diff --git a/queries/contours.jinja2 b/queries/contours.jinja2 new file mode 100644 index 000000000..14484a725 --- /dev/null +++ b/queries/contours.jinja2 @@ -0,0 +1,30 @@ +SELECT + + osm_id AS __id__, + + {% filter geometry %}{{ bounds['line']|bbox_intersection('way') }}{% endfilter %} AS __geometry__, + + -- common properties across all layers + jsonb_build_object( + 'source', 'viewfinderpanoramas.org', + 'min_zoom', 13, + 'ele', ele + ) AS __contours_properties__ + +FROM ( + + SELECT + + osm_id, + ele, + way + + FROM + + contours + + WHERE + + {{ bounds['line']|bbox_filter('way', 3857) }} + +) p diff --git a/requirements.txt b/requirements.txt index 41ff1af31..0b8752e83 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,6 +3,7 @@ argparse==1.4.0 ASTFormatter==0.6.4 boto==2.49.0 edtf==2.6.0 +fiona==1.8.22 future==0.16.0 gunicorn==19.9.0 hanzidentifier==1.0.2 @@ -25,10 +26,11 @@ Shapely==1.6.2.post1 simplejson==3.12.0 six==1.11.0 StreetNames==0.1.5 -git+https://github.com/tilezen/tilequeue@master#egg=tilequeue +git+https://github.com/rwrx/tilequeue@master#egg=tilequeue git+https://github.com/tilezen/tileserver@master#egg=tileserver tqdm==4.31.1 urllib3==1.25.11 webcolors<=1.11 ## Last version to support py2 Werkzeug<=0.16.1 wsgiref==0.1.2 +zope.dottedname==4.2 diff --git a/spreadsheets/collision_rank.yaml b/spreadsheets/collision_rank.yaml index 7c93ddcfd..ad2c82e08 100644 --- a/spreadsheets/collision_rank.yaml +++ b/spreadsheets/collision_rank.yaml @@ -676,7 +676,7 @@ - {$layer: 'landuse', kind: 'land'} - {$layer: 'landuse', kind: 'dam'} - {$layer: 'landuse', kind: 'groyne'} -- {$layer: 'landuse', kind: 'dike'} +- {$layer: 'landuse', kind: 'dyke'} - {$layer: 'landuse', kind: 'pier'} - {$layer: 'landuse', kind: 'bridge'} - {$layer: 'pois', kind: 'stop_area'} @@ -1020,5 +1020,8 @@ - {$layer: 'pois', kind: 'waste_basket'} - {$layer: 'pois', kind: 'water_point'} - {$layer: 'pois', kind: 'watering_place'} +# for contours +- _reserved: {count: 10} +- {$layer: 'contours', kind: 'contour'} # catch-all, assign lowest priority - { $layer: true } diff --git a/spreadsheets/sort_rank/contours.csv b/spreadsheets/sort_rank/contours.csv new file mode 100644 index 000000000..c3d2daff4 --- /dev/null +++ b/spreadsheets/sort_rank/contours.csv @@ -0,0 +1,2 @@ +kind,sort_rank +*,225 diff --git a/spreadsheets/sort_rank/landuse.csv b/spreadsheets/sort_rank/landuse.csv index 01b405dd1..7e27fa462 100644 --- a/spreadsheets/sort_rank/landuse.csv +++ b/spreadsheets/sort_rank/landuse.csv @@ -13,7 +13,7 @@ tree_row,*,264 hedge,*,263 bridge,*,229 pier,*,228 -dike,*,227 +dyke,*,227 cutline,*,226 groyne,*,225 breakwater,*,224 diff --git a/spreadsheets/sort_rank/water.csv b/spreadsheets/sort_rank/water.csv index 7fe007227..24b1483ae 100644 --- a/spreadsheets/sort_rank/water.csv +++ b/spreadsheets/sort_rank/water.csv @@ -9,6 +9,7 @@ layer::int,kind,boundary,sort_rank -3,riverbank,-,7 -4,riverbank,-,6 -5,riverbank,-,5 +*,weir,-,205 *,riverbank,-,204 *,playa,-,203 -1,river,-,9 diff --git a/test/test_meta.py b/test/test_meta.py index f061193c5..577938420 100644 --- a/test/test_meta.py +++ b/test/test_meta.py @@ -81,12 +81,12 @@ def setUpClass(cls): cls.layer_data, cls.by_name = make_layer_data_props() def test_layer_data_count(self): - self.assertEquals(10, len(self.layer_data)) + self.assertEquals(11, len(self.layer_data)) def test_layer_names(self): exp_layers = set(('landuse', 'pois', 'transit', 'water', 'places', 'boundaries', 'buildings', 'roads', 'earth', - 'admin_areas')) + 'admin_areas', 'contours')) self.assertEquals(exp_layers, set(self.by_name.keys())) def test_layers_called_empty_feature(self): diff --git a/tilejson/tilejson.json.erb b/tilejson/tilejson.json.erb index 4371630e3..aa41f9e0a 100644 --- a/tilejson/tilejson.json.erb +++ b/tilejson/tilejson.json.erb @@ -56,7 +56,7 @@ "kind" : "String. Common value, one of: address, building, building_part, entrance, exit.", "kind_detail" : "String. Common value, one of: abandoned, administrative, agricultural, airport, allotment_house, apartments, arbour, arch, balcony, bank, barn, base, basilica, beach_hut, bell_tower, boathouse, brewery, bridge, bungalow, bunker, cabin, carport, castle, cathedral, chapel, chimney, church, civic, clinic, clubhouse, collapsed, college, column, commercial, construction, container, convent, cowshed, dam, damaged, depot, destroyed, detached, disused, door, dormitory, duplex, elevator, emergency, entrance, factory, farm, farm_auxiliary, fire_exit, fire_station, floor, garage, garages, gazebo, ger, glasshouse, government, grandstand, greenhouse, hall, hangar, healthcare, hermitage, home, hospital, hotel, house, houseboat, hut, industrial, kindergarten, kiosk, library, main, mall, manor, manufacture, mixed_use, mobile_home, monastery, mortuary, mosque, museum, office, or unisex, outbuilding, parking, passageway, pavilion, pillar, porch, power, prison, private, proposed, pub, public, ramp, residence, residential, restaurant, retail, roof, room, ruin, ruins, school, secondary, semidetached_house, service, shed, shelter, shop, shrine, silo, slurry_tank, stable, stadium, staircase, static_caravan, steps, stilobate, storage, storage_tank, store, substation, summer_cottage, summer_house, supermarket, synagogue, tank, temple, terrace, tier, tower, train_station, transformer_tower, transportation, university, utility, veranda, verticalpassage, wall, warehouse, wayside_shrine, window, works.", "source" : "String. Common value, one of: openstreetmap.org.", - "landuse_kind" : "String. Tilezen calculates the `landuse_kind` value by intercutting `buildings` with the `landuse` layer to determine if a building is over a parks, hospitals, universities or other landuse features. Common value, one of: aerodrome, allotments, amusement_ride, animal, apron, aquarium, artwork, attraction, aviary, battlefield, beach, breakwater, bridge, camp_site, caravan_site, carousel, cemetery, cinema, city_wall, college, commercial, common, cutline, dam, dike, dog_park, enclosure, farm, farmland, farmyard, fence, footway, forest, fort, fuel, garden, gate, generator, glacier, golf_course, grass, groyne, hanami, hospital, industrial, land, library, maze, meadow, military, national_park, nature_reserve, park, parking, pedestrian, petting_zoo, picnic_site, pier, pitch, place_of_worship, plant, playground, prison, protected_area, quarry, railway, recreation_ground, recreation_track, residential, resort, rest_area, retail, retaining_wall, rock, roller_coaster, runway, rural, school, scree, scrub, service_area, snow_fence, sports_centre, stadium, stone, substation, summer_toboggan, taxiway, theatre, theme_park, tower, trail_riding_station, university, urban_area, urban, village_green, wastewater_plant, water_park, water_slide, water_works, wetland, wilderness_hut, wildlife_park, winery, winter_sports, wood, works, zoo.", + "landuse_kind" : "String. Tilezen calculates the `landuse_kind` value by intercutting `buildings` with the `landuse` layer to determine if a building is over a parks, hospitals, universities or other landuse features. Common value, one of: aerodrome, allotments, amusement_ride, animal, apron, aquarium, artwork, attraction, aviary, battlefield, beach, breakwater, bridge, camp_site, caravan_site, carousel, cemetery, cinema, city_wall, college, commercial, common, cutline, dam, dyke, dog_park, enclosure, farm, farmland, farmyard, fence, footway, forest, fort, fuel, garden, gate, generator, glacier, golf_course, grass, groyne, hanami, hospital, industrial, land, library, maze, meadow, military, national_park, nature_reserve, park, parking, pedestrian, petting_zoo, picnic_site, pier, pitch, place_of_worship, plant, playground, prison, protected_area, quarry, railway, recreation_ground, recreation_track, residential, resort, rest_area, retail, retaining_wall, rock, roller_coaster, runway, rural, school, scree, scrub, service_area, snow_fence, sports_centre, stadium, stone, substation, summer_toboggan, taxiway, theatre, theme_park, tower, trail_riding_station, university, urban_area, urban, village_green, wastewater_plant, water_park, water_slide, water_works, wetland, wilderness_hut, wildlife_park, winery, winter_sports, wood, works, zoo.", "sort_rank" : "Integer. Suggestion for which order to draw features (lower values are bottom, bigger values on top). Common value.", "collision_rank" : "Integer. Common property. Suggestion for which order labels should collide. Use as tie breaker with min_zoom.", "min_zoom" : "Number. A suggested minimum zoom at which the features should become visible (eg: based on area and volume limits). Common value.", @@ -101,7 +101,7 @@ "name" : "String. Localized name variants are in properties like 'name:en'. Common value.", "id" : "Integer. Common value.", "source" : "String. Common value, one of: openstreetmap.org, naturalearthdata.com.", - "kind" : "String. Common value, one of: aerodrome, airfield, allotments, amusement_ride, animal, apron, aquarium, artwork, attraction, aviary, bare_rock, barren, battlefield, beach, boatyard, breakwater, bridge, camp_site, caravan_site, carousel, cemetery, cinema, city_wall, college, commercial, common, container_terminal, crane, cutline, cutting, dam, danger_area, desert, dike, ditch, dog_park, embankment, enclosure, farm, farmland, farmyard, fence, fence, ferry_terminal, footway, forest, fort, fuel, garden, gate, generator, glacier, golf_course, grass, grassland, groyne, guard_rail, hanami, harbour, heath, hospital, industrial, kerb, land, library, maze, meadow, military, mud, national_park, nature_reserve, naval_base, orchard, park, parking, pedestrian, petting_zoo, picnic_site, pier, pier, pitch, place_of_worship, plant, plant_nursery, playground, port, port_terminal, power_line, power_minor_line, prison, protected_area, quarry, quay, railway, range, recreation_ground, recreation_track, residential, resort, rest_area, retail, retaining_wall, rock, roller_coaster, runway, rural, sand, school, scree, scrub, service_area, shingle, shipyard, snow_fence, sports_centre, stadium, stone, substation, summer_toboggan, taxiway, theatre, theme_park, tower, trail_riding_station, university, urban, urban_area, village_green, vineyard, wall, wastewater_plant, water_park, water_slide, water_works, wetland, wharf, wilderness_hut, wildlife_park, winery, winter_sports, wood, works, zoo, low_emission_zone.", + "kind" : "String. Common value, one of: aerodrome, airfield, allotments, amusement_ride, animal, apron, aquarium, artwork, attraction, aviary, bare_rock, barren, battlefield, beach, boatyard, breakwater, bridge, camp_site, caravan_site, carousel, cemetery, cinema, city_wall, college, commercial, common, container_terminal, crane, cutline, cutting, dam, danger_area, desert, dyke, ditch, dog_park, embankment, enclosure, farm, farmland, farmyard, fence, fence, ferry_terminal, footway, forest, fort, fuel, garden, gate, generator, glacier, golf_course, grass, grassland, groyne, guard_rail, hanami, harbour, heath, hospital, industrial, kerb, land, library, maze, meadow, military, mud, national_park, nature_reserve, naval_base, orchard, park, parking, pedestrian, petting_zoo, picnic_site, pier, pier, pitch, place_of_worship, plant, plant_nursery, playground, port, port_terminal, power_line, power_minor_line, prison, protected_area, quarry, quay, railway, range, recreation_ground, recreation_track, residential, resort, rest_area, retail, retaining_wall, rock, roller_coaster, runway, rural, sand, school, scree, scrub, service_area, shingle, fell, shipyard, snow_fence, sports_centre, stadium, stone, substation, summer_toboggan, taxiway, theatre, theme_park, tower, trail_riding_station, university, urban, urban_area, village_green, vineyard, wall, wastewater_plant, water_park, water_slide, water_works, wetland, wharf, wilderness_hut, wildlife_park, winery, winter_sports, wood, works, zoo, low_emission_zone.", "kind_detail" : "String. Common optional value.", "min_zoom" : "Number. A suggested minimum zoom at which the features should become visible. Common value.", "sort_rank" : "Integer. Suggestion for which order to draw features (lower values are bottom, bigger values on top). Common value.", @@ -196,7 +196,7 @@ "source" : "String. Common value, one of: openstreetmap.org, naturalearthdata.com.", "min_zoom" : "Number. A suggested minimum zoom at which the features should become visible. Common value.", "kind" : "String. Common value, one of: aerialway, exit, ferry, highway, major_road, minor_road, path, piste, quay, racetrack, rail.", - "landuse_kind" : "String. Tilezen calculates the `landuse_kind` value by intercutting `buildings` with the `landuse` layer to determine if a building is over a parks, hospitals, universities or other landuse features. Common value, one of: aerodrome, allotments, amusement_ride, animal, apron, aquarium, artwork, attraction, aviary, battlefield, beach, breakwater, bridge, camp_site, caravan_site, carousel, cemetery, cinema, city_wall, college, commercial, common, cutline, dam, dike, dog_park, enclosure, farm, farmland, farmyard, fence, footway, forest, fort, fuel, garden, gate, generator, glacier, golf_course, grass, groyne, hanami, hospital, industrial, land, library, maze, meadow, military, national_park, nature_reserve, park, parking, pedestrian, petting_zoo, picnic_site, pier, pitch, place_of_worship, plant, playground, prison, protected_area, quarry, railway, recreation_ground, recreation_track, residential, resort, rest_area, retail, retaining_wall, rock, roller_coaster, runway, rural, school, scree, scrub, service_area, snow_fence, sports_centre, stadium, stone, substation, summer_toboggan, taxiway, theatre, theme_park, tower, trail_riding_station, university, urban_area, urban, village_green, wastewater_plant, water_park, water_slide, water_works, wetland, wilderness_hut, wildlife_park, winery, winter_sports, wood, works, zoo.", + "landuse_kind" : "String. Tilezen calculates the `landuse_kind` value by intercutting `buildings` with the `landuse` layer to determine if a building is over a parks, hospitals, universities or other landuse features. Common value, one of: aerodrome, allotments, amusement_ride, animal, apron, aquarium, artwork, attraction, aviary, battlefield, beach, breakwater, bridge, camp_site, caravan_site, carousel, cemetery, cinema, city_wall, college, commercial, common, cutline, dam, dog_park, dyke, enclosure, farm, farmland, farmyard, fence, footway, forest, fort, fuel, garden, gate, generator, glacier, golf_course, grass, groyne, hanami, hospital, industrial, land, library, maze, meadow, military, national_park, nature_reserve, park, parking, pedestrian, petting_zoo, picnic_site, pier, pitch, place_of_worship, plant, playground, prison, protected_area, quarry, railway, recreation_ground, recreation_track, residential, resort, rest_area, retail, retaining_wall, rock, roller_coaster, runway, rural, school, scree, scrub, service_area, snow_fence, sports_centre, stadium, stone, substation, summer_toboggan, taxiway, theatre, theme_park, tower, trail_riding_station, university, urban_area, urban, village_green, wastewater_plant, water_park, water_slide, water_works, wetland, wilderness_hut, wildlife_park, winery, winter_sports, wood, works, zoo.", "ref" : "String. Used for road shields. Common value.", "sort_rank" : "Integer. Suggestion for which order to draw features (lower values are bottom, bigger values on top). Common value.", "collision_rank" : "Integer. Common property. Suggestion for which order labels should collide. Use as tie breaker with min_zoom.", diff --git a/vectordatasource/meta/python.py b/vectordatasource/meta/python.py index 4fc4eb2a1..7fe2c01c0 100644 --- a/vectordatasource/meta/python.py +++ b/vectordatasource/meta/python.py @@ -582,7 +582,7 @@ def compile(self, matchers, fn_name): def parse_layers(yaml_path, output_fn, fn_name_fn): layer_data = [] layers = ('landuse', 'pois', 'transit', 'water', 'places', 'boundaries', - 'buildings', 'roads', 'earth', 'admin_areas') + 'buildings', 'roads', 'earth', 'admin_areas', 'contours') filter_compiler = FilterCompiler() diff --git a/vectordatasource/meta/sql.py b/vectordatasource/meta/sql.py index 46ac74535..cf02680e6 100644 --- a/vectordatasource/meta/sql.py +++ b/vectordatasource/meta/sql.py @@ -55,6 +55,9 @@ 'ne_10m_roads', 'planet_osm_line', ], + 'contours': [ + 'contours', + ], 'transit': [ 'planet_osm_line', 'planet_osm_polygon', @@ -689,6 +692,8 @@ def table_is_polygonal(name): def calculate_meta_source_for_table(name): if table_is_osm(name) or name == 'admin_areas': return 'osm' + elif name == 'contours': + return 'vfp' elif name.startswith('ne_'): return 'ne' elif name.startswith('wof_'): diff --git a/vectordatasource/sort.py b/vectordatasource/sort.py index a8f9e6c5a..1966bd66a 100644 --- a/vectordatasource/sort.py +++ b/vectordatasource/sort.py @@ -95,3 +95,7 @@ def water(features, zoom): def transit(features, zoom): return _sort_features_by_key(features, _by_feature_id) + + +def contours(features, zoom): + return _sort_by_area_then_id(features) diff --git a/vectordatasource/transform.py b/vectordatasource/transform.py index 4657f60d2..286cb56e6 100644 --- a/vectordatasource/transform.py +++ b/vectordatasource/transform.py @@ -6049,7 +6049,7 @@ def _do_not_backfill(tags): return None -def _sort_network_us(network, ref): +def _sort_network_us(network, ref, osmc_symbol): if network is None: network_code = 9999 elif network == 'US:I': @@ -6078,7 +6078,7 @@ def _sort_network_us(network, ref): } -def _sort_network_au(network, ref): +def _sort_network_au(network, ref, osmc_symbol): if network is None or \ not network.startswith('AU:'): network_code = 9999 @@ -6090,7 +6090,7 @@ def _sort_network_au(network, ref): return network_code * 10000 + min(ref, 9999) -def _sort_network_br(network, ref): +def _sort_network_br(network, ref, osmc_symbol): if network is None: network_code = 9999 elif network == 'BR:Trans-Amazonian': @@ -6103,7 +6103,7 @@ def _sort_network_br(network, ref): return network_code * 10000 + min(ref, 9999) -def _sort_network_ca(network, ref): +def _sort_network_ca(network, ref, osmc_symbol): if network is None: network_code = 9999 elif network == 'CA:transcanada': @@ -6118,7 +6118,7 @@ def _sort_network_ca(network, ref): return network_code * 10000 + min(ref, 9999) -def _sort_network_ch(network, ref): +def _sort_network_ch(network, ref, osmc_symbol): if network is None: network_code = 9999 elif network == 'CH:national': @@ -6135,7 +6135,7 @@ def _sort_network_ch(network, ref): return network_code * 10000 + min(ref, 9999) -def _sort_network_cn(network, ref): +def _sort_network_cn(network, ref, osmc_symbol): if network is None: network_code = 9999 elif network == 'CN:expressway': @@ -6154,7 +6154,7 @@ def _sort_network_cn(network, ref): return network_code * 10000 + min(ref, 9999) -def _sort_network_es(network, ref): +def _sort_network_es(network, ref, osmc_symbol): if network is None: network_code = 9999 elif network == 'ES:A-road': @@ -6177,7 +6177,7 @@ def _sort_network_es(network, ref): return network_code * 10000 + min(ref, 9999) -def _sort_network_fr(network, ref): +def _sort_network_fr(network, ref, osmc_symbol): if network is None: network_code = 9999 elif network == 'FR:A-road': @@ -6198,7 +6198,7 @@ def _sort_network_fr(network, ref): return network_code * 10000 + min(ref, 9999) -def _sort_network_de(network, ref): +def _sort_network_de(network, ref, osmc_symbol): if network is None: network_code = 9999 elif network == 'DE:BAB': @@ -6223,7 +6223,7 @@ def _sort_network_de(network, ref): return network_code * 10000 + min(ref, 9999) -def _sort_network_ga(network, ref): +def _sort_network_ga(network, ref, osmc_symbol): if network is None: network_code = 9999 elif network == 'GA:national': @@ -6238,7 +6238,7 @@ def _sort_network_ga(network, ref): return network_code * 10000 + min(ref, 9999) -def _sort_network_gr(network, ref): +def _sort_network_gr(network, ref, osmc_symbol): if network is None: network_code = 9999 elif network == 'GR:motorway': @@ -6255,7 +6255,7 @@ def _sort_network_gr(network, ref): return network_code * 10000 + min(ref, 9999) -def _sort_network_in(network, ref): +def _sort_network_in(network, ref, osmc_symbol): if network is None: network_code = 9999 elif network == 'IN:NH': @@ -6272,7 +6272,7 @@ def _sort_network_in(network, ref): return network_code * 10000 + min(ref, 9999) -def _sort_network_ir(network, ref): +def _sort_network_ir(network, ref, osmc_symbol): if network is None: network_code = 9999 elif network == 'AsianHighway': @@ -6285,7 +6285,7 @@ def _sort_network_ir(network, ref): return network_code * 10000 + min(ref, 9999) -def _sort_network_kz(network, ref): +def _sort_network_kz(network, ref, osmc_symbol): if network is None: network_code = 9999 elif network == 'KZ:national': @@ -6304,7 +6304,7 @@ def _sort_network_kz(network, ref): return network_code * 10000 + min(ref, 9999) -def _sort_network_la(network, ref): +def _sort_network_la(network, ref, osmc_symbol): if network is None: network_code = 9999 elif network == 'LA:national': @@ -6319,7 +6319,7 @@ def _sort_network_la(network, ref): return network_code * 10000 + min(ref, 9999) -def _sort_network_mx(network, ref): +def _sort_network_mx(network, ref, osmc_symbol): if network is None: network_code = 9999 elif network == 'MX:MEX': @@ -6332,7 +6332,7 @@ def _sort_network_mx(network, ref): return network_code * 10000 + min(ref, 9999) -def _sort_network_my(network, ref): +def _sort_network_my(network, ref, osmc_symbol): if network is None: network_code = 9999 elif network == 'MY:federal': @@ -6349,7 +6349,7 @@ def _sort_network_my(network, ref): return network_code * 10000 + min(ref, 9999) -def _sort_network_no(network, ref): +def _sort_network_no(network, ref, osmc_symbol): if network is None: network_code = 9999 elif network == 'NO:oslo:ring': @@ -6368,7 +6368,7 @@ def _sort_network_no(network, ref): return network_code * 10000 + min(ref, 9999) -def _sort_network_gb(network, ref): +def _sort_network_gb(network, ref, osmc_symbol): if network is None: network_code = 9999 elif network == 'GB:M-road': @@ -6389,7 +6389,7 @@ def _sort_network_gb(network, ref): return network_code * 10000 + min(ref, 9999) -def _sort_network_pl(network, ref): +def _sort_network_pl(network, ref, osmc_symbol): if network is None: network_code = 9999 elif network == 'PL:motorway': @@ -6408,7 +6408,7 @@ def _sort_network_pl(network, ref): return network_code * 10000 + min(ref, 9999) -def _sort_network_pt(network, ref): +def _sort_network_pt(network, ref, osmc_symbol): if network is None: network_code = 9999 elif network == 'PT:motorway': @@ -6437,7 +6437,7 @@ def _sort_network_pt(network, ref): return network_code * 10000 + min(ref, 9999) -def _sort_network_ro(network, ref): +def _sort_network_ro(network, ref, osmc_symbol): if network is None: network_code = 9999 elif network == 'RO:motorway': @@ -6458,7 +6458,7 @@ def _sort_network_ro(network, ref): return network_code * 10000 + min(ref, 9999) -def _sort_network_ru(network, ref): +def _sort_network_ru(network, ref, osmc_symbol): ref = _make_unicode_or_none(ref) if network is None: @@ -6489,7 +6489,7 @@ def _sort_network_ru(network, ref): return network_code * 10000 + min(ref, 9999) -def _sort_network_tr(network, ref): +def _sort_network_tr(network, ref, osmc_symbol): ref = _make_unicode_or_none(ref) if network is None: @@ -6522,7 +6522,7 @@ def _sort_network_tr(network, ref): return network_code * 10000 + min(ref, 9999) -def _sort_network_ua(network, ref): +def _sort_network_ua(network, ref, osmc_symbol): ref = _make_unicode_or_none(ref) if network is None: @@ -6548,7 +6548,7 @@ def _sort_network_ua(network, ref): return network_code * 10000 + min(ref, 9999) -def _sort_network_vn(network, ref): +def _sort_network_vn(network, ref, osmc_symbol): if network is None: network_code = 9999 elif network == 'VN:expressway': @@ -6572,7 +6572,7 @@ def _sort_network_vn(network, ref): return network_code * 10000 + min(ref, 9999) -def _sort_network_za(network, ref): +def _sort_network_za(network, ref, osmc_symbol): if network is None: network_code = 9999 elif network == 'ZA:national': @@ -7938,6 +7938,8 @@ def merge_networks_from_tags(shape, props, fid, zoom): network = props.get('network') ref = props.get('ref') + osmc_symbol = props.get('osmc:symbol') + mz_networks = props.get('mz_networks', []) country_code = props.get('country_code') @@ -7947,8 +7949,8 @@ def merge_networks_from_tags(shape, props, fid, zoom): # * if they begin with two letters and a dash, then make the letters upper # case and replace the dash with a colon. # * expand ;-delimited lists in refs - for i in xrange(0, len(mz_networks), 3): - t, n, r = mz_networks[i:i+3] + for i in xrange(0, len(mz_networks), 4): + t, n, r, o = mz_networks[i:i+4] if t == 'road' and n is not None: n = _fixup_network_country_code(n) mz_networks[i+1] = n @@ -7956,7 +7958,7 @@ def merge_networks_from_tags(shape, props, fid, zoom): refs = r.split(';') mz_networks[i+2] = refs.pop() for new_ref in refs: - mz_networks.extend((t, n, new_ref)) + mz_networks.extend((t, n, new_ref, o)) # for road networks, if there's no explicit network, but the country code # and ref are both available, then try to use them to back-fill the @@ -7972,8 +7974,8 @@ def merge_networks_from_tags(shape, props, fid, zoom): # then use the network from the relation instead. if network is None: solo_networks_from_relations = [] - for i in xrange(0, len(mz_networks), 3): - t, n, r = mz_networks[i:i+3] + for i in xrange(0, len(mz_networks), 4): + t, n, r, o = mz_networks[i:i+4] if t == 'road' and n and (r is None or r == ref): solo_networks_from_relations.append((n, i)) @@ -7986,7 +7988,7 @@ def merge_networks_from_tags(shape, props, fid, zoom): # add network back into properties in case we need to pass it # to the backfill. props['network'] = network - del mz_networks[i:i+3] + del mz_networks[i:i+4] if logic and logic.backfill: networks_and_refs = logic.backfill(props) or [] @@ -8013,8 +8015,8 @@ def merge_networks_from_tags(shape, props, fid, zoom): # an entry in mz_networks with the same ref! if ref: found = False - for i in xrange(0, len(mz_networks), 3): - t, _, r = mz_networks[i:i+3] + for i in xrange(0, len(mz_networks), 4): + t, _, r, _ = mz_networks[i:i+4] if t == 'road' and r == ref: found = True break @@ -8033,7 +8035,7 @@ def merge_networks_from_tags(shape, props, fid, zoom): if network and ref: props.pop('network', None) props.pop('ref') - mz_networks.extend([_guess_type_from_network(network), network, ref]) + mz_networks.extend([_guess_type_from_network(network), network, ref, osmc_symbol]) if mz_networks: props['mz_networks'] = mz_networks @@ -8046,7 +8048,7 @@ def merge_networks_from_tags(shape, props, fid, zoom): _ANY_NUMBER = re.compile('[^0-9]*([0-9]+)') -def _default_sort_network(network, ref): +def _default_sort_network(network, ref, osmc_symbol): """ Returns an integer representing the numeric importance of the network, where lower numbers are more important. @@ -8113,15 +8115,15 @@ def _generic_network_importance(network, ref, codes): return code * 10000 + min(ref, 9999) -def _walking_network_importance(network, ref): +def _walking_network_importance(network, ref, osmc_symbol): return _generic_network_importance(network, ref, _WALKING_NETWORK_CODES) -def _bicycle_network_importance(network, ref): +def _bicycle_network_importance(network, ref, osmc_symbol): return _generic_network_importance(network, ref, _BICYCLE_NETWORK_CODES) -def _bus_network_importance(network, ref): +def _bus_network_importance(network, ref, osmc_symbol): return _generic_network_importance(network, ref, {}) @@ -8253,14 +8255,15 @@ def extract_network_information(shape, properties, fid, zoom): itr = iter(mz_networks) groups = defaultdict(list) - for (type, network, ref) in zip(itr, itr, itr): + for (type, network, ref, osmc_symbol) in zip(itr, itr, itr, itr): n = _NETWORKS.get(type) if n: - groups[n].append([network, ref]) + groups[n].append([network, ref, osmc_symbol]) for network, vals in groups.items(): all_networks = 'all_' + network.prefix + 'networks' all_shield_texts = 'all_' + network.prefix + 'shield_texts' + all_osmc_symbols = 'all_' + network.prefix + 'osmc_symbols' shield_text_fn = network.shield_text_fn if network is _ROAD_NETWORK and country_logic and \ @@ -8269,7 +8272,8 @@ def extract_network_information(shape, properties, fid, zoom): shield_texts = list() network_names = list() - for network_name, ref in vals: + osmc_symbols = list() + for network_name, ref, osmc_symbol in vals: network_names.append(network_name) ref = _make_unicode_or_none(ref) @@ -8283,9 +8287,11 @@ def extract_network_information(shape, properties, fid, zoom): ref = ref.encode('utf-8') shield_texts.append(ref) + osmc_symbols.append(osmc_symbol) properties[all_networks] = network_names properties[all_shield_texts] = shield_texts + properties[all_osmc_symbols] = osmc_symbols return (shape, properties, fid) @@ -8298,16 +8304,18 @@ def _choose_most_important_network(properties, prefix, importance_fn): all_networks = 'all_' + prefix + 'networks' all_shield_texts = 'all_' + prefix + 'shield_texts' + all_osmc_symbols = 'all_' + prefix + 'osmc_symbols' networks = properties.pop(all_networks, None) shield_texts = properties.pop(all_shield_texts, None) + osmc_symbols = properties.pop(all_osmc_symbols, None) country_code = properties.get('country_code') - if networks and shield_texts: + if networks and shield_texts and osmc_symbols: def network_key(t): return importance_fn(*t) - tuples = sorted(set(zip(networks, shield_texts)), key=network_key) + tuples = sorted(set(zip(networks, shield_texts, osmc_symbols)), key=network_key) # i think most route designers would try pretty hard to make sure that # a segment of road isn't on two routes of different networks but with @@ -8317,22 +8325,24 @@ def network_key(t): # with the same ref (and network != none). seen_ref = set() new_tuples = [] - for network, ref in tuples: + for network, ref, osmc_symbol in tuples: if network: if ref: seen_ref.add(ref) - new_tuples.append((network, ref)) + new_tuples.append((network, ref, osmc_symbol)) elif ref is not None and ref not in seen_ref: # network is None, fall back to the country code - new_tuples.append((country_code, ref)) + new_tuples.append((country_code, ref, osmc_symbol)) tuples = new_tuples if tuples: # expose first network as network/shield_text - network, ref = tuples[0] + network, ref, osmc_symbol = tuples[0] properties[prefix + 'network'] = network + properties[prefix + 'shield_text'] = ref + properties[prefix + 'osmc_symbol'] = osmc_symbol if ref is not None: properties[prefix + 'shield_text'] = ref @@ -8342,6 +8352,17 @@ def network_key(t): # replace properties with sorted versions of themselves properties[all_networks] = [n[0] for n in tuples] properties[all_shield_texts] = [n[1] for n in tuples] + properties[all_osmc_symbols] = [n[2] for n in tuples] + + properties[all_osmc_symbols + '_str'] = '' + + if properties[all_osmc_symbols] is not None: + for x in properties[all_osmc_symbols]: + if x is not None: + properties[all_osmc_symbols + '_str'] += ("," if properties[all_osmc_symbols + '_str'] != '' else '') + x + else: + properties[all_osmc_symbols + '_str'] += ("," if properties[all_osmc_symbols + '_str'] != '' else '') + return properties @@ -8618,10 +8639,10 @@ def _fixup_country_specific_networks(shape, props, fid, zoom): # mz_networks is a list of repeated [type, network, ref, ...], it isn't # nested! itr = iter(mz_networks) - for (type, network, ref) in zip(itr, itr, itr): + for (type, network, ref, osmc_symbol) in zip(itr, itr, itr, itr): if type == 'road': network, ref = logic.fix(network, ref) - new_networks.extend([type, network, ref]) + new_networks.extend([type, network, ref, osmc_symbol]) props['mz_networks'] = new_networks diff --git a/yaml/buildings.yaml b/yaml/buildings.yaml index 2ee6311be..c45800575 100644 --- a/yaml/buildings.yaml +++ b/yaml/buildings.yaml @@ -19,7 +19,9 @@ globals: building_levels: {col: "building:levels"} building_min_levels: {col: "building:min_levels"} building_material: {col: "building:material"} + castle_type: {col: castle_type} height: {col: height} + historic: {col: historic} min_height: {col: min_height} layer: {col: layer} location: {col: location} diff --git a/yaml/contours.yaml b/yaml/contours.yaml new file mode 100644 index 000000000..ab49a814a --- /dev/null +++ b/yaml/contours.yaml @@ -0,0 +1,15 @@ +global: + - &output_properties + source: {col: source} + min_zoom: {col: min_zoom} + # Elevation of the contour in meters. + elevation: {col: ele} + +filters: + - filter: + geom_type: line + min_zoom: 13 + table: vfp + output: + <<: *output_properties + kind: contour diff --git a/yaml/landuse.yaml b/yaml/landuse.yaml index 7ad5db573..680df6419 100644 --- a/yaml/landuse.yaml +++ b/yaml/landuse.yaml @@ -21,6 +21,7 @@ global: zoo: {col: zoo} barrier: {col: barrier} fence_type: {col: fence_type} + crop: {col: crop} min_zoom: case: - when: { meta.source: ne } @@ -882,14 +883,13 @@ filters: <<: *output_properties kind: groyne tier: 4 - # dike + # dyke - filter: - man_made: dike - geom_type: polygon - min_zoom: { max: [ 13, *tier4_min_zoom ] } + man_made: dyke + min_zoom: 13 output: <<: *output_properties - kind: dike + kind: dyke tier: 4 # cutline - filter: @@ -1156,6 +1156,11 @@ filters: output: <<: *output_properties kind: {col: natural} + - filter: {natural: fell} + min_zoom: { clamp: { max: 16, min: 9, value: { col: zoom } } } + output: + <<: *output_properties + kind: fell - filter: {landuse: vineyard} min_zoom: { clamp: { max: 16, min: 9, value: { col: zoom } } } output: diff --git a/yaml/pois.yaml b/yaml/pois.yaml index b9b50cc62..65fce1854 100644 --- a/yaml/pois.yaml +++ b/yaml/pois.yaml @@ -21,6 +21,8 @@ global: exit_to: {col: exit_to} wikidata_id: {col: wikidata} direction: {col: direction} + memorial: {col: memorial} + information: {col: information} - &transit_properties mz_transit_score: {col: mz_transit_score} mz_transit_root_relation_id: {col: mz_transit_root_relation_id} @@ -275,6 +277,7 @@ global: - climbing - cricket - cricket_nets + - croquet - cycling - equestrian - exercise @@ -442,7 +445,7 @@ global: - landuse: quarry - leisure: [ dog_park, firepit, fishing, pitch, playground, slipway, swimming_area ] - lock: yes - - man_made: [ adit, communications_tower, crane, mast, mineshaft, obelisk, observatory, + - man_made: [ adit, communications_tower, chimney, crane, mast, mineshaft, obelisk, observatory, offshore_platform, petroleum_well, power_wind, telescope, water_tower, water_well, watermill, windmill ] - military: bunker @@ -2607,6 +2610,11 @@ filters: - shiploader - tower_crane then: {col: "crane:type"} + - filter: {man_made: chimney} + min_zoom: 14 + output: + <<: *output_properties + kind: chimney - filter: {leisure: water_park} min_zoom: { clamp: { min: 13, max: 15, value: { sum: [ { col: zoom }, 2.34 ] } } } output: diff --git a/yaml/roads.yaml b/yaml/roads.yaml index ef3f9ef35..b5f2a9fa9 100644 --- a/yaml/roads.yaml +++ b/yaml/roads.yaml @@ -27,6 +27,7 @@ global: motor_vehicle: {col: motor_vehicle} access: {col: access} bicycle: {col: bicycle} + man_made: {col: man_made} hgv: case: - when: {hgv: [agricultural, delivery, designated, destination, local, 'no']} @@ -177,31 +178,31 @@ global: - when: sov_a3: CAN level: ['Federal', 'Interstate', 'State'] - then: ['road', 'CA:??:primary', { col: name }] + then: ['road', 'CA:??:primary', { col: name }, { col: "osmc:symbol" }] - when: sov_a3: 'MEX' level: 'Interstate' - then: ['road', 'MX', { col: name }] + then: ['road', 'MX', { col: name }, { col: "osmc:symbol" }] - when: sov_a3: 'MEX' level: 'Federal' - then: ['road', 'MX:MX', { col: name }] + then: ['road', 'MX:MX', { col: name }, { col: "osmc:symbol" }] - when: sov_a3: 'USA' level: 'Interstate' - then: ['road', 'US:I', { col: name }] + then: ['road', 'US:I', { col: name }, { col: "osmc:symbol" }] - when: sov_a3: 'USA' level: 'Federal' - then: ['road', 'US:US', { col: name }] + then: ['road', 'US:US', { col: name }, { col: "osmc:symbol" }] - when: continent: 'Oceania' level: 'Federal' - then: ['road', 'NZ:SH', { col: label}] + then: ['road', 'NZ:SH', { col: label}, { col: "osmc:symbol" }] - when: continent: ['Europe', 'Asia'] level: 'E' - then: ['road', 'e-road', { col: name }] + then: ['road', 'e-road', { col: name }, { col: "osmc:symbol" }] columns: [ sov_a3, continent, label, level ] # tolls toll: diff --git a/yaml/water.yaml b/yaml/water.yaml index d93aa4215..958867beb 100644 --- a/yaml/water.yaml +++ b/yaml/water.yaml @@ -224,6 +224,12 @@ filters: <<: *water_standard_properties_osm kind: drain table: osm + - filter: {waterway: weir} + min_zoom: 14 + output: + <<: *water_standard_properties_osm + kind: weir + table: osm # reef - filter: natural: reef