[postgis-users] Point not captured in a street segment

Matthew Pulis mpulis at gmail.com
Fri Aug 29 02:39:31 PDT 2008


I'm running some tests on my data, and I just found out that a point on my
map is not being located well. When I try to find on which road segment is
this point (tried different points in the same area, all same problem) I am
getting no result. As I keep increasing the expand, I get the nearest point
kilometers away.

This is the query I am running:

SELECT gid, astext(the_geom), distance(the_geom, pointfromtext
('POINT(639313.5 20222798)'))
              FROM streets_proper
                      the_geom && expand ( pointfromtext ('POINT(639313.5
20222798)') ,100000000 )
              ORDER BY distance ( the_geom, pointfromtext ('POINT(639313.5
20222798)') )

This is the result to the query:

30639;"MULTILINESTRING((636287.854148259 258075.811758838,636275.375133364
258080.421709569,636240.8320266 258092.166940159,636202.57661422
258100.818946874,636167.995585384 258102.57210146,635486.176381905
258095.192278846,635217.654866998 258082.45545628,634931.3812964
258060.198164721,634873.589774273 258053.320848581,634830.821635244

.. and so on.

This is the result of EXPLAIN ANALYZE

 Sort  (cost=19591.83..19716.20 rows=49751 width=180) (actual
time=7986.343..8185.926 rows=49746 loops=1)
   Sort Key: distance(the_geom,
   ->  Seq Scan on streets_proper  (cost=0.00..10890.64 rows=49751
width=180) (actual time=0.327..5996.988 rows=49746 loops=1)
         Filter: (the_geom &&
 Total runtime: 17130.283 ms
(5 rows)

It is the first time that this is happening, anything you suggest I should
do please? All the other points on the map are acting normally, its just
this area of points which is acting strange. I tried to use different points
in the same area, which is quite remote in the map, all giving similar
results. Normally I just do the expanding distance just by 100, and if it
doesn't fidn it continue increasing by 100 until it does, which is rarely

Any help is extremely appreciated!!

Kind Regards


Matthew Pulis
URL : http://www.solutions-lab.net
MSN : pulis_matthew[@]hotmail.com
ICQ : 145951110
Skype : solutions-lab.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20080829/e65d95c6/attachment.html>

More information about the postgis-users mailing list