5

I am connecting coordinates around the world in a specific order. When moving from Asia to North America the line makes a connection that stretches across the entire map instead of bleeding over the edge of the map and reconnecting in North America. How can I avoid it?

I have three layers:

  • a basemap (ESRI Gray)
  • CSV data
  • output of the "Points to Path" geoalgorithm

I found this answer, but it seems complex and even if that is the solution to my issue as well I have been unsuccessful at implementing it in my case: QGIS Vector layer stretched across entire map

enter image description here

3
  • yes, I am using Points to path.
    – hearsay
    May 29 at 9:07
  • thank you - could you help me do that step by step?
    – hearsay
    May 29 at 9:11
  • I was able to find explode lines (it's in the toolbox so that was easy enough). Where do I enter the filter value? (I could share the data if that becomes necessary).
    – hearsay
    May 29 at 9:20
6

There are at least four possibilities. I list them in the order of straightforwardness - so 1 is easier than 2 and so on. Find screenshots below:

Solution 1

Re-project your project CRS to a pacific centered CRS like EPSG:3832 - and you're done. For the line you want to represent, it is better than a Greenwich-centered CRS.

Solution 2

Use Menu Processing / Toolbox / Geodesic line split at antimeridian.

Solution 3

Split your line at a very short distance (like 1 meter) after the last point before the line should cross the antimeridian (180 degree meridian) and instead of this streches over the whole map canvas. Repeat this with clipping shortly before the first point on the other side. Than delete the line in between. However, you will loose a part of the liene (see screenshot).

Solution 4

Set a pacific centered CRS as project CRS, create your line there, than split at the anti-meridian (180 degrees meridian) as described in this solution.

Further solutions

Using the Geometry Wrapper pugin might be another solution (not tested).

Screenshots

The screenshots illustrate solutions 1 to 3. In all cases, start point is the black line, created by connecting the red points:

Solution 1: change project CRS to EPSG:3832: enter image description here

Solution 2: run Geodesic line split at antimeridian on the black line to get the light red line: enter image description here

Soution 3: manually clip the line at the two points indicated by red arrows. Afterwards, the disturbing "streched" line can be selected (highlighted in yellow) and deleted. However, the part of the line connecting over the 180th meridian is lost (compare with screenshot of solution 2):

enter image description here

1
  • 1
    I didn’t know about that split 😀 thanks
    – Taras
    May 29 at 15:25
5

Let's assume there is a point layer 'test' with its attribute table, see image below

input

Step 1. Use "Points to path" geoalogirhm with "id" as 'Order field'

step_1

Step 2. Proceed with "Explode lines"

step_2

Step 3. Apply a filter for a line layer with a condition of your own choice. Here $length < 4000 was used

step_3

Step 4. And finally "Dissove" to get the desired output

step_4

If necessary apply the "Multipart to singleparts" to get single features

optional_step

5
  • So that worked great. The last issue is making a line that sort of bleeds over the edge of the map so that it appears it is connecting the coordinate in Russia to the coordinate in Alaska. Is that possible? Here is the map
    – hearsay
    May 29 at 9:57
  • Can you please show an image of this issue?
    – Taras
    May 29 at 9:59
  • Here is the map See how the coordinate in Russia just stops. I would like it to bleed off the edge. I tried using the 'Add Line Feature' but this does not save a line. It just says null and when I click ok the line disappears.
    – hearsay
    May 29 at 10:22
  • I was able to figure out how to draw the line. Explode, filter, dissolve works perfectly followed by a custom line. Thanks for the quick help.
    – hearsay
    May 29 at 10:52
  • 1
    Please fill free to improve my answer with some tips that made you to achieve the desired result
    – Taras
    May 29 at 11:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.