Skip to content

Change what trees are generated based on tag content#676

Merged
louis-e merged 4 commits intolouis-e:mainfrom
wielandb:trees
Jan 27, 2026
Merged

Change what trees are generated based on tag content#676
louis-e merged 4 commits intolouis-e:mainfrom
wielandb:trees

Conversation

@wielandb
Copy link
Contributor

This PR makes trees (natural=tree) and trees in woods (natural=wood) and forests (landuse=forest) generate depending on infos from tags.

If a genus or genus:wikidata is given and it is one of the trees we can generate, or if a species contains the genus of what we can generate, exactly that one is generated. (natural=tree only)
If leaf_type=broadleafed/needleleafed is given, only trees/a tree that has leafs or needles respectively is generated.

@wielandb wielandb marked this pull request as ready for review December 14, 2025 08:10
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refines how different tree types are chosen and generated from OSM data, using tagging information to influence both individual trees and wooded/forest areas.

Changes:

  • Extend the tree generation system with a TreeType enum that is Clone + Copy and introduce Tree::create_of_type so a specific tree species can be instantiated, while keeping Tree::create as the generic, random entry point.
  • In generate_natural, add logic for natural=tree to pick a tree type based on species, genus:wikidata, genus, or leaf_type, and for natural=wood/tree_row to restrict the random tree type set by leaf_type.
  • In generate_landuse, add similar leaf_type-based filtering for landuse=forest trees, and resolve a small merge-conflict artifact in the WKT parser comment.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
src/gui/js/maps/wkt.parser.js Cleans up a merge conflict artifact in a documentation comment for Wkt.Wkt.prototype.merge, with no functional impact.
src/element_processing/tree.rs Marks TreeType as Clone + Copy and factors tree creation into a new create_of_type helper so callers can request a specific species while still reusing the existing placement logic.
src/element_processing/natural.rs Updates generate_natural to select tree species for natural=tree using species/genus/genus:wikidata and to constrain species for natural=wood/tree_row using leaf_type, choosing among allowed TreeTypes via deterministic RNG.
src/element_processing/landuse.rs Updates generate_landuse to compute an allowed TreeType set from leaf_type and use it when placing trees in landuse=forest, aligning forest tree generation with the new tag-driven behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@louis-e louis-e merged commit 92f629f into louis-e:main Jan 27, 2026
8 checks passed
@louis-e
Copy link
Owner

louis-e commented Jan 27, 2026

Reviewed & merged with #675

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants