[postgis-users] problem with multilinestring

strk strk at keybit.net
Sun Feb 8 08:24:10 PST 2004


vguzman wrote:
> Hello.
> 
> I've got a table named 'arcos', with a MULTILINESTRING geometry named 
> 'the_geom'.
> 
> I need to get the elements that starts or ends at a certain point.
> 
> If I query the database with "SELECT the_geom FROM arcos WHERE id=51892;"
> 
> I get:
>                                                               the_geom
> ------------------------------------------------------------------------------------------------------------------------------------
>  SRID=1;MULTILINESTRING((-74.1835602497749 
> 4.62941345152032,-74.1837889284997 4.62928942801709,-74.1840390840234 
> 4.62917486837267))
> (1 row)
> 
> With the query "SELECT startpoint(the_geom) FROM arcos WHERE id=51892;"
> I get:
>                     startpoint
> --------------------------------------------------
>  SRID=1;POINT(-74.1835602497749 4.62941345152032)
> (1 row)
> 
> But if I try the query: "SELECT id FROM arcos WHERE startpoint(the_geom) 
> ~= geometryfromtext('POINT(-74.1835602497749 4.62941345152032)',1);"
> I get no results:
>  id
> ----
> (0 rows)
> 
> And the same problem if i try: "SELECT id FROM arcos WHERE 
> x(startpoint(the_geom))::float = -74.1835602497749;"
>  id
> ----
> (0 rows)
> 
> 
> But if instead I try:"SELECT id FROM arcos WHERE 
> x(startpoint(the_geom))::text = -74.1835602497749;"
> I get:
>   id
> -------
>  51892
> 
> But, obviously, this query is very slow, and is not getting the 
> geographic capabilities from postgis.
> Any ideas?
> 
> Thanks in advance,
> 
> -- 
> Vladimir Ilich Guzmán R.
> ------------------------

This is what I get with postgis 0.8:

gis=# select the_geom from testgeoms where startpoint(the_geom) ~= geometryfromtext('POINT(-74.1835602497749 4.62941345152032)', 1);
                                                              the_geom          
------------------------------------------------------------------------------------------------------------------------------------
 SRID=1;MULTILINESTRING((-74.1835602497749 4.62941345152032,-74.1837889284997 4.62928942801709,-74.1840390840234 4.62917486837267))
(1 row)


--strk;



More information about the postgis-users mailing list