I want to compute the shortest paths travelling overland between the origin (Africa) and destination (North America). My goal is to recreate human migration, and the shortest path should be across the Bering Strait. First, I have converted a shapefile to a raster, imputing value 1 to land and a large value (999999999,000000) to water. If my first step is correct, I do not have any no_data cell because I pre-initialize it with a value.

enter image description here

Second, I compute the cost using r.cost function under GRASS.

enter image description here enter image description here

Finally, I use r.drain to obtain the shortest path. enter image description here

For some unknown reason to me, I must use the cost raster and the movement direction map ticking the The input raster map is a cost surface selector.

The result indicates that the shortest path consists in travelling via Iceland, thus crossing the Atlantic where each cell has a cost of 999999999 compared to the cost of 1 for travelling overland. enter image description here

I think I cannot increase more the cost of water travelling. How can I modify my workflow to force the Bearing route?

  • 1
    I think it's got something to do with the projection. We understand that the right edge of your map connects to the left, but the tool may not. Have you tried reprojecting your raster into a pacific-centered projection? – JoshC May 8 '19 at 17:32
  • I think you are missing the ice, which make travel cost less expensive than water an temperature, that should make very expensive to reach the north or south pole – Marco May 9 '19 at 5:48
  • @JoshC Exactly this! Changing my projection to one centered on the Pacific solved the issue. – Keizer May 10 '19 at 13:56

Your process is fine; the problem is that your projection is centered on Europe, and your tool won't "wrap" to the other side.

To address this, you can reproject your layers to a Pacific-centered projection, like the PDC Mercator (EPSG 3832). In such a projection, your tool will be able to continue its path from Asia to North America across the Bering Strait.

pacific-centered projection

If you know what you're doing, you can also create a new Custom Projection, found under the Settings menu. In the Parameters area, you can adjust the +lon_0= parameter to change where the map is centered. Starting from something like the Mercator, such an adjustment is very simple. If you're working in other projections, this can be a perilous task without understanding what each of the parameters is.

PROJ parameters

If you're interested, you should look at PROJ's own documentation. When you understand what's happening in a given projection, you will be more able to customize it safely.

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.