[postgis-users] predicate of direction is possible?

Mike Toews mwtoews at gmail.com
Sat Jan 19 21:07:42 PST 2013


On 18 January 2013 04:52, Francisco Salas <fsalas at pinar.geocuba.cu> wrote:
> Hi, I have interest in to obtain if one object in the table A was in the
> east,west,south,etc.  of the other object in the table B.
>
> There are some function in postgis for this.
>
> Any idea?

I have an add-on function[1] to return N, NW, W, SW, S, SE, E, or NE
from an azimuth direction. E.g.:

SELECT ST_Cardinal_Direction(ST_Azimuth(A.geom, B.geom))
FROM A, B
WHERE ...

The function can be changed to instead return 'east', 'west', 'south',
or however you want to define.

-Mike

[1] http://trac.osgeo.org/postgis/wiki/UsersWikiCardinalDirection


More information about the postgis-users mailing list