[prev in list] [next in list] [prev in thread] [next in thread] 

List:       postgis-users
Subject:    [postgis-users] Select a point that belongs to a linestring
From:       "andrea.alri90 () gmail ! com" <andrea ! alri90 () gmail ! com>
Date:       2013-08-13 16:51:36
Message-ID: 1376412696608-5003990.post () n6 ! nabble ! com
[Download RAW message or body]

Hi everybody, I'm new in PostGIS world and I'm in trouble with points and
linestring. As title said I have a problem verifying that a point belongs to
a linestring. I've created those table with those commands:

CREATE TABLE Punti (
  Nome VARCHAR(20) PRIMARY KEY,
  Point GEOMETRY(POINT, 26910) NOT NULL
);

CREATE TABLE Strade (
  Nome VARCHAR(20) PRIMARY KEY,
  Road GEOMETRY(LINESTRING, 26910) NOT NULL
);

Those are two of my inserts:
INSERT INTO Strade VALUES('Strada1', ST_GeomFromText('LINESTRING(50 20, 30
20)', 26910));
INSERT INTO Punti VALUES ('Punto1', ST_GeomFromText('POINT(43 23)', 26910));

I added a point in linestring Strada1:
UPDATE Strade 
SET road=ST_AddPoint(road,ST_GeomFromText('POINT(43 23)'), 1)
WHERE nome='Strada1';

And this is the problematic query:
SELECT Strade.nome, ST_Within(Punti.point, Strade.road)
FROM Strade, Punti
WHERE Strade.nome='Strada1' AND Punti.nome='Punto1';

I supposed ST_Within returns true but it returns false. As ST_Within also
ST_Contains, ST_ContainsProperly, and others returns false.
Can you tell where is my error and how to solve it?

Thaks a lot
Andrea



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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic