Discussion:
split donut polygons
Travis Kirstine
2012-02-15 14:07:06 UTC
Permalink
Hi all,

I have a application that cannot render donut in polygons (renders the
outer ring only). As a result I need to "remove" the interior rings
by creating a connection between the donut and the exterior ring. FME
has a tool called "DonutBridgeBuilder" that will do this however I am
having issues with the postgis reader / writer

example:
Loading Image...
Nicklas Avén
2012-02-15 14:18:52 UTC
Permalink
Hallo

If I understand that "DonutBridgeBuilder" picture right, what it does is
making corridors to make all interior rings being part of the outer
ring. That seems like a very bad idea and will most likely result in
invalid geometries in many cases. Invalid because they are self
intersecting.
What is the error message you get?

If you cannot make the application handle holes in polygons I would
suggest putting the holes in a layer above the main polygon instead. You
will get a problem if you need to see what is behind the donut polygon
through the holes, but then I think you will have to deal with the
source to the problems. The application not handling holes.

Regards

Nicklas
Post by Travis Kirstine
Hi all,
I have a application that cannot render donut in polygons (renders the
outer ring only). As a result I need to "remove" the interior rings
by creating a connection between the donut and the exterior ring. FME
has a tool called "DonutBridgeBuilder" that will do this however I am
having issues with the postgis reader / writer
http://evangelism.safe.com/wp-content/uploads/2008/06/donutbuilder.jpg
_______________________________________________
postgis-users mailing list
http://postgis.refractions.net/mailman/listinfo/postgis-users
Travis Kirstine
2012-02-15 16:17:49 UTC
Permalink
Thanks Nicklas

I do agree that this is a bad idea. I have checked the resultant
geometries and they are invalid (using FME)

Original
POLYGON((0 0,4 0,4 4,0 4,0 0),(1 1, 2 1, 2 2, 1 2,1 1))

Results
POLYGON((0 0,4 0,2 1,1 1,1 2,2 2,2 1,4 0,4 4,0 4,0 0))

Unfortunately, I cannot alter the application to render the donuts
correctly. I have consider extracting the interior rings as polygons
and stacking them but as you had mentioned but this becomes very
complicated (island within lakes within islands etc...)

Although the "bridge building" method would result in invalid
geometries it seems to work for this purpose (display only).

If anyone has any hints on how to build this query to create bad
polygons : ) they would be appreciated


Hallo

If I understand that "DonutBridgeBuilder" picture right, what it does is
making corridors to make all interior rings being part of the outer
ring. That seems like a very bad idea and will most likely result in
invalid geometries in many cases. Invalid because they are self
intersecting.
What is the error message you get?

If you cannot make the application handle holes in polygons I would
suggest putting the holes in a layer above the main polygon instead. You
will get a problem if you need to see what is behind the donut polygon
through the holes, but then I think you will have to deal with the
source to the problems. The application not handling holes.

Regards

Nicklas
Post by Travis Kirstine
Hi all,
I have a application that cannot render donut in polygons (renders the
outer ring only). As a result I need to "remove" the interior rings
by creating a connection between the donut and the exterior ring. FME
has a tool called "DonutBridgeBuilder" that will do this however I am
having issues with the postgis reader / writer
http://evangelism.safe.com/wp-content/uploads/2008/06/donutbuilder.jpg
Sandro Santilli
2012-02-15 16:28:37 UTC
Permalink
Post by Travis Kirstine
Thanks Nicklas
I do agree that this is a bad idea. I have checked the resultant
geometries and they are invalid (using FME)
Original
POLYGON((0 0,4 0,4 4,0 4,0 0),(1 1, 2 1, 2 2, 1 2,1 1))
Results
POLYGON((0 0,4 0,2 1,1 1,1 2,2 2,2 1,4 0,4 4,0 4,0 0))
Unfortunately, I cannot alter the application to render the donuts
correctly. I have consider extracting the interior rings as polygons
and stacking them but as you had mentioned but this becomes very
complicated (island within lakes within islands etc...)
Although the "bridge building" method would result in invalid
geometries it seems to work for this purpose (display only).
If anyone has any hints on how to build this query to create bad
polygons : ) they would be appreciated
1) Dump the rings of your polygon
2) Find closest line between shell (path = 0?) to each of the holes
3) Add all rings boundaries + the lines found in (2) to a collection
4) Linemerge the collection of multilines
5) Verify the result is a single, closed line
6) Realize the resulting line is not simple (just for fun)
7) Pass the resulting line to ST_MakePoly

--strk;

,------o-.
| __/ | Delivering high quality PostGIS 2.0 !
| / 2.0 | http://strk.keybit.net
`-o------'

Loading...