[postgis-users] précision, intersection and distance

Rhys Stewart rhys.stewart at gmail.com
Thu Dec 6 12:44:48 PST 2007


Hi all,

needed to create linestrings between a point relation and a line relation.
used makeline, line_interpolate_point and line_locate_point with good
results in the following query:
_______________________________________________________________________________________
create table tmp.jumper6 with oids as
select distinct on (b.id) b.id,distance(a.geo,b.geo),
    makeline(line_interpolate_point(a.geo, line_locate_point(a.geo, b.geo)),
b.geo)
from wkh a
inner join xfmr_mapping.xfmr_deadend_ b on expand(a.geo,15) && b.geo AND
distance(a.geo,b.geo) < 20
where b.category = 'TRANSFORMER'
order by b.id, distance
________________________________________________________________________________________

the new table has 387 rows.

When the following query is run:
 ________________________________________________________________________________________
select distance(a.makeline,b.geo),intersects(a.makeline,b.geo),a.*,b.gidfrom
tmp.jumper6 a
inner join wkh b on a.makeline && expand(b.geo,10) AND intersects(a.makeline
,b.geo)
order by id
________________________________________________________________________________________

94 rows are returned, if I change "intersects(a.makeline,b.geo)" to
"distance(a.makeline,b.geo) = 0", 240 rows are returned.

So i guess the question is this: the distance between two geometries can be
0 and they do not intersect? Is this a matter of precision? or is this a
bug?

Regards,

Rhys
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20071206/6441e94f/attachment.html>


More information about the postgis-users mailing list