SVG layers converted to shapes

Hello,

Hope y’all doing good!
I have an SVG geographic map with various islands on it.
When opening the SVG in a vector graphics editor, each island is a layer that you can select.
Is there is a way for processing to detect those layers when I load the SVG and convert them as shapes?

The aim would be then to be able to do shape collision detection.
For instance, finding out easily when a specific island is hit by a natural disaster which would also be represented by a shape.

I found some resources about the shape detection collision such as: https://www.openprocessing.org/sketch/117434

But I’m struggling to find resources explaining how to convert the SVG layers in shapes automatically. Is that even possible?

Thanks in advance,
G.

Check out:
https://processing.org/examples/getchild.html
https://processing.org/reference/PShape_getChild_.html

3 Likes

@Sarah Many thanks! :ok_hand: