Saturday 17 October 2015

gpx - Connecting two line ends in QGIS without resorting to other software


I have two adjacent (ends meet to make one line) polylines in QGIS. I need to properly connect the two ends of the two sections. I've tried the obvious (and less obvious too) but QGIS won't forget that they started out as two lines.


On this occasion my overall aim is to create a GPX track using a set of currently unconnected lines with meeting ends (i.e. unconnected in the data, but end to end geometrically). I guess that QGIS needs to understand how each line is meant to connect together - after all it would still be a valid GPX track with one section of line in the track, followed by another random section, and then a third, and so on.


Typically the issue is that QGIS does just this - so that the GPX track isn't one continuous line (I get separate 'trkseg' sections of track).


To (try to) make one track line I have:



  • used a python script to reverse any lines drawn in the wrong direction so that they all point the same way;


  • run the Topology Checker plugin to look for 'dangling ends'; and with snapping turned on dragged the offending ends apart and then brought them back together.

  • used 'merge features' to make the two (or more) lines into one.


and then saved as a GPX track. I've done these things repeatedly and in differing orders and with more than one set of data. It rarely works.


What does work is having taken the above steps - to save the data as a MapInfo TAB file, load it in MapInfo, use MapInfo's 'combine' command, save, re-open in QGIS, save back into a SHP file... then create the GPX track (which often works).


My interpretation of this is that QGIS is never correctly combining the lines into one - even though the endpoints of the lines are correctly orientated (one in the same place as the other).


Is there some hidden "permanently combine" feature which is stronger than "merge features"?


I've read (I think) that it might be possible to use GRASS to do this - but as I already have a solution using a different package I haven't pursued this. I was hoping for a simple solution.




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...