Closed zerebubuth closed 8 years ago
Good catch! Browsing around the USA this seems fairly common and probably the root cause of a lot of our cludgy filter shims.
If we see the operator is United States Forest Service
(we normalize a list of values into that in post-processing) it should be kind:forest
instead of kind:national_park
.
I've had good success in the scene file also paring with protect_class (to insist that a national_park can't be operated by USFS and it should generally be in only 2, 3, and 5 protect_class :
national_park:
filter:
all:
- kind: [national_park, battlefield, protected_area]
any:
- not: { operator: [ "United States Forest Service" ] }
- protect_class: ['2','3','5']
kind:forest
.kind:forest
.I suspect these might address edge cases, while the dominant case is the example above.
landuse=forest
I think this isn't worth pursing at this time as I've only found one case which is already addressed by the other logic, and I suspect this may do some harm unless further researched and it's an edge case so skip.leisure=nature_reserve
in Smith River is already taken care of by operator (should be kind:forest
). kind:national_park
). leisure=nature_reserve
but without an operator but with a protect_class of 2 (it should be kind:national_park
, but might need some data work?), until data is fixed I think it'd come thru as kind:nature_reserve
?leisure=park
in San Luis Reservoir State Recreational Area has boundary=national_park
and leisure=park
and
park:type=state_recreational_area
and no protect_class. This shouldn't be a kind national_park, just a kind:park
!kind:park
since there isn't an operator to say forest, and it's not a national park. Alternatively boundary:type=protected_area
could give us kind: protected_area
instead.leisure=nature_reserve
in North Farallon Islands State Marine Reserve has boundary=protected_area
with protect_class=4
in tile 11/323/791. It's operator=California Department of Fish & Wildlife
so we'd just want this to be kind:nature_reserve
.leisure=nature_reserve
in Mount Tamalpais Watershed has boundary=national_park
with boundary:type=protected_area
and operator=Marin Municipal Water District
and protect_class=4
. It should just be kind:nature_reserve
.leisure=common
in Blithedale Summit Open Space Preserve with boundary=national_park
and boundary:type=protected_area
and protect_class=5
and operator=Marin County Parks
should just be kind:common
.leisure=nature_reserve
in Glen Canyon National Recreation Area with boundary=national_park
and boundary:type=protected_area
and protect_class=5
and protection_title=National Recreation Area
which I think should default to kind:nature_reserve
.nature-reserve-boundaries
Looking at the OSM CartoCSS files, it looks like the special outline coloring on osm.org is being driven on:
Snippet from "nature-reserve-boundaries" MML:
SELECT\n way,\n name,\n boundary,\n way_area/NULLIF(!pixel_width!::real*!pixel_height!::real,0) AS way_pixels\n FROM planet_osm_polygon\n WHERE (boundary = 'national_park' OR leisure = 'nature_reserve')\n AND building IS NULL\n AND way_area > 0.01*!pixel_width!::real*!pixel_height!::real\n) AS national_park_boundaries
(Is boundary=protected_area
ever drawn in the default OSM.org map? There are 10s of thousands of protected_area features in OSM, so I think we should keep including them in Tilezen.)
Some OSM wiki page definitions:
Here's what we do now:
AND (tags->'boundary' IN ('national_park', 'protected_area') OR tags->'leisure'='nature_reserve')
I think the order should be more like:
And what we have now:
- filter: {boundary: national_park}
min_zoom: zoom + 2
output: {kind: national_park}
- filter: {boundary: protected_area}
min_zoom: zoom + 2
output: {kind: protected_area}
- filter: {leisure: nature_reserve}
min_zoom: zoom + 2
output: {kind: nature_reserve}
- filter:
any:
leisure: park
landuse: park
min_zoom: GREATEST(LEAST(zoom, 16), 9)
output: {kind: park}
- filter: {leisure: common}
min_zoom: GREATEST(LEAST(zoom, 16), 9)
output: {kind: common}
- filter:
landuse: forest
protect_class: '6'
min_zoom: GREATEST(LEAST(zoom, 14), 7)
output: {kind: forest}
- filter: {landuse: forest}
min_zoom: GREATEST(LEAST(zoom, 14), 9)
output: {kind: forest}
theme parks and zoos
Similarly the reason why theme parks and zoos get an outline treatment is:
Snippet from "tourism-boundary" in MML:
(SELECT\n way,\n way_area/NULLIF(!pixel_width!::real*!pixel_height!::real,0) AS way_pixels,\n name,\n tourism\n FROM planet_osm_polygon\n WHERE tourism = 'theme_park'\n OR tourism = 'zoo'\n) AS tourism_boundary
I don't think we need any special handling for kind:theme_park
or kind:zoo
because they are straight forward (same as their original features).
More examples:
leisure=nature_reserve
in Parque Natural Sierra de Andújar with finally kind:nature_reserve
.boundary=protected_area
in Naturpark Steigerwald with protect_class=5
should end up with kind: protected_area
boundary=national_park
in Muir Woods National Monument with leisure=nature_reserve
and operator=National Park Service
and protect_class=3
should end up with kind:national_park
leisure=park
in Henry W. Coe State Park with boundary=protected_area
and protect_class=5
should end up with kind:park
.operator=United States National Park Service
and protect_class=2
in Yosemite National Park with boundary=national_park
and leisure=nature_reserve
should end up with kind:national_park
.operator=United States National Park Service
and protect_class=2
in Redwood National Park with boundary=national_park
and leisure=nature_reserve
should end up with kind:national_park
.operator=United States National Park Service
and protect_class=2
in Yellowstone National Park with boundary=national_park
and leisure=nature_reserve
should end up with kind:national_park
.boundary=national_park
in Adirondack Park should end up with kind:park
.operator=United States National Park Service
and protect_class=2
in Shenandoah National Park with boundary=national_park
and leisure=park
should end up with kind:national_park
.designation=national_park
in Cairngorms National Park with boundary=national_park
should end up with kind:national_park
.boundary=national_park
in North Wessex Downs AONB with designation=area_of_outstanding_natural_beauty
should end up with kind:park
.operator:en=Parks Canada
and boundary=national_park
in Riding Mountain National Park with leisure=nature_reserve
.Blocked on #997 - there are too many changes in that PR to proceed with this one.
Work in progress on the 987 national forests branch. I hit one snag with the examples above:
boundary=national_park
in Adirondack Park should end up withkind:park
.
The only relevant tag on Adirondack Park is boundary=national_park
- it has no operator
or boundary:type
or protect_class
, or even leisure
or natural
. Do you want all such boundary=national_park
to be just park
instead of national_park
when there aren't other tags such as protect_class
or operator
to "lift" them up to national_park
status? In other words, should the default kind
for boundary=national_park
be park
or national_park
, in the absence of other distinguishing information?
This will change the behaviour for a lot of existing tests.
Example forest in Colorado that only gets demoted because of protect_class is present as 6 but operator is missing. Gets demoted to what, though? propose
kind:park
since there isn't an operator to say forest, and it's not a national park. Alternativelyboundary:type=protected_area
could give us kind: protected_area instead.
I took the liberty of changing this to kind: forest
, as it has a protection_title=National Forest
and protection_title
seems to be reasonably well-used. I thought it fits better with the name "Arapaho National Forest" and it does appear to be operated by USFS, despite the lack of operator
tag.
For your boundary=national_park
in Adirondack Park example, I think it should go to park
in the absence of other distinguishing information. (Just like the ref
& network
plus shield_text
stuff, I sense some Targeted Editing opportunities improve the underlying OSM data. In the meantime it sounds like we'll need to update tests.)
💯 Good call on the protection_title
logic for the forest in Colorado!
I'm still working my way thru this one, but so far so good :)
Let's ship this!
Two minor points to fix in later releases:
national_park
), followup in https://github.com/tilezen/vector-datasource/issues/1082:
leisure=common
in Blithedale Summit Open Space Preserve with boundary=national_park
and boundary:type=protected_area
and protect_class=5
and operator=Marin County Parks
should just be kind:common
.
George Washington National Forest currently comes through with
kind: national_park
, but shouldn't.Relevant tags on the object:
boundary=national_park
landuse=forest
leisure=nature_reserve
operator=US Forest Service
Do we want some combination of these to override the choice of
kind: national_park
?