As far as I know, it currently isn't really possible to specifically detect trees.
When using nearestObjects, for example, you can filter for buildings and whatnot, but trees... nope. (Or can you?!)
There sure are ways such as filtering the strings, stuff like that, but a performant way is something different.