[postgis-users] How do I obtain 2 ids between a pipe segment?

Obe, Regina DND\MIS robe.dnd at ci.boston.ma.us
Fri Apr 2 08:03:41 PST 2004


The way your query is written only the manholes with bounding box with 100
will be considered.  Perhaps that is too small of a bounding box

Have you tried increasing the bounding box.  The fact that your limit 2 is
there will yield the 2 closest.

SELECT manID as manhole,
       distance(geom,'POINT(12433.19 2354.126)'::geometry) as distance
FROM man_hole
WHERE geom && expand('POINT(12433.19 2354.126)'::geometry,500)
ORDER BY distance limit 2

-----Original Message-----
From: iheanyi Okeh [mailto:simflex at hotmail.com]
Sent: Friday, April 02, 2004 10:56 AM
To: postgis-users at postgis.refractions.net
Subject: [postgis-users] How do I obtain 2 ids between a pipe segment?


The code, below, performs a radius search for a manhole id but instead of
returning the closest manhole id, we would like it to return at least 2 
manhole
ids.
For instance, if there is a repair that occurs on a pipe segment, and
the pipe happens to be between 2 manhole ids ( one manhole id on either side

of
the pipe), we would like to see the 2 manhole ids returned.

Example: KG2354  --------------|---------------- KG2355

Per above example, assume that a repair was done on the center of
the pipe, and there are 2 manhole ids on either side.One called KG2354 is on

the
left of the pipe and another called KG2355 is on the right, we would love to

display those 2 manhole ids.

So far, only the closest to the point of repair is returned.

Can you please tell me what I may have overlooked on the code below?

Thanks in advance.

SELECT manID as manhole,
       distance(geom,'POINT(12433.19 2354.126)'::geometry) as distance
FROM man_hole
WHERE geom && expand('POINT(12433.19 2354.126)'::geometry,100)
ORDER BY distance limit 2

_________________________________________________________________
Get rid of annoying pop-up ads with the new MSN Toolbar - FREE! 
http://toolbar.msn.com/go/onm00200414ave/direct/01/

_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users



More information about the postgis-users mailing list