I have polygon layer which looks like this (here is small cutout):
What I need is to connect all polygons with line in somehow "logical" order - it means to go from first to last polygon (eventually point as I can create centroids) and create line connecting two nearest polygons BUT with one condition - there can't be closed polygon (it means I can't draw lines between three points so they create triangle) and there can be several branches - to make it clear below is the image how it should looks like.
What I get so far:
- in QGIS I can't use Points to Path as I have no order field (all the polygons has same ID = 1)
- in ArcMap I am able to use two function Generate Near Table and then XY to Line which connects at least some polygons together -->
- finally I need to manually draw lines for the rest -->
Is there any automatic way to solve this using QGIS?
Maybe adding order field to layer with values based on location or something like that. I would ideally create an automatic model in the end as I deal with lots of these layers.