Thursday, 12 March 2015

qgis - How to extract POINT from a [LINE|MULTILINE]STRING


I'd like to create a vectorLayer in QGIS to display all the points that form a LINESTRING or a MULTILINESTRING stored in a PostGIS DB.


I think that I need to transform all points of LINESTRING (or MULTILINESTRING) to POINT.



First Question:


Is there any PostGIS function to do that?


Second Question:


If I want to exclude duplicate points from the result POINT table, how can I do that?



Answer



To get point in order and link to orginal geometry use


SELECT (ST_DumpPoints(the_geom)).path as path, id, (ST_DumpPoints(the_geom)).geom FROM linestrings)

and remove dublicates from http://wiki.postgresql.org/wiki/Deleting_duplicates


remember that you need to have one unique id for dublicate removing, if you dont have one you need to create it



No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...