Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Contours #1925

Open
wants to merge 39 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
010b764
Try add contours layer
rwrx Jul 30, 2019
e3f6290
Add contours layer
rwrx Aug 20, 2019
af927b9
Change min zoom for contours layer to 12
rwrx Aug 20, 2019
c080e56
Contours kind changed to std
rwrx Aug 21, 2019
267ce64
Add fiona module
rwrx Aug 24, 2019
a53f1ef
Add contours table to meta data computation
rwrx Aug 24, 2019
cfbbf7c
Add crop to landuse
rwrx Sep 30, 2019
a1f4643
Add historic and castle_type tags
rwrx Sep 30, 2019
695eb6e
Add man_made tag to roads layer
rwrx Sep 30, 2019
232e531
Add dyke
rwrx Sep 30, 2019
418ad3f
Add chimney to pois
rwrx Sep 30, 2019
642a9dc
Add weir to water layer
rwrx Sep 30, 2019
78dff55
Add to tilejson description
rwrx Sep 30, 2019
929a71f
Add fell
rwrx Sep 30, 2019
96b959f
Remove typo
rwrx Sep 30, 2019
491cf5e
Add dyke to tilejson description
rwrx Sep 30, 2019
adc5b80
Update according to comments
rwrx Sep 30, 2019
7ae7d2a
Update layer tests
rwrx Sep 30, 2019
7fde574
Add support for hiking colours and symbols
rwrx Jun 18, 2022
41ce83f
Change to using osmc:symbol for waymarked hiking routes
rwrx Jun 29, 2022
fa5ccd2
Merge with upstream
rwrx Jul 5, 2022
6317c98
Merge branch 'master' into contours
rwrx Jul 9, 2022
8a8e4c8
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 9, 2022
666a1b8
Add fiona
rwrx Jun 28, 2023
5da5876
Merge v1.9.0
rwrx May 30, 2024
bb871ed
Merge pull request #1 from tilezen/master
rwrx May 31, 2024
8cc10cd
Add croquet
rwrx Jun 3, 2024
b77fc23
Revert simplification and fix missing boundary property for water layer
rwrx Jun 12, 2024
019f204
Update gitignore
rwrx Jun 12, 2024
dc274e8
Merge branch 'chimney'
rwrx Jun 12, 2024
d49abdf
Merge branch 'crop'
rwrx Jun 12, 2024
0b910e4
Merge branch 'dyke'
rwrx Jun 12, 2024
5db46fe
Merge fell
rwrx Jun 12, 2024
385cd1d
Merge branch 'historic'
rwrx Jun 12, 2024
53aeb5e
Merge branch 'man_made'
rwrx Jun 12, 2024
d5b138b
Merge weir
rwrx Jun 12, 2024
cb36bc4
Remove ogr2ogr slipsrc parameter
rwrx Jun 19, 2024
ee08f37
Add information and memorial into poi tags
rwrx Oct 2, 2024
9411f4c
Merge master
rwrx Oct 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion data/Makefile-prepare-data.jinja2
Original file line number Diff line number Diff line change
@@ -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

Expand Down
5 changes: 3 additions & 2 deletions data/functions.sql
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,16 @@ 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
parts && ARRAY[way_id] AND
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;
Expand Down
4 changes: 2 additions & 2 deletions data/perform-sql-updates.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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..."
Expand Down
57 changes: 39 additions & 18 deletions queries.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -167,21 +171,21 @@ 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
- vectordatasource.transform.tags_remove
- 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:
Expand Down Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -288,22 +292,22 @@ 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
- vectordatasource.transform.admin_level_as_int
- 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.
Expand All @@ -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
Expand All @@ -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:
Expand All @@ -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]
Expand Down Expand Up @@ -397,6 +410,7 @@ post_process:
scree: barren
shingle: barren
stone: barren
fell: barren

# desert
bare_rock: desert
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -777,7 +800,7 @@ post_process:
params:
source_layer: boundaries
start_zoom: 0
end_zoom: 14
end_zoom: 11
properties:
- id
- "id:left"
Expand Down Expand Up @@ -947,7 +970,6 @@ post_process:
properties:
- id
- area
- boundary
- layer
- wikidata_id
- osm_relation
Expand Down Expand Up @@ -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.
Expand Down
30 changes: 30 additions & 0 deletions queries/contours.jinja2
Original file line number Diff line number Diff line change
@@ -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
4 changes: 3 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
5 changes: 4 additions & 1 deletion spreadsheets/collision_rank.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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'}
Expand Down Expand Up @@ -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 }
2 changes: 2 additions & 0 deletions spreadsheets/sort_rank/contours.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
kind,sort_rank
*,225
2 changes: 1 addition & 1 deletion spreadsheets/sort_rank/landuse.csv
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ tree_row,*,264
hedge,*,263
bridge,*,229
pier,*,228
dike,*,227
dyke,*,227
cutline,*,226
groyne,*,225
breakwater,*,224
Expand Down
1 change: 1 addition & 0 deletions spreadsheets/sort_rank/water.csv
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions test/test_meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
Loading