[postgis-users] Re: Comparing Geometries with Different SRIDs

Charlie Savage cfis at savagexi.com
Sun Sep 28 11:10:03 PDT 2008

Reid Priedhorsky wrote:
> Charlie Savage wrote:
>>> The 2 point could be spatially equal given different SRIDS and 
>>> coordinates if they were projected to a common SRID. So should
>>> geometry operators silently Call st_transform to make the righthand
>>> match the lefthand before comparing? This would be quite the
>>> expensive operation.
>> No. You can't automatically transform between different SRID values 
>> Think of the case of one geometry with an SRID value of 4326 and one
>>  with an SRID value of -1 (no coordinate system).
> Exactly.
>> So different SRID values, then the geometries are not equal.
> No -- as Stanley said, the geometries could be in fact equal, but 
> expressed in different SRS. So if ST_Equals() returned False, it would 
> be wrong.

Maybe.  But returning "Operation permitted" is even worse because it 
means you can't do natural things like this (without extra annoying SRID 
checking code) in plpgsql:

IF (geom1 == geom2) ... END IF;

Or the example with the union earlier posted

>> It is up to the user to transform geometries to the same SRID before
>> calling ST_EQUALS.
> Exactly. ;)

So, I still vote that st_equals will not blow up when comparing two 
geometries with different SRID values, it just will return false.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3237 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20080928/7cb79a05/attachment.bin>

More information about the postgis-users mailing list