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

iheanyi Okeh simflex at hotmail.com
Fri Apr 2 07:55:30 PST 2004


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/




More information about the postgis-users mailing list