[postgis-users] Is it pipe segment or manhole?

Stephen Frost sfrost at snowman.net
Wed Apr 7 06:29:24 PDT 2004


* iheanyi Okeh (simflex at hotmail.com) wrote:
> Problem is it doesn't matter whether the address lies on a line/pipe 
> segment or on a manhole, two manhole ids are always returned.
> Any help will be greatly appreciated.
> here is the current code I am using.
> 
> select ident as manhole_ID,
>    distance(shape,'POINT(2354123.1234 6533241.231)'::geometry) as dist
>    from iLandMan
>    where shape && expand('POINT(2354123.1234 6533241.231)'::geometry,150)   
>  order by dist limit 2

It might be possible to do this using CASE statements and joins, but it
really seems to me that this is something that should be handled by the
application layer.  You're already doing an 'order by dist', just have
the application check the distance from the closer manhole and if it's
less than some constant then only report that manhole.

	Stephen
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20040407/907355a2/attachment.pgp>


More information about the postgis-users mailing list