Here's an approach using Spatialite: You can use the spatialite functions DissolvePoints() or DissolveSegments() to get each point or line segment along a LINESTRING. Here's an example: (I created in advance a sample LINESTRING called 'seg') PRAGMA table_info("seg"); 0 pk_uid integer 0 NULL 1 1 label text 0 NULL 0 2 Geometry LINESTRING 0 NULL 0 SELECT * FROM seg; 1 a BLOB sz=176 GEOMETRY 2 b BLOB sz=112 GEOMETRY (I have two simple LINESTRINGs) SELECT AsText(Geometry) FROM seg; LINESTRING(1 1, 2 1, 2 2, 3 2, 4 2, 5 3, 6 2, 7 1) LINESTRING(2 2, 2 4, 4 4, 5 2) Now, I want to choose one of the linestrings, based on it's start and end points: SELECT AsText(Geometry) FROM seg WHERE StartPoint(Geometry) = GeomFromText('POINT(1 1)', 4326) AND EndPoint(Geometry) = GeomFromText('POINT(7 1)', 4326); LINESTRING(1 1, 2 1, 2 2, 3 2, 4 2, 5 3, 6 2, 7 1) and to break up the LINESTRING into its segments: SELECT AsText(DissolveSegments(Geometry)) FROM seg WHERE StartPoint(Geometry) = GeomFromText('POINT(1 1)', 4326) AND EndPoint(Geometry) = GeomFromText('POINT(7 1)', 4326); MULTILINESTRING((1 1, 2 1), (2 1, 2 2), (2 2, 3 2), (3 2, 4 2), (4 2, 5 3), (5 3, 6 2), (6 2, 7 1)) Maybe that will help. On 24/06/2012 10:53, chathura silva wrote:
-- Micha Silver 052-3665918 |
_______________________________________________ Qgis-user mailing list Qgis-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-user