# Prevent stretching across the entire map when connecting coordinates into path from Asia to North America

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

• yes, I am using Points to path. May 29 at 9:07
• thank you - could you help me do that step by step? 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). May 29 at 9:20

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

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:

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

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):

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

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

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

Step 2. Proceed with "Explode lines"

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

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

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

• 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 May 29 at 9:57
• Can you please show an image of this issue? 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. 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. May 29 at 10:52
• Please fill free to improve my answer with some tips that made you to achieve the desired result May 29 at 11:13