Change what trees are generated based on tag content#676
Merged
louis-e merged 4 commits intolouis-e:mainfrom Jan 27, 2026
Merged
Change what trees are generated based on tag content#676louis-e merged 4 commits intolouis-e:mainfrom
louis-e merged 4 commits intolouis-e:mainfrom
Conversation
[to modified] Change what trees are generated based on tag content
Contributor
There was a problem hiding this comment.
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
TreeTypeenum that isClone + Copyand introduceTree::create_of_typeso a specific tree species can be instantiated, while keepingTree::createas the generic, random entry point. - In
generate_natural, add logic fornatural=treeto pick a tree type based onspecies,genus:wikidata,genus, orleaf_type, and fornatural=wood/tree_rowto restrict the random tree type set byleaf_type. - In
generate_landuse, add similarleaf_type-based filtering forlanduse=foresttrees, 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.
Owner
|
Reviewed & merged with #675 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR makes trees (
natural=tree) and trees in woods (natural=wood) and forests (landuse=forest) generate depending on infos from tags.If a
genusorgenus:wikidatais given and it is one of the trees we can generate, or if aspeciescontains the genus of what we can generate, exactly that one is generated. (natural=treeonly)If
leaf_type=broadleafed/needleleafedis given, only trees/a tree that has leafs or needles respectively is generated.