1

I have a binary raster that indicates the presence and absence of roads.

What I want is to classify the roads in at least two categories (width=16pixels (the horizontal road in the example) and width =12pixels (the vertical roads in the example)). As you can see in the example photo, the data is not flawless, but visually it is possible to distinguish the different entities which is why I believe there has to be an algorithmic solution to this problem.

I've tried multiple things, but none of them successful. One workflow was the following to extract the widest:

  1. Shrink by n cells
  2. raster to polygon
  3. polygon to centreline
  4. remove small lines
  5. buffer (to ensure connectivity)
  6. dissolve boundaries
  7. polygon to centreline

I struggle though to find a way to classify the slightly thinner roads (the very thin roads I want to clean out completely, as they are not of interest).

I hope to find some simpler way that needs fewer steps and therefore less iterations to find the best solution. Ideally there is a tool or a calculation that considers the width of the same value pixels and groups them into individual classes/polygons/lines.

example roads

1 Answer 1

1

Here is a solution, you start with a raster where road pixels are 1 and background is 0 as shown below:

Input

Using the model below:

Model

You can generate the following output:

Results

Note the small red bits in the thick yellow road, these are a result of the allocation algorithm allocating to a nearer pixel as roads join at junctions, which they tend to do in real life!

3
  • That looks like a solution that does indeed what I was looking for! Could you, by any chance, share the model as a python script, as I'm not very familiar with the model builder? desktop.arcgis.com/en/arcmap/10.4/analyze/modelbuilder/….
    – Yves
    Jul 21 at 7:11
  • I'm not using the machine I created the model on but you would simply call the same tools in python, you just need to transfer the logic manually into code, won't take you long. In the model rasRoadMask.tif is acting as Mask setting for Euclid allocation tool.
    – Hornbydd
    Jul 21 at 9:00
  • Thank you, I'm trying to do that. It is, however, not as trivial for me as it might be for you. I hope I can get it done, but I'd still appreciate it greatly if you could share the solution in more detail, albeit a bit later:)
    – Yves
    Jul 21 at 12:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.