[postgis-devel] ST_OrderingEquals what does it do

Kevin Neufeld kneufeld at refractions.net
Tue Jul 15 16:32:45 PDT 2008

It looks like the SQL definition of ST_OrderingEquals(geom1, geom2) is:
'SELECT $1 && $2 AND $1 ~= $2'

By rights, using this SQL, this function should be renamed to 
ST_EqualsExact ... but then, that's not a SQL/MM function.

According to the SQL/MM reference I have, this function should simply 
return true if the two geometries are ST_Equal.  It's just used to 
define ordering for the geometry datatype.  I think that's why this 
method attempted to implement ArcSDE's definition instead:

In any case, you're right.  Either the description is should be updated 
to say that this function simply adds an index call to the equals exact 
operator (~=), or the implementation should change to reflect your 
assumption.  Based on the ESRI's definition, I think this method should 
be reimplemented.

-- Kevin

Obe, Regina wrote:
> I was preparing examples for the docs and was surprised to find this 
> returns false
> SELECT ST_OrderingEquals(ST_GeomFromText('LINESTRING(0 0, 10 10)'),
>   ST_GeomFromText('LINESTRING(0 0, 5 5, 10 10)'));
> Evidentally I don't understand how Ordering Equals works.  I assumed 
> since the above returns
> true for ST_Equals and the line is in the same direction, the above 
> would return true as well.
> Thanks,
> Regina

More information about the postgis-devel mailing list