justin.mcgurk@yahoo.com (1) [Avatar] Offline
#1
Hi in this section you say that invalid polygons are
"Fortunately these polygons are difficult to generate
in PostGIS and don’t serve any purpose in real world modeling"

It's not clear the distinction between invalid and degenerate, for example the following is invalid but not degenerate and seems to go up into Postgres fine.

INSERT INTO ch02.my_geometries (name, my_polygons)
VALUES (
'InvalidGeo?',
ST_GeomFromText('POLYGON(
(-0.25 -1.25,-0.25 1.25,2.5 1.25,2.5 -1.25,-0.25 -1.25),
(2.55 0,1.25 1,1.25 -1,2.55 0),(1 -1,1 1,0 0,1 -1) )'--fIRST SET IS OUTER rING,2ND & 3RD ARE INNER RINGS. First inner ring is dodgy?.
)
);
regina.leo (260) [Avatar] Offline
#2
Re: Section 2.2.3 Invalid polygons
There isn't a hard fast rule about it and behavior unfortunately has changed from version to version. In fact we had discussed having some sort iof a policy about such things as to allowing the user to dictate how invalid they want to allow.

It is true that some invalid geometries will go in fine and some will not. In some cases depending on version of PostGIS you have I've seen such geometries go in but restore fails. It's a very messy topic and unfortunately not one we can describe without becoming completely obsolete or confusing the user more than being helpful. General rule is just to avoid all invalid geometries and use ST_IsValid to hunt them out.

Thanks,
Regina