[postgis-users] Casting a point and a polygon to geometry

Mike Toews mwtoews at gmail.com
Mon Jul 9 16:03:21 PDT 2012


On 10 July 2012 06:53, Roba Binyahib <roba.binyahib at kaust.edu.sa> wrote:
> ST_Crosses(geometry g1, geometry g2);
>
> but I want g1 to be column of points and g2 a column of geometry, so how can
> I convert them to geometry enable to use the function

By column of "points", do you mean a PostGIS type, or a PostgreSQL
type[1]? If it is a PostGIS type, then it is a geometry, with it's own
internal type (Point, MultiPoint, Polygon, etc.).

> select r.name,u.id from river r, users u where
> ST_Crosses(r.point,u.polygon)='T' ;

ST_Crosses returns T/F, so you don't need to evaluate " ='T' ".

-Mike

[1] http://www.postgresql.org/docs/current/static/datatype-geometric.html



More information about the postgis-users mailing list