Kevin,
We should clarify this in the docs. Yes I was thinking it wasn't really a bug
and kind of open to interpretation when you give it something invalid. I was
actually thinking it should behave more like the SQL constructs
SELECT NULL IS NULL As istrue, NULL = NULL As isunknown
basically an undefined question should return an undefined answer. Not a
false, but I suppose that may add unnecessary overhead and potentially break
other things.
Regarding the ST_AsBinary(geom1) = ST_AsBinary(geom2) -- I beg to differ --
although geom1 = geom2 probably does do a bounding box check. I think the
ST_AsBinary would force a bit by bit compare I think (actually I have a feeling
that is what ST_OrderingEquals really does though haven't looked at the code
for that).
Look at this example
SELECT ST_AsBinary(ST_Collect('POINT(1 1)', 'POINT(2 1)')) =
ST_AsBinary(ST_Collect('POINT(2 1)', 'POINT(1 1)')) As binaryequal,
ST_Collect('POINT(1 1)', 'POINT(2 1)') = ST_Collect('POINT(2 1)', 'POINT(1 1)');
Thanks,
Regina
-----Original Message-----
From: [EMAIL PROTECTED] on behalf of Kevin Neufeld
Sent: Thu 9/4/2008 11:34 AM
To: PostGIS Users Discussion
Subject: Re: [postgis-users] problem "st_equals".
Thanx Regina for looking into this.
I'm not sure I entirely agree that this should be considered a bug. So
far, the responsibility of ensuring the simplicity and validity of
geometries have fallen on the user before they invoke any other PostGIS
functions. If the onus were not on the user, we'd have to precursor
most PostGIS methods with an internal isvalid check - significantly
decreasing performance.
Rather, I think we should clarify the input reconditions for every
method in our new documentation. Ie. ST_Equals, ST_Union, ST_Area, etc.
should all say that they require valid geometries on input and
ST_OrderingEquals would state otherwise.
On a side note, your "binaryequal" test is just comparing the bounding
boxes of the two geometires via the = operator (geometry A = geometry
B). I'd be curious though, how the ~= operator handles this case. It's
supposed to return true on vertex-by-vertex equality ... so validity
shouldn't matter.
Cheers,
Kevin
Paragon Corporation wrote:
> Rolf,
>
> I took a look at this. I think the problem is because your polygons are
> invalid. Since ST_Equals doesn't care about polygon orientation and so
> forth - it has to validate that geometries are equa by other means. I
> suspect since your geometries are invalid the false really means -- it had
> no clue because it couldn't run the equality tests on them. ST_Equals in my
> opinion should throw an error or give some sort of notice, so I would
> consider this a bug.
>
> If I look at the notices section in say PgAdmin when I do an ST_IsValid
> check, I get this message
>
> When I do an ST_IsValid check, I get the below
> NOTICE: Self-intersection at or near point 2.58392e+006 5.68493e+006
> NOTICE: Self-intersection at or near point 2.58392e+006 5.68493e+006
> NOTICE: Self-intersection at or near point 2.58392e+006 5.68493e+006
> NOTICE: Self-intersection at or near point 2.58392e+006 5.68493e+006
>
> Now however ST_OrderingEquals returns true, because it is more of a check of
> binary equality (well sort of). Check this query out to see what I mean
>
> SELECT ST_AsBinary(a.the_geom) = ST_AsBinary(b.the_geom) As binaryequal,
> ST_Equals(a.the_geom, b.the_geom) As spatially_equal,
> ST_OrderingEquals(a.the_geom, b.the_geom) As
> orderequal,ST_IsValid(a.the_geom) As a_isvalid, ST_IsValid(b.the_geom) as
> b_isvalid
> from equal_test a, equal_test b where a.name <> b.name and not
> st_equals(a.the_geom,b.the_geom)
>
> -- On my install this returns
> binaryequal | spatially_equal | orderequal | a_isvalid | b_isvalid
> ------------+-----------------+------------+-----------+-----------
> t | f | t | f | f
> t | f | t | f | f
>
>
> Hope that helps,
> Regina
>
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Stüwe
> Rolf
> Sent: Thursday, September 04, 2008 3:31 AM
> To: PostGIS Users Discussion
> Subject: AW: [postgis-users] problem "st_equals".
>
> Hi Kevin,
>
> i send an example and hope yuo can reconstuct it.
>
> create table equal_test (name char(6)); SELECT
> AddGeometryColumn('','equal_test','the_geom','31466','MULTIPOLYGON',2);
>
> COPY equal_test (name, the_geom) FROM stdin;
> geom01
> 0106000020EA7A0000010000000103000000010000002B000000F18C9EFFB9B64341E314A022
> B1AF55
> 41AF0335FAB9B64341700D0F26B1AF5541C9C9D4F4B9B643418AAC8129B1AF5541B8B07CEFB9
> B64341F072F72C
> B1AF5541E2BF2CEAB9B64341D75B7030B1AF5541A3FEE4E4B9B643417162EC33B1AF55414974
> A5DFB9B64341EB
> 816B37B1AF55411A286EDAB9B643416DB5ED3AB1AF55414D213FD5B9B643411BF8723EB1AF55
> 41106718D0B9B6
> 43411645FB41B1AF55418500FACAB9B643417A978645B1AF5541C3F4E3C5B9B643415EEA1449
> B1AF5541D34AD6
> C0B9B64341D738A64CB1AF5541B609D1BBB9B64341F27D3A50B1AF55415F38D4B6B9B64341BD
> B4D153B1AF5541
> B5DDDFB1B9B643413ED86B57B1AF55419500F4ACB9B6434178E3085BB1AF5541CFA710A8B9B6
> 43416BD1A85EB1
> AF554127DA35A3B9B64341119D4B62B1AF5541579E639EB9B643416341F165B1AF55419A9999
> 99B9B643419A99
> 9969B1AF554166666686BAB6434152B81EB5B0AF554159EFACC7BAB64341CED465B6B0AF5541
> C245E5BCBAB643
> 41E1CD6EBBB0AF5541F73B31B2BAB64341973F82C0B0AF55419A6391A7BAB643415E41A0C5B0
> AF55415DE6059D
> BAB6434120BFC8CAB0AF5541A2ED8E92BAB643419FA4FBCFB0AF55417BA22C88BAB6434174DD
> 38D5B0AF5541A8
> 2DDF7DBAB643410F5580DAB0AF554197B7A673BAB64341B8F6D1DFB0AF554166688369BAB643
> 4191AD2DE5B0AF
> 5541DC67755FBAB64341916493EAB0AF554170DD7C55BAB643418A0603F0B0AF554143F0994B
> BAB64341277E7C
> F5B0AF554122C7CC41BAB64341ECB5FFFAB0AF554183881538BAB6434136988C00B1AF554188
> 5A742EBAB64341
> 3D0F2306B1AF5541FB62E924BAB643411405C30BB1AF55414FC7741BBAB64341A7636C11B1AF
> 5541A1AC1612BA
> B64341BE141F17B1AF5541B437CF08BAB64341FD01DB1CB1AF5541F18C9EFFB9B64341E314A0
> 22B1AF5541
> geom02
> 0106000020EA7A0000010000000103000000010000002B000000F18C9EFFB9B64341E314A022
> B1AF55
> 41AF0335FAB9B64341700D0F26B1AF5541C9C9D4F4B9B643418AAC8129B1AF5541B8B07CEFB9
> B64341F072F72C
> B1AF5541E2BF2CEAB9B64341D75B7030B1AF5541A3FEE4E4B9B643417162EC33B1AF55414974
> A5DFB9B64341EB
> 816B37B1AF55411A286EDAB9B643416DB5ED3AB1AF55414D213FD5B9B643411BF8723EB1AF55
> 41106718D0B9B6
> 43411645FB41B1AF55418500FACAB9B643417A978645B1AF5541C3F4E3C5B9B643415EEA1449
> B1AF5541D34AD6
> C0B9B64341D738A64CB1AF5541B609D1BBB9B64341F27D3A50B1AF55415F38D4B6B9B64341BD
> B4D153B1AF5541
> B5DDDFB1B9B643413ED86B57B1AF55419500F4ACB9B6434178E3085BB1AF5541CFA710A8B9B6
> 43416BD1A85EB1
> AF554127DA35A3B9B64341119D4B62B1AF5541579E639EB9B643416341F165B1AF55419A9999
> 99B9B643419A99
> 9969B1AF554166666686BAB6434152B81EB5B0AF554159EFACC7BAB64341CED465B6B0AF5541
> C245E5BCBAB643
> 41E1CD6EBBB0AF5541F73B31B2BAB64341973F82C0B0AF55419A6391A7BAB643415E41A0C5B0
> AF55415DE6059D
> BAB6434120BFC8CAB0AF5541A2ED8E92BAB643419FA4FBCFB0AF55417BA22C88BAB6434174DD
> 38D5B0AF5541A8
> 2DDF7DBAB643410F5580DAB0AF554197B7A673BAB64341B8F6D1DFB0AF554166688369BAB643
> 4191AD2DE5B0AF
> 5541DC67755FBAB64341916493EAB0AF554170DD7C55BAB643418A0603F0B0AF554143F0994B
> BAB64341277E7C
> F5B0AF554122C7CC41BAB64341ECB5FFFAB0AF554183881538BAB6434136988C00B1AF554188
> 5A742EBAB64341
> 3D0F2306B1AF5541FB62E924BAB643411405C30BB1AF55414FC7741BBAB64341A7636C11B1AF
> 5541A1AC1612BA
> B64341BE141F17B1AF5541B437CF08BAB64341FD01DB1CB1AF5541F18C9EFFB9B64341E314A0
> 22B1AF5541
> \.
>
> select a.name,b.name from equal_test a, equal_test b where a.name <> b.name
> and not st_equ als(a.the_geom,b.the_geom);
>
> output (though the geometries are the same):
>
> name | name
> --------+--------
> geom01 | geom02
> geom02 | geom01
> (2 rows)
>
>
>
>
>
> Bye Rolf
>
> -----Ursprüngliche Nachricht-----
> Von: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Im Auftrag von Kevin
> Neufeld
> Gesendet: Dienstag, 2. September 2008 18:01
> An: PostGIS Users Discussion
> Betreff: Re: [postgis-users] problem "st_equals".
>
> My understanding is that ST_Equals shouldn't care if the geometries are not
> simple. If the two geometries are spatially equivalent, this function
> should return true.
>
> If the geometry is not too large, can you post it here?
>
> Cheers,
> Kevin
>
> Stüwe Rolf wrote:
>> Hallo all,
>>
>> we have a problem concerning the function "st_equals" under PostgreSQL
>> 8.2.3 , PostGIS1.2.1.
>>
>> We duplicated a geometry having a Self-intersection. The two
>> geometries are not st_equals(the original geometry, the duplicated
> geometry). Why?????
>> Many thanks for help us!
>>
>>
>> ----------------------------------------------------------------------
>> --
>>
>> _______________________________________________
>> postgis-users mailing list
>> [email protected]
>> http://postgis.refractions.net/mailman/listinfo/postgis-users
> _______________________________________________
> postgis-users mailing list
> [email protected]
> http://postgis.refractions.net/mailman/listinfo/postgis-users
> _______________________________________________
> postgis-users mailing list
> [email protected]
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>
> _______________________________________________
> postgis-users mailing list
> [email protected]
> http://postgis.refractions.net/mailman/listinfo/postgis-users
_______________________________________________
postgis-users mailing list
[email protected]
http://postgis.refractions.net/mailman/listinfo/postgis-users
-----------------------------------------
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.
_______________________________________________
postgis-users mailing list
[email protected]
http://postgis.refractions.net/mailman/listinfo/postgis-users