Update object variable with vector attribute based on largest overlap
Hi, I've been wondering whether it was currently possible to update an object variable with a vector attribute based on largest overlap. In my case, I have single eCognition objects that overlap two or more polygons from a ground survey. I need to create an object variable containing an attribute from the ground survey polygon with greatest overlap. I have tried two things but without success:
- When I use the "read thematic attribute", it seems to update the object variable randomly, and often giving me the attribute of the polygon with the smallest overlap.
- When I use "update variable" and select the feature "create new Thematic object attribute", objects overlapping two polygons are marked as undefined.
I guess a work around would be to use "assign class by thematic layer", select the attribute and constrain to those objects that overlap the thematic layer more than once (otherwise I would get a lot of classes!). It seems that using that option prioritises polygons with greatest overlap. However, this would result in a classification, not a variable, so I would need to store the assigned class within a variable before removing the classification. Only then could I use my original method to update the variable of those objects with a single overlapping polygon. It is a bit convoluted but it's the only way I have found so far.
Any suggestions to improve efficiency would be extremely welcome!
Was this article helpful?
4 comments
Please check this demo project to get some ideas how to use linking operations and features in eCognition (your request is covered by one of the examples):
https://support.ecognition.com/hc/en-us/articles/360017470220-Linking-Operations-and-Linked-Object-Features
Hi,
I guess your work around sounds fine to me! Would have been my approach as well. This also should run fairly fast. Let's wait and see if someone comes up with a more elegant way.
Matthias
Nice task (ړײ).
I recommend using object linking for that:
(1) create a new map (with image and vector layers) using 'copy map'
(2) create your image object on main map (do not use vector layer here)
(3) create image object just on the vector layer on map2 using 'vector-based segmentation' and classify vector object to a class 'test'
(4) link objects from main map just with best overlapping TEST objects from map2 using 'create links' (domain is your main map object; link class test, class filter test, link to best, overlap calc rel to larger object)
(5) update object variable based on 'Linked object statistics'
If you want, I can send you my "playground project" to test your request.
Thanks Christian, I'll try this out!