I have a table with a lot of polygons, some polygons are inside a surrounding polygon. I would like to set the table attribute "inside" to "1" if it's a polygon that are surrounded by another polygon AND if the attribute "name" is the same.
If a polygon is a surrounding polygon or doesn't have any "inside" polygons I would like to set "inside" to "2". The "inside" is set to "0" from the beginning.
The picture shows an example of this, I have highlighted a surrounding polygon and this polygon has the same "name" as the polygons inside.
The highlighted polygon and the polygons that has no inside polygons shall be set to 2 and the polygons inside the highlighted shall be set to 1 (all the surrounded polygons have the same name as the surrounding polygon, in this example).
How do I write an effective SQL command for this?