Simon, Thanks for the SQL, I will first figure it out and then exercise it on my dataset. It seems that to be able to use previous SQLs, I needed to merge/clean first my linestring in order to get exactly two rows for each river. By the way, river mouth means the start point of the river banks.
kind regards, surya ________________________________ From: Simon Greener <[email protected]> To: PostGIS Users Discussion <[email protected]> Sent: Mon, October 19, 2009 10:17:34 AM Subject: Re: [postgis-users] Help determining position Surya, > with help of the list I am able to determine minimum width of a river using > SQL below. Especially thanks to Mr. Simon Greener.. I still need to determine > position (in meter and also latlon) of this point from the river mounth. Can > anybody give me suggestion what Postgis function I should use together with > the following SQL. Not going to do everything for you (after all you have not supplied us a definition of the river mouth), but I would probably start by trying to find the actual points in the left/right bank that are closest via something like this: -- Which points are closest to each other? -- SELECT l.rin,ST_Point((l.coord).x,(l.coord).y), r.rin,ST_Point((r.coord).x,(r.coord).y), ST_Distance(ST_Point((l.coord).x,(l.coord).y), ST_Point((r.coord).x,(r.coord).y)) as PDistance FROM (select row_number() over (order by the_geom) as rin, ST_DumpPoints(the_geom) as coord from River r where r.Name = 'Barito' ) as l, (select row_number() over (order by the_geom) as rin, ST_DumpPoints(the_geom) as coord from River r where r.Name = 'Barito' ) as r WHERE l.rin <> r.rin ORDER BY 5 ASC LIMIT 1; Note, the ST_DumpPoints() function is a user defined one you can get from http://www.spatialdbadvisor.com/postgis_tips_tricks/109/implementing-oracles-getvertices-function-in-postgis-st_dumppoints But this will return the left and right points that are closest. Then you need to calculate the distance from each point to the point that defines the mouth of your river and chose the closest. regards Simon --SpatialDB Advice and Design, Solutions Architecture and Programming, Oracle Database 10g Administrator Certified Associate; Oracle Database 10g SQL Certified Professional Oracle Spatial, SQL Server, PostGIS, MySQL, ArcSDE, Manifold GIS, FME, Radius Topology and Studio Specialist. 39 Cliff View Drive, Allens Rivulet, 7150, Tasmania, Australia. Website: www.spatialdbadvisor.com Email: [email protected] Voice: +61 362 396397 Mobile: +61 418 396391 Skype: sggreener Longitude: 147.20515 (147° 12' 18" E) Latitude: -43.01530 (43° 00' 55" S) GeoHash: r22em9r98wg NAC:W80CK 7SWP3 _______________________________________________ postgis-users mailing list [email protected] http://postgis.refractions.net/mailman/listinfo/postgis-users
_______________________________________________ postgis-users mailing list [email protected] http://postgis.refractions.net/mailman/listinfo/postgis-users
