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 6 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
23 changes: 23 additions & 0 deletions queries.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ all:
- boundaries
- transit
- admin_areas
- contours
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be an optional layer for the mainline build... and a fork could put it into the all grouping.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated according to your comment.


sources:

Expand Down Expand Up @@ -148,6 +149,10 @@ 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]
Expand Down Expand Up @@ -326,6 +331,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
post_process:
- fn: vectordatasource.transform.build_fence
params:
Expand Down Expand Up @@ -480,6 +494,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
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
1 change: 1 addition & 0 deletions 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.6
future==0.16.0
gunicorn==19.9.0
hiredis==0.2.0
Expand Down
3 changes: 3 additions & 0 deletions spreadsheets/collision_rank.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@
- {$layer: 'water', kind: 'sea'}
- {$layer: 'pois', kind: 'nature_reserve'}
- {$layer: 'water', kind: 'lake'}
# for contours
- _reserved: {count: 10}
- {$layer: 'contours', kind: 'std'}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kind should be contour

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would put this at the very bottom of the file... just above the default value.

These contour in this file are just for the label collisions, which should be least priority. If there are "index" contours (eg with a kind_detail) then those should have priority over generic contours.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated according to your first comment.

# for shields & etc
- _reserved: {count: 10}
- {$layer: 'roads', kind: 'highway', kind_detail: 'motorway'}
Expand Down
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
*,1500
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should go between dam and breakwater, so reserve a slot there, and value more like 224 (with breakwater and other values in there getting +1).

https://github.com/tilezen/vector-datasource/blob/a53f1ef0b54c66da391584e25fa750f8aed1a9c9/spreadsheets/sort_rank/landuse.csv

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated according to your comment.

2 changes: 1 addition & 1 deletion vectordatasource/meta/python.py
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,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()

Expand Down
5 changes: 5 additions & 0 deletions vectordatasource/meta/sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@
'ne_10m_roads',
'planet_osm_line',
],
'contours': [
'contours',
],
'transit': [
'planet_osm_line',
'planet_osm_polygon',
Expand Down Expand Up @@ -683,6 +686,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_'):
Expand Down
4 changes: 4 additions & 0 deletions vectordatasource/sort.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
15 changes: 15 additions & 0 deletions yaml/contours.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
global:
- &output_properties
source: {col: source}
min_zoom: {col: min_zoom}
ele: {col: ele}
Copy link
Member

@nvkelso nvkelso Sep 27, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. We generally spell out property names, so elevation here instead of ele, and to match elevation property name which we already use in the pois layer.

  2. Please add documentation for this new optional layer:

  • elevation: Elevation of the contour in meters.

Copy link
Member

@nvkelso nvkelso Sep 27, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Generally we want to assign an index contour that's every say 4th or 5th value... so 0, 20, 40, 60, 80, 100 where 0 and 100 would be index contours. This allows the index contours to be "bold" (or thicker stroke) to establish better visual hierarchy on the map display, and the text can also be styled bold.

So we'll probably need a new transform to assign kind_detail when it's an index contour.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated according to your first comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure how to add this new transfor to assign kind_detail. Is this also needed? Because in current styles I am doing this in function in scene styling files.


filters:
- filter:
geom_type: line
min_zoom: 13
table: vfp
output:
<<: *output_properties
kind: std