I have a shapefile that shows single steps as individuals shapes and im trying to figure out the total count of adjacent steps. The little model I came up for now includes using the
v.dissolve function from the GRASS-library to dissolve all shapefiles that are adjacent and then with
join attributes by location to get the count of all shapefiles that touch, intersect or are inside the dissolved polygon. For most of the shapefiles this works fine, but as so often, it doesnt work fine on some others for different reasons.
1: There may be some digitalization error in the first problematic example. The amount of steps I really want is 51 but Im getting 78, because the cross bar and the little rectangular shape inside the steps divides single steps into several steps which are then counted separately.
2: In the second example two stairs seem to be next to each other resulting in 49 individual stairs. But actually I would like to have 2 results, a step count for each stair. The left stair should have 27 steps and the right stair has only 22 steps.
3: The third example results in 66 steps. Maybe some steps are missing at the inside and actually there would only be 3 stairs next to each other but for now I would like to get 4 individual results.
4: In example 4 the wrong step count is 43. Two shapefiles are inside the stair on the left, dividing single steps further and are counted twice then. The correct step count for left stair would be 25.
So i have to adapt the model to take those exeptions into account but im not quite sure how to achieve this in the best way. I thought about building centroids of all single steps, joining only close points together as a path or by buffered area and then counting the steps that intersect with this path or that buffered area. This would maybe solve problems 2 & 3 but could be problematic with 1 & 4.
Another idea was to restrict single steps to have a minimum size but this would not affect problem 2 & 3.
And of course there would be the possibility to combine the above mentioned methods to solve all problems. But before starting to implement that method and see if it really works and what new problems might arise, I wanted to ask you guys for some experience or thoughts on this :) Maybe there is some plugin that im not aware of or another process which could be usefull for this case.
Short update: The idea with the centroids, that are buffered, dissolved and then intersected with the steps to get their count seems to solve some of the problems (2 & 3 for example) but some problems remain. Of course..
And here are some examples, where it still doesnt work correctly.
The main problem is gonna be the exact parametrization of the buffer size. If the buffer size is bigger it would probably solve the brown stairs, be complicated with the blue one and could definitly mess up the stairs on the right, so that both slim stairs will be regarded as one, which might btw also be the case, as they are only about 0,3 meters broad. But it would then double the amount of steps in that buffered area.
The problem with the green buffered area, that two of such buffered areas are inside one stair should be solved quite easily.
Question: How can I calculate the max with and max length of every single shapefile, to assign this to a variable buffer size?