[postgis-users] Doesn't match

Leticia lgomez at itba.edu.ar
Sat Mar 31 08:56:28 PDT 2007


Hi,  I have a problem with the following queries.

 

I have a table with only these two "linestrings"

 

CREATE TABLE twolines (ID integer, the_geom geometry);

 

INSERT INTO twolines 

SELECT 1, 'LINESTRING(122.303797468354 272,86 135.428571428571)'::geometry;

 

INSERT INTO twolines 

SELECT 2, 'LINESTRING(211.8125 272,86 153.588235294118)'::geometry;

 

 

Then, I have a Point generate as the intersection of these two lines:

 

CREATE TABLE points AS

SELECT the_geom

FROM

(

SELECT INTERSECTION(L1.the_geom, L2.the_geom) AS P

FROM twolines l1, twolines l2

WHERE intersects(l1.the_geom, l2.the_geom) AND l1.ID < l2.ID

) AS auxi(the_geom);

 

(This table contains 1 tuple: the intersection point)

 

Later, when I try to find out at which point theses lines were intersected
with theses points, I obtain ZERO tuples. 

I tried with all of these:

 

SELECT *

FROM twolines l, points p

WHERE overlaps(l.the_geom, p.the_geom) 

 

 

SELECT *

FROM twolines l, points p

WHERE distance(l.the_geom, p.the_geom) = 0

 

 

SELECT *

FROM twolines l, points p

WHERE contains(l.the_geom, p.the_geom)

 

 

All of these queries show that the only point that was generated by the
intersection of these two lines, not belongs to these two lines.

 

How can I fix it? There exists another form of making the same answer that
let me obtain the correct answer?

 

Obviously I tried to extract the problem, but I need to generate all the
points that can be obtain by the intersection of several lines and then
operate with the subsegments generated by these crosses.

 

Thanks a lot,

Leticia

 

 

 

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20070331/e421f87a/attachment.html>


More information about the postgis-users mailing list