<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.6000.16735" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=795342012-10122008><FONT face=Arial
color=#0000ff size=2>Fred and <FONT face="Times New Roman"
size=3>Ghislain</FONT>,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=795342012-10122008><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=795342012-10122008><FONT face=Arial
color=#0000ff size=2>Thanks - yes that's because of the rounding that happens in
ST_GeomFromText -- the ST_GeomFromText is rounding the last couple of digits
so the text rep isn't actually what the geometry is so its probably
something like</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=795342012-10122008><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN
class=795342012-10122008>796579.5624334065668 or some such thing.
Looking at this in OpenJump, the polygon is practically a line so borders on
being almost invalid.</SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=795342012-10122008></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=795342012-10122008><FONT face=Arial
color=#0000ff size=2>So I guess its some sort of rounding issue that before it
gets to ST_Centroid its not invalid because the 2 mid points are technically not
the same, but once it gets into ST_Centroid some rounding happens that makes it
equivalent to an invalid geometry (basically a polygon with 3
points).</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=795342012-10122008><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=795342012-10122008><FONT face=Arial
color=#0000ff size=2>Well I'm able to recreate this result in
"POSTGIS="1.3.5SVN" GEOS="3.1.0-CAPI-1.5.0" PROJ="Rel. 4.6.0, 21 Dec
2007"</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=795342012-10122008><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=795342012-10122008><FONT face=Arial
color=#0000ff size=2>I suppose the workaround for now would be to ignore
anything where the area is close to 0 or centroid is empty or use ST_SnapToGrid
to get rid of those extra digits in your geometry.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=795342012-10122008><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=795342012-10122008><FONT face=Arial
color=#0000ff size=2><A
href="http://postgis.refractions.net/documentation/manual-svn/ST_SnapToGrid.html">http://postgis.refractions.net/documentation/manual-svn/ST_SnapToGrid.html</A></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=795342012-10122008><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=795342012-10122008><FONT face=Arial
color=#0000ff size=2>None of which is terribly appealing.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=795342012-10122008><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=795342012-10122008><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=795342012-10122008><FONT face=Arial
color=#0000ff size=2>Thanks,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=795342012-10122008><FONT face=Arial
color=#0000ff size=2>Regina</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=795342012-10122008><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B>
postgis-users-bounces@postgis.refractions.net
[mailto:postgis-users-bounces@postgis.refractions.net] <B>On Behalf Of </B>Fred
Lehodey<BR><B>Sent:</B> Wednesday, December 10, 2008 5:28 AM<BR><B>To:</B>
PostGIS Users Discussion<BR><B>Subject:</B> Re: [postgis-users] how to identify
the_geom thatcause:RelateOperation called withLWGEOMCOLLECTION
type<BR></FONT><BR></DIV>
<DIV></DIV>Hi,<BR>just a note:<BR><BR>inserting the same geometry
:<BR><BR>INSERT INTO bug (gid, the_geom) VALUES (<BR>1 ,
'0103000020BE6B0000010000000400000081F178483F4F2841D730212506D33C418045F71F474F2841D706623902D33C417E45F71F474F2841D806623902D33C4181F178483F4F2841D730212506D33C41'<BR>);<BR><BR>and
<BR><BR>INSERT INTO bug (gid, the_geom) VALUES
(2,st_geomfromtext('POLYGON((<BR>796575.641547725
1889030.1450377,<BR>796579.562433407 1889026.22415202,<BR>796579.562433406
1889026.22415202,<BR>796575.641547725 1889030.1450377))',-1))<BR><BR>then
:<BR>SELECT gid, st_area(the_geom), astext(centroid(the_geom)),
isvalid(the_geom)<BR>FROM bug<BR><BR>returns:<BR><BR>1;
0.0001220703125;"GEOMETRYCOLLECTION EMPTY";t<BR>2;
0.0001220703125;"POINT(796578.255471513
1889027.53111391)";t<BR><BR>!!<BR><BR>Fred.<BR><BR><BR><BR><BR>
<DIV class=gmail_quote>On Wed, Dec 10, 2008 at 9:06 AM, Ghislain Geniaux <SPAN
dir=ltr><<A
href="mailto:geniaux@avignon.inra.fr">geniaux@avignon.inra.fr</A>></SPAN>
wrote:<BR>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">Exact,<BR> that's
the problem :<BR><BR>scot3=# SELECT gid, the_geom<BR>scot3-# FROM
bd_dispo_final<BR>scot3-# WHERE isempty(centroid(the_geom));<BR> gid
|
the_geom<BR>-------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------<BR> 16435
|
0103000020BE6B0000010000000400000081F178483F4F2841D730212506D33C418045F71F474F2841D706623902D33C417E45F71F474F2841D806623902D33C4181F178483F4F2841D730212506D33C41<BR>(1
row)<BR><BR><BR>Here, you will find the ouput of pg_dump to study
this geometrry. Thanks again.<BR><BR><BR><BR>--<BR>-- PostgreSQL database
dump<BR>--<BR><BR>SET client_encoding = 'SQL_ASCII';<BR>SET
standard_conforming_strings = off;<BR>SET check_function_bodies =
false;<BR>SET client_min_messages = warning;<BR>SET escape_string_warning =
off;<BR><BR>SET search_path = public, pg_catalog;<BR><BR>SET
default_tablespace = '';<BR><BR>SET default_with_oids = false;<BR><BR>--<BR>--
Name: bug; Type: TABLE; Schema: public; Owner: postgres;
Tablespace:--<BR><BR>CREATE TABLE bug (<BR> gid integer,<BR>
the_geom geometry<BR>);<BR><BR><BR>ALTER TABLE public.bug OWNER TO
postgres;<BR><BR>--<BR>-- Data for Name: bug; Type: TABLE DATA; Schema:
public; Owner: postgres<BR>--<BR><BR>COPY bug (gid, the_geom) FROM
stdin;<BR>16435
0103000020BE6B0000010000000400000081F178483F4F2841D730212506D33C418045F71F474F2841D706623902D33C417E45F71F474F2841D806623902D33C4181F178483F4F2841D730212506D33C41<BR>\.<BR><BR><BR>--<BR>--
PostgreSQL database dump complete<BR><FONT color=#888888>--<BR><BR><BR>Le 9
déc. 08 à 13:04, Obe, Regina a écrit :</FONT>
<DIV>
<DIV></DIV>
<DIV class=Wj3C7c><BR><BR>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid"><BR>Ghislain,<BR><BR>The
only time I have seen this kind of behavior is when centroid returns an
empty geometry collection. In those cases its because the geometry is
invalid.<BR><BR>Although none of your geometries are invalid, it could be a
bug in either the centroid code or isvalid check that may or may not be
fixed in 3.0.3+ of GEOS.<BR><BR><BR>Can you do the following<BR><BR>SELECT
gid, the_geom<BR>FROM ZS2C<BR>WHERE
isempty(centroid(the_geom))<BR><BR><BR>and send us as an attatched file with
one of those geometries. We can cross check with GEOS 3.0.3 or 3.1 to
see if the issue still remains.<BR><BR>Thanks,<BR>Regina<BR>-----Original
Message-----<BR>From: <A
href="mailto:postgis-users-bounces@postgis.refractions.net"
target=_blank>postgis-users-bounces@postgis.refractions.net</A> [mailto:<A
href="mailto:postgis-" target=_blank>postgis-</A><A
href="mailto:users-bounces@postgis.refractions.net"
target=_blank>users-bounces@postgis.refractions.net</A>] On Behalf Of
Ghislain Geniaux<BR>Sent: Monday, December 08, 2008 1:29 PM<BR>To: PostGIS
Users Discussion<BR>Subject: Re: [postgis-users] how to identify the_geom
that cause:RelateOperation called withLWGEOMCOLLECTION type<BR><BR>On Linux
:<BR><BR>POSTGIS="1.3.1" GEOS="3.0.0-CAPI-1.4.1" PROJ="Rel. 4.6.0, 21
Dec<BR>2007" USE_STATS<BR>(1 row)<BR><BR>On
Macos<BR><BR> POSTGIS="1.2.1" GEOS="3.0.0-CAPI-1.4.1" PROJ="Rel. 4.6.0,
21 Dec<BR>2007" USE_STATS<BR>(1 row)<BR><BR>same result with the two
platform and postgis version.<BR><BR>Thanks.<BR><BR>Le 8 déc. 08 à 17:53,
Paragon Corporation a écrit :<BR><BR>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">What
does<BR><BR>SELECT
postgis_full_version();<BR><BR>Return<BR><BR>Thanks,<BR>Regina<BR>-----Original
Message-----<BR>From: <A
href="mailto:postgis-users-bounces@postgis.refractions.net"
target=_blank>postgis-users-bounces@postgis.refractions.net</A><BR>[mailto:<A
href="mailto:postgis-users-bounces@postgis.refractions.net"
target=_blank>postgis-users-bounces@postgis.refractions.net</A>] On Behalf
Of<BR>Ghislain<BR>Geniaux<BR>Sent: Monday, December 08, 2008 11:03
AM<BR>To: PostGIS Users Discussion<BR>Subject: Re: [postgis-users] how to
identify the_geom that cause<BR>:RelateOperation called
withLWGEOMCOLLECTION type<BR><BR>I've no collection. It's looks like a
bug.<BR><BR>Moreover my table is very large wiht more than 500 000
geometry and i<BR>found no solution to identy the wrong geom.<BR><BR>Here
you can see the query, with the same result on different<BR>plateform
(LINUX DEBIAN, MACOS, with GEOS 3)<BR><BR>otm=# select distinct
geometrytype(the_geom) from
ZS2c;<BR> geometrytype<BR>--------------<BR> MULTIPOLYGON<BR>(1
row)<BR><BR>otm=# select distinct geometrytype(the_geom) from
bd_dispo_finalc
;<BR> geometrytype<BR>--------------<BR> MULTIPOLYGON<BR> POLYGON<BR>(2
rows)<BR><BR>otm=# create table info_nonvoue1 as<BR>otm-# select
b.id_parc, z.niv from bd_dispo_finalc as b, ZS2c as z<BR>otm-# where
z.niv=1 and intersects(centroid(b.the_geom),z.the_geom)<BR>and b.the_geom
&& z.the_geom and isvalid(b.the_geom) and
isvalid<BR>(z.the_geom);<BR>ERROR: Relate Operation called with a
LWGEOMCOLLECTION type. This<BR>is
unsupported<BR>otm=#<BR><BR><BR><BR>Le 8 déc. 08 à 13:32, Obe, Regina a
écrit :<BR><BR>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">Many
of the GEOS relation functions do not work with collections.<BR><BR>You
must have a geometry collection in there somewhere or its a bug.<BR>Also
which relation function were you trying?<BR><BR>To figure out the type
of your geometries, run<BR><BR>SELECT *<BR>FROM sometable<BR>WHERE
GeometryType(the_geom) =
'GEOMETRYCOLLECTION'<BR><BR><BR><BR><BR>-----Original
Message-----<BR>From: <A
href="mailto:postgis-users-bounces@postgis.refractions.net"
target=_blank>postgis-users-bounces@postgis.refractions.net</A><BR>[mailto:<A
href="mailto:postgis-users-bounces@postgis.refractions.net"
target=_blank>postgis-users-bounces@postgis.refractions.net</A>] On
Behalf Of<BR>Nicolas Ribot<BR>Sent: Monday, December 08, 2008 6:22
AM<BR>To: PostGIS Users Discussion<BR>Subject: Re: [postgis-users] how
to identify the_geom that cause :<BR>RelateOperation called
withLWGEOMCOLLECTION type<BR><BR>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">I
have an error with some geometry that cause : "ERROR
Relate<BR></BLOCKQUOTE>Operation<BR>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">called
withLWGEOMCOLLECTION type".<BR>All the geometries seem clean (valid,
non empty, closed, only<BR>POLYGON,<BR></BLOCKQUOTE>..)<BR>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">My
question : how to get information of which geometry cause
the<BR></BLOCKQUOTE>problem ?<BR>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">Is
there a way to have information about the geometry
during<BR>postgis<BR></BLOCKQUOTE>is<BR>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">working
on a SQL query ?<BR>Thanks.<BR><BR></BLOCKQUOTE><BR>Hi
Ghislain,<BR><BR>What the query that failed looks like ?<BR>The message
is telling that one geometry has an invalid type.<BR>In your query, you
could try to ask for ST_GeometryType(geometry) and<BR>a geometry
identifier to see which geometry has the wrong type.<BR>If you perform a
spatial operation, it is possible that<BR>geometryCollection is
produced.<BR>You could maybe split your query into smaller block to see
where such<BR>collections are
generated.<BR><BR>Nicolas<BR>_______________________________________________<BR>postgis-users
mailing list<BR><A href="mailto:postgis-users@postgis.refractions.net"
target=_blank>postgis-users@postgis.refractions.net</A><BR><A
href="http://postgis.refractions.net/mailman/listinfo/postgis-users"
target=_blank>http://postgis.refractions.net/mailman/listinfo/postgis-users</A><BR>-----------------------------------------<BR>The
substance of this message, including any attachments, may
be<BR>confidential, legally privileged and/or exempt from
disclosure<BR>pursuant to Massachusetts law. It is intended<BR>solely
for the addressee. If you received this in error, please<BR>contact the
sender and delete the material from any
computer.<BR>_______________________________________________<BR>postgis-users
mailing list<BR><A href="mailto:postgis-users@postgis.refractions.net"
target=_blank>postgis-users@postgis.refractions.net</A><BR><A
href="http://postgis.refractions.net/mailman/listinfo/postgis-users"
target=_blank>http://postgis.refractions.net/mailman/listinfo/postgis-users</A><BR></BLOCKQUOTE><BR><BR><BR>------------------------------------------<BR>Geniaux
Ghislain<BR>INRA SAD Ecodéveloppement<BR>Site Agroparc<BR>Domaine St
Paul<BR>84914 Avignon Cedex 9<BR><BR>Tél : 04 32 72 25 64<BR>Fax : 04 32
72 25
62<BR><BR><BR>_______________________________________________<BR>postgis-users
mailing list<BR><A href="mailto:postgis-users@postgis.refractions.net"
target=_blank>postgis-users@postgis.refractions.net</A><BR><A
href="http://postgis.refractions.net/mailman/listinfo/postgis-users"
target=_blank>http://postgis.refractions.net/mailman/listinfo/postgis-users</A><BR><BR><BR><BR>_______________________________________________<BR>postgis-users
mailing list<BR><A href="mailto:postgis-users@postgis.refractions.net"
target=_blank>postgis-users@postgis.refractions.net</A><BR><A
href="http://postgis.refractions.net/mailman/listinfo/postgis-users"
target=_blank>http://postgis.refractions.net/mailman/listinfo/postgis-users</A><BR></BLOCKQUOTE><BR><BR><BR>------------------------------------------<BR>Geniaux
Ghislain<BR>INRA SAD Ecodéveloppement<BR>Site Agroparc<BR>Domaine St
Paul<BR>84914 Avignon Cedex 9<BR><BR>Tél : 04 32 72 25 64<BR>Fax : 04 32 72
25
62<BR><BR><BR>_______________________________________________<BR>postgis-users
mailing list<BR><A href="mailto:postgis-users@postgis.refractions.net"
target=_blank>postgis-users@postgis.refractions.net</A><BR><A
href="http://postgis.refractions.net/mailman/listinfo/postgis-users"
target=_blank>http://postgis.refractions.net/mailman/listinfo/postgis-users</A><BR>-----------------------------------------<BR>The
substance of this message, including any attachments, may
be<BR>confidential, legally privileged and/or exempt from
disclosure<BR>pursuant to Massachusetts law. It is intended<BR>solely for
the addressee. If you received this in error, please<BR>contact the sender
and delete the material from any
computer.<BR>_______________________________________________<BR>postgis-users
mailing list<BR><A href="mailto:postgis-users@postgis.refractions.net"
target=_blank>postgis-users@postgis.refractions.net</A><BR><A
href="http://postgis.refractions.net/mailman/listinfo/postgis-users"
target=_blank>http://postgis.refractions.net/mailman/listinfo/postgis-users</A><BR></BLOCKQUOTE><BR><BR><BR>------------------------------------------<BR>Geniaux
Ghislain<BR>INRA SAD Ecodéveloppement<BR>Site Agroparc<BR>Domaine St
Paul<BR>84914 Avignon Cedex 9<BR><BR>Tél : 04 32 72 25 64<BR>Fax : 04 32 72 25
62<BR><BR><BR>_______________________________________________<BR>postgis-users
mailing list<BR><A href="mailto:postgis-users@postgis.refractions.net"
target=_blank>postgis-users@postgis.refractions.net</A><BR><A
href="http://postgis.refractions.net/mailman/listinfo/postgis-users"
target=_blank>http://postgis.refractions.net/mailman/listinfo/postgis-users</A><BR></DIV></DIV></BLOCKQUOTE></DIV><BR></BODY></HTML>
<HTML><BODY><P><hr size=1></P>
<P><STRONG>
The substance of this message, including any attachments, may be confidential, legally privileged and/or exempt from disclosure pursuant to Massachusetts law. It is intended solely for the addressee. If you received this in error, please contact the sender and delete the material from any computer.
</STRONG></P></BODY></HTML>
<P><hr size=1></P>
<P><STRONG><font size="2" color="339900"> Help make the earth a greener place. If at all possible resist printing this email and join us in saving paper. </p> <p> </font></STRONG></P>