[postgis-users] Rép: Select a point that belongs to a linestring

Hugues François hugues.francois at irstea.fr
Wed Aug 14 01:00:36 PDT 2013


Hi,

With your test data, the following query returns the 3 points :
with 
	p as (
		select  ST_GeomFromText('POINT(43 23)', 26910) point
		union
		select  ST_GeomFromText('POINT(50 20)', 26910)
		union
		select  ST_GeomFromText('POINT(30 20)', 26910)
	),

	r as (
		select ST_AddPoint(ST_GeomFromText('LINESTRING(50 20, 30 20)', 26910),ST_GeomFromText('POINT(43 23)'), 1) line
	) 

select p.* from p, r
where st_intersects(point, line)

Regards,

Hugues. 


-----Original Message-----
From: postgis-users-bounces at lists.osgeo.org [mailto:postgis-users-bounces at lists.osgeo.org] On Behalf Of andrea.alri90 at gmail.com
Sent: Tuesday, August 13, 2013 10:15 PM
To: postgis-users at postgis.refractions.net
Subject: Re: [postgis-users]Rép: Select a point that belongs to a linestring

With ST_intersects it works, but it works only when the the point in the query (Punto1) has coordinates (50 20) or (30 20). (50 20) and (30 20) are the extremes of the linestring Strada1, why it works only with the extremes and not with the points in the middle?
Is there a way to get it works with the points in the middle?



--
View this message in context: http://postgis.17.x6.nabble.com/Select-a-point-that-belongs-to-a-linestring-tp5003990p5003996.html
Sent from the PostGIS - User mailing list archive at Nabble.com.
_______________________________________________
postgis-users mailing list
postgis-users at lists.osgeo.org
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users


More information about the postgis-users mailing list