How to animate a GeoPath on top of a map

Hi there,

I’m just playing with the Wolfram cloud for the first time. I’ve made a map of some recent travels which uses a GeoPath to draw a line over the map between the locations.

GeoGraphics[{Red, GeoPath[{"Machu Pichu", "Santiago"}, "Rhumb"]}]

It’s basically the example code with my locations added. You can see it here.

What I’m wondering now is if I can create an animation of that line over the image? I tried to look into the animate functions but couldn’t see how to apply them to this situation. Any help or point in the right direction would be much appreciated. Thanks!

Something like this?

path.gif

Yea that’s pretty much what I’m after! Are you able to post your code from that?

The GIF was created following a relatively slow procedure:

I think you may find the Manipulate/Animate more useful:

Manipulate[
 Show[GeoGraphics[{Red, 
    Arrow@GeoPath[{{y1, x1}, {(y2 - y1)/(x2 - x1) (x - x1) + y1, 
        x}}]}, GeoRange -> {{-50, 5}, {-90, -50}}], 
  PlotRange -> {{-0.2, 0.2}, {-0.4, 0.4}}], {{x, x1 + 0.1, 
   "Santiago"}, x1 + 0.1, x2}]

Perhaps there is a better way to achieve that.

Some typical example:

capitals = EntityValue[CountryData["Europe"], "CapitalCity"]

positions = EntityValue[capitals, "Position"];
{distance, order} = FindShortestTour[positions];

imgs = ParallelTable[
  GeoGraphics[{
    Red, Thick, GeoPath[positions[[order[[;; k]]]]],
    Red, PointSize[.02], Point[positions]},
   GeoCenter -> GeoPosition[{54.78, 5.73}],
   GeoProjection -> "Equirectangular",
   GeoRange -> {{30, 83}, {-25, 40}},
   ImageSize -> 500]
  , {k, 1, 52}]

If you are working in the Wolfram Cloud:

CloudExport[imgs, "GIF", Permissions -> "Public"]

And for the desktop:

Export["test.gif", imgs]

ebf4505c-29c7-4d9f-bcbc-706562d78c85.gif