tilezen / vector-datasource

Tilezen vector tile service - OpenStreetMap data in several formats
https://www.nextzen.org/
Other
505 stars 119 forks source link

George Washington National Forest should not be a national park #987

Closed zerebubuth closed 8 years ago

zerebubuth commented 8 years ago

George Washington National Forest currently comes through with kind: national_park, but shouldn't.

Relevant tags on the object:

Do we want some combination of these to override the choice of kind: national_park?

nvkelso commented 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']

I suspect these might address edge cases, while the dominant case is the example above.

nvkelso commented 8 years ago
nvkelso commented 8 years ago

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:

landuse.jinja2#L82:

  AND (tags->'boundary' IN ('national_park', 'protected_area') OR tags->'leisure'='nature_reserve')

landuse.yaml#L5-L13

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).

nvkelso commented 8 years ago

More examples:

zerebubuth commented 8 years ago

Blocked on #997 - there are too many changes in that PR to proceed with this one.

zerebubuth commented 8 years ago

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 with kind: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. Alternatively boundary: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.

nvkelso commented 8 years ago

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!

nvkelso commented 8 years ago

I'm still working my way thru this one, but so far so good :)

nvkelso commented 8 years ago

Let's ship this!

Two minor points to fix in later releases:

  1. Besides park labels showing up too late & too early (let's fix next release in https://github.com/tilezen/vector-datasource/issues/1081), I think we're good to go :)
  2. This one isn't working (still shows up as 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.