Hi Surya,

No, I didn't say it should be, only that I assumed it was. It only matters in the query and how you look at things. If you are digitized in an upstream direction, then the stream mouth will be the startpoint of the linestring and the headwaters the endpoint ... so you would reverse the logic in your query (find all streams whose startpoint (or mouth) touches the endpoint (or headwater) of your token stream).

SELECT b.*
FROM streams a, streams b
WHERE a.stream_id = 1     -- your specified segment
AND a.the_geom && b.the_geom
AND ST_Distance(
 ST_EndPoint(a.the_geom),
 ST_StartPoint(b.the_geom)
) = 0;

Cheers,
Kevin

[email protected] wrote:
You said that the river should be digitized in downstraem
direction (mimicing the river flow??). Is there any different
when we digitized them in upstream direction?


best regards,
surya

-- Assuming your dataset is properly noded, directionalized
-- and digitized in a downstream direction, this will find
-- all streams that enter into stream with id = 1
SELECT b.*
FROM streams a, streams b
WHERE a.stream_id = 1     -- your specified segment
AND a.the_geom && b.the_geom
AND ST_Distance(
  ST_StartPoint(a.the_geom),
  ST_EndPoint(b.the_geom)
) = 0;

_______________________________________________
postgis-users mailing list
[email protected]
http://postgis.refractions.net/mailman/listinfo/postgis-users

Reply via email to