landuse: an area tagged landuse=forest + leisure=* loses its forest

未关闭
#641 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
1-2 天
新手友好度
25/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
java

调研方向

Start in Landuse.java (rules around lines 77-135) and Matcher.getString to see why the last matching rule wins, then compare the tag order in Pois.java (lines 116-118 and 172). The issue offers three fixes, and the maintainers have not chosen one, so a newcomer should first ask which approach to take. Done means the chosen fix produces both the forest and the leisure result for an element tagged landuse=forest + leisure=nature_reserve.

由索引模型根据 Issue 内容生成。

描述

Description

This is about the tileset: the landuse layer (Landuse.java).

A wood that is also a nature reserve or a park is often mapped as one OSM element with both tags, for example landuse=forest + leisure=nature_reserve. Protomaps emits one landuse polygon per element, with one kind, and the last matching rule wins (Matcher.getString walks the matches in reverse). The leisure rule comes after the landuse rule, so the polygon gets kind=nature_reserve (or park, garden, …), and nothing in the tile says the area is a forest. A style that fills forest and draws reserves as an outline shows the wood as open ground.

Which tag wins depends on which of the two wood tags the mapper used: the natural rule comes after the leisure rule, so natural=wood + leisure=nature_reserve comes out as kind=wood and loses the reserve instead.

Location

Kastanjebos in Herent, Belgium: way 134580006 (56 ha), tagged landuse=forest + leisure=nature_reserve.

In daily build 20261014 (basemaps 4.15.2), tile 14/8402/5491 has a single landuse feature there, {kind: nature_reserve, sort_rank: 189}, and no landcover layer at that zoom.

The pois label point for the same way has kind=forest and the same feature id (35184506668838), because Pois.java checks the tags in the opposite order: there landuse wins over leisure (except leisure=park, which a later rule puts back on top). So the tileset calls this area a forest in one layer and a nature reserve in the other. A style can't use the label to fill the polygon: an expression can't look up a feature in another layer, and only named areas get a label point.

Scale

In a Europe osm2pgsql import from October 2026 there are about 2,200 areas tagged landuse=forest with a leisure tag and no natural tag (672 km²). Most are parks (about 1,090), nature reserves (570) and gardens (260).

Possible fixes

  1. When an element matches both a cover kind (forest, wood) and a leisure kind, emit two polygons: kind=forest and kind=nature_reserve. OpenMapTiles does the equivalent: the same way is in its landcover layer (class wood) and its park layer (class nature_reserve). It costs a second geometry for a few thousand polygons.
  2. Keep one polygon, and carry the cover in an attribute (for example kind_detail=forest) so a style can fill it. Smaller tiles, but every style has to know about the attribute.
  3. Let forest win over leisure. Simplest, but then the reserve or park is lost instead, as with natural=wood today.

I'd lean towards 1. #631 is a related case of one kind per area hiding information (a marine protected area that becomes kind=park).

Areas tagged landuse=forest + natural=wetland or natural=scrub (about 65,000 and 51,000 in Europe) also lose the forest. There the natural tag says what actually grows there (an open bog, regrowth after felling), so the current result seems right to me, and I'm not proposing to change it.

For now I work around this by drawing those woods from a separate PMTiles archive built from my own OSM database.

主要语言
Java
星标
779
派生
111
PR 合并指标
30 天内没有已合并 PR

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

protomaps/basemaps 的其他 Issue

查看 protomaps/basemaps 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。