Finding position at given distance in a GeoPath











up vote
8
down vote

favorite
4












Is there a way to find the geoposition of a given distance from start in a GeoPath? I want to mark equidistant positions along a track, for example, a mark every 500 km along the path given by



path=GeoGraphics[
GeoPath[{
Entity["City", {"Boston", "Massachusetts", "UnitedStates"}],
Entity["City", {"Rochester", "NewYork", "UnitedStates"}],
Entity["City", {"Chicago", "Illinois", "UnitedStates"}]
}, "Rhumb"]
]


Is there a way to find the pos that gives GeoDistance[Entity["City", {"Boston", "Massachusetts", "UnitedStates"}],pos]==500 km along the path?










share|improve this question









New contributor




Gunnar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
























    up vote
    8
    down vote

    favorite
    4












    Is there a way to find the geoposition of a given distance from start in a GeoPath? I want to mark equidistant positions along a track, for example, a mark every 500 km along the path given by



    path=GeoGraphics[
    GeoPath[{
    Entity["City", {"Boston", "Massachusetts", "UnitedStates"}],
    Entity["City", {"Rochester", "NewYork", "UnitedStates"}],
    Entity["City", {"Chicago", "Illinois", "UnitedStates"}]
    }, "Rhumb"]
    ]


    Is there a way to find the pos that gives GeoDistance[Entity["City", {"Boston", "Massachusetts", "UnitedStates"}],pos]==500 km along the path?










    share|improve this question









    New contributor




    Gunnar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.






















      up vote
      8
      down vote

      favorite
      4









      up vote
      8
      down vote

      favorite
      4






      4





      Is there a way to find the geoposition of a given distance from start in a GeoPath? I want to mark equidistant positions along a track, for example, a mark every 500 km along the path given by



      path=GeoGraphics[
      GeoPath[{
      Entity["City", {"Boston", "Massachusetts", "UnitedStates"}],
      Entity["City", {"Rochester", "NewYork", "UnitedStates"}],
      Entity["City", {"Chicago", "Illinois", "UnitedStates"}]
      }, "Rhumb"]
      ]


      Is there a way to find the pos that gives GeoDistance[Entity["City", {"Boston", "Massachusetts", "UnitedStates"}],pos]==500 km along the path?










      share|improve this question









      New contributor




      Gunnar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      Is there a way to find the geoposition of a given distance from start in a GeoPath? I want to mark equidistant positions along a track, for example, a mark every 500 km along the path given by



      path=GeoGraphics[
      GeoPath[{
      Entity["City", {"Boston", "Massachusetts", "UnitedStates"}],
      Entity["City", {"Rochester", "NewYork", "UnitedStates"}],
      Entity["City", {"Chicago", "Illinois", "UnitedStates"}]
      }, "Rhumb"]
      ]


      Is there a way to find the pos that gives GeoDistance[Entity["City", {"Boston", "Massachusetts", "UnitedStates"}],pos]==500 km along the path?







      geographics






      share|improve this question









      New contributor




      Gunnar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question









      New contributor




      Gunnar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question








      edited Nov 28 at 13:10









      Kuba

      103k12200511




      103k12200511






      New contributor




      Gunnar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked Nov 28 at 12:57









      Gunnar

      412




      412




      New contributor




      Gunnar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      Gunnar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      Gunnar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          6
          down vote













          Here's my attempt to parametrize the path by arclength, where here arclength is GeoLength.



          First I build up a function that can be used on many values:



          ParametrizeGeoPath[g_GeoPath, t_] := ParametrizeGeoPath[g][t]

          ParametrizeGeoPath[GeoPath[locs_, args___]] :=
          Block[{line, nodes, lens, acc, nf, n1, n2, solver},
          line = GeoGraphics`GeoEvaluate[GeoPath[locs, args]];
          nodes = GeoPosition /@ Reverse[line[[1]], {2}];
          lens = QuantityMagnitude[UnitConvert[GeoLength[GeoPath[#, args]]& /@ Partition[nodes, 2, 1], "Kilometers"]];
          acc = Accumulate[lens];
          nf = Nearest[acc -> {"Index", "Element"}];

          GeoPathParametricFunction[acc, nodes, nf, args]
          ]


          Given a target distance, we can invert GeoLength with FindRoot:



          GeoPathParametricFunction[_, nodes_, __][d_] /; d == 0 := First[nodes]

          GeoPathParametricFunction[acc_, nodes_, __][d_] /; d == Last[acc] := Last[nodes]

          GeoPathParametricFunction[acc_, nodes_, nf_, args___][d_] /; 0 < d < Last[acc] :=
          Block[{i, v, s, n1, n2, dist, root, t = Unique["t"]},
          {i, v} = First[nf[d]];
          If[v > d, i--];
          s = If[i == 0, 0, acc[[i]]];
          n1 = nodes[[i+1, 1]];
          n2 = nodes[[i+2, 1]];

          dist[t_?NumericQ] := s + QuantityMagnitude[UnitConvert[GeoLength[GeoPath[{GeoPosition[n1], GeoPosition[(1-t)n1 + t n2]}, args]], "Kilometers"]];

          root = Quiet@FindRoot[dist[t] == d, {t, .5, 0, 1}];

          (
          GeoPosition[(1-t)n1 + t n2] /. root

          ) /; MatchQ[root, {t -> _Real}]
          ]

          GeoPathParametricFunction[___][d_?NumericQ] = Indeterminate;

          GeoPathParametricFunction /: MakeBoxes[expr:GeoPathParametricFunction[__], _] := InterpretationBox[RowBox[{"GeoPathParametricFunction", "[", ""[Ellipsis]"", "]"}], expr]


          Your example:



          path = GeoPath[{
          Entity["City", {"Boston", "Massachusetts", "UnitedStates"}],
          Entity["City", {"Rochester", "NewYork", "UnitedStates"}],
          Entity["City", {"Chicago", "Illinois", "UnitedStates"}]
          }, "Rhumb"];

          gpf = ParametrizeGeoPath[path];

          gpf[500]



           GeoPosition[{43.0932, -77.0359}]



          Manipulate[GeoGraphics[{
          path,
          GeoMarker[gpf[d]]
          },
          PlotLabel -> Row[{"Distance: ", Quantity[d, "Kilometers"]}]],
          {d, 0, gpf[[1, -1]]}
          ]


          enter image description here



          The points returned are very close to the initial path:



          ListLinePlot[
          GeoDistance[path, g /@ Range[0, 1300, 100]],
          TargetUnits -> "Meters",
          AxesLabel -> Automatic,
          DataRange -> {0, 1300}
          ]


          enter image description here






          share|improve this answer























          • Excellent work. I will certainly be using some aspects of your answer in other geo data related work I have been doing.
            – kickert
            Nov 28 at 16:01


















          up vote
          4
          down vote













          Here is a function for finding GeoPositions between 2 cities with certain step



          city1 = Entity["City", {"Boston", "Massachusetts", "UnitedStates"}];
          city2 = Entity["City", {"Rochester", "NewYork", "UnitedStates"}];
          city3 = Entity["City", {"Chicago", "Illinois", "UnitedStates"}];

          geopath[c1_, c2_, step_] := Module[{s = First@GeoDistance[c1, c2],
          a = GeoDirection[c1, c2]},
          GeoPath[NestList[GeoDestination[#,{1000 step,a}]&,c1,Floor[s/step]],"Rhumb"]]


          Now if you want to find positions from city1 to city2 every 100 km, type



          geopath[city1, city2, 100]    


          and you will get the positions




          GeoPath[{Entity["City", {"Boston", "Massachusetts", "UnitedStates"}],
          GeoPosition[{42.5124, -72.2106}], GeoPosition[{42.6928, -73.4044}],
          GeoPosition[{42.8732, -74.6017}], GeoPosition[{43.0535, -75.8026}],
          GeoPosition[{43.2338, -77.0069}]}, "Rhumb"]







          share|improve this answer























            Your Answer





            StackExchange.ifUsing("editor", function () {
            return StackExchange.using("mathjaxEditing", function () {
            StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
            StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
            });
            });
            }, "mathjax-editing");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "387"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });






            Gunnar is a new contributor. Be nice, and check out our Code of Conduct.










            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f186878%2ffinding-position-at-given-distance-in-a-geopath%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            6
            down vote













            Here's my attempt to parametrize the path by arclength, where here arclength is GeoLength.



            First I build up a function that can be used on many values:



            ParametrizeGeoPath[g_GeoPath, t_] := ParametrizeGeoPath[g][t]

            ParametrizeGeoPath[GeoPath[locs_, args___]] :=
            Block[{line, nodes, lens, acc, nf, n1, n2, solver},
            line = GeoGraphics`GeoEvaluate[GeoPath[locs, args]];
            nodes = GeoPosition /@ Reverse[line[[1]], {2}];
            lens = QuantityMagnitude[UnitConvert[GeoLength[GeoPath[#, args]]& /@ Partition[nodes, 2, 1], "Kilometers"]];
            acc = Accumulate[lens];
            nf = Nearest[acc -> {"Index", "Element"}];

            GeoPathParametricFunction[acc, nodes, nf, args]
            ]


            Given a target distance, we can invert GeoLength with FindRoot:



            GeoPathParametricFunction[_, nodes_, __][d_] /; d == 0 := First[nodes]

            GeoPathParametricFunction[acc_, nodes_, __][d_] /; d == Last[acc] := Last[nodes]

            GeoPathParametricFunction[acc_, nodes_, nf_, args___][d_] /; 0 < d < Last[acc] :=
            Block[{i, v, s, n1, n2, dist, root, t = Unique["t"]},
            {i, v} = First[nf[d]];
            If[v > d, i--];
            s = If[i == 0, 0, acc[[i]]];
            n1 = nodes[[i+1, 1]];
            n2 = nodes[[i+2, 1]];

            dist[t_?NumericQ] := s + QuantityMagnitude[UnitConvert[GeoLength[GeoPath[{GeoPosition[n1], GeoPosition[(1-t)n1 + t n2]}, args]], "Kilometers"]];

            root = Quiet@FindRoot[dist[t] == d, {t, .5, 0, 1}];

            (
            GeoPosition[(1-t)n1 + t n2] /. root

            ) /; MatchQ[root, {t -> _Real}]
            ]

            GeoPathParametricFunction[___][d_?NumericQ] = Indeterminate;

            GeoPathParametricFunction /: MakeBoxes[expr:GeoPathParametricFunction[__], _] := InterpretationBox[RowBox[{"GeoPathParametricFunction", "[", ""[Ellipsis]"", "]"}], expr]


            Your example:



            path = GeoPath[{
            Entity["City", {"Boston", "Massachusetts", "UnitedStates"}],
            Entity["City", {"Rochester", "NewYork", "UnitedStates"}],
            Entity["City", {"Chicago", "Illinois", "UnitedStates"}]
            }, "Rhumb"];

            gpf = ParametrizeGeoPath[path];

            gpf[500]



             GeoPosition[{43.0932, -77.0359}]



            Manipulate[GeoGraphics[{
            path,
            GeoMarker[gpf[d]]
            },
            PlotLabel -> Row[{"Distance: ", Quantity[d, "Kilometers"]}]],
            {d, 0, gpf[[1, -1]]}
            ]


            enter image description here



            The points returned are very close to the initial path:



            ListLinePlot[
            GeoDistance[path, g /@ Range[0, 1300, 100]],
            TargetUnits -> "Meters",
            AxesLabel -> Automatic,
            DataRange -> {0, 1300}
            ]


            enter image description here






            share|improve this answer























            • Excellent work. I will certainly be using some aspects of your answer in other geo data related work I have been doing.
              – kickert
              Nov 28 at 16:01















            up vote
            6
            down vote













            Here's my attempt to parametrize the path by arclength, where here arclength is GeoLength.



            First I build up a function that can be used on many values:



            ParametrizeGeoPath[g_GeoPath, t_] := ParametrizeGeoPath[g][t]

            ParametrizeGeoPath[GeoPath[locs_, args___]] :=
            Block[{line, nodes, lens, acc, nf, n1, n2, solver},
            line = GeoGraphics`GeoEvaluate[GeoPath[locs, args]];
            nodes = GeoPosition /@ Reverse[line[[1]], {2}];
            lens = QuantityMagnitude[UnitConvert[GeoLength[GeoPath[#, args]]& /@ Partition[nodes, 2, 1], "Kilometers"]];
            acc = Accumulate[lens];
            nf = Nearest[acc -> {"Index", "Element"}];

            GeoPathParametricFunction[acc, nodes, nf, args]
            ]


            Given a target distance, we can invert GeoLength with FindRoot:



            GeoPathParametricFunction[_, nodes_, __][d_] /; d == 0 := First[nodes]

            GeoPathParametricFunction[acc_, nodes_, __][d_] /; d == Last[acc] := Last[nodes]

            GeoPathParametricFunction[acc_, nodes_, nf_, args___][d_] /; 0 < d < Last[acc] :=
            Block[{i, v, s, n1, n2, dist, root, t = Unique["t"]},
            {i, v} = First[nf[d]];
            If[v > d, i--];
            s = If[i == 0, 0, acc[[i]]];
            n1 = nodes[[i+1, 1]];
            n2 = nodes[[i+2, 1]];

            dist[t_?NumericQ] := s + QuantityMagnitude[UnitConvert[GeoLength[GeoPath[{GeoPosition[n1], GeoPosition[(1-t)n1 + t n2]}, args]], "Kilometers"]];

            root = Quiet@FindRoot[dist[t] == d, {t, .5, 0, 1}];

            (
            GeoPosition[(1-t)n1 + t n2] /. root

            ) /; MatchQ[root, {t -> _Real}]
            ]

            GeoPathParametricFunction[___][d_?NumericQ] = Indeterminate;

            GeoPathParametricFunction /: MakeBoxes[expr:GeoPathParametricFunction[__], _] := InterpretationBox[RowBox[{"GeoPathParametricFunction", "[", ""[Ellipsis]"", "]"}], expr]


            Your example:



            path = GeoPath[{
            Entity["City", {"Boston", "Massachusetts", "UnitedStates"}],
            Entity["City", {"Rochester", "NewYork", "UnitedStates"}],
            Entity["City", {"Chicago", "Illinois", "UnitedStates"}]
            }, "Rhumb"];

            gpf = ParametrizeGeoPath[path];

            gpf[500]



             GeoPosition[{43.0932, -77.0359}]



            Manipulate[GeoGraphics[{
            path,
            GeoMarker[gpf[d]]
            },
            PlotLabel -> Row[{"Distance: ", Quantity[d, "Kilometers"]}]],
            {d, 0, gpf[[1, -1]]}
            ]


            enter image description here



            The points returned are very close to the initial path:



            ListLinePlot[
            GeoDistance[path, g /@ Range[0, 1300, 100]],
            TargetUnits -> "Meters",
            AxesLabel -> Automatic,
            DataRange -> {0, 1300}
            ]


            enter image description here






            share|improve this answer























            • Excellent work. I will certainly be using some aspects of your answer in other geo data related work I have been doing.
              – kickert
              Nov 28 at 16:01













            up vote
            6
            down vote










            up vote
            6
            down vote









            Here's my attempt to parametrize the path by arclength, where here arclength is GeoLength.



            First I build up a function that can be used on many values:



            ParametrizeGeoPath[g_GeoPath, t_] := ParametrizeGeoPath[g][t]

            ParametrizeGeoPath[GeoPath[locs_, args___]] :=
            Block[{line, nodes, lens, acc, nf, n1, n2, solver},
            line = GeoGraphics`GeoEvaluate[GeoPath[locs, args]];
            nodes = GeoPosition /@ Reverse[line[[1]], {2}];
            lens = QuantityMagnitude[UnitConvert[GeoLength[GeoPath[#, args]]& /@ Partition[nodes, 2, 1], "Kilometers"]];
            acc = Accumulate[lens];
            nf = Nearest[acc -> {"Index", "Element"}];

            GeoPathParametricFunction[acc, nodes, nf, args]
            ]


            Given a target distance, we can invert GeoLength with FindRoot:



            GeoPathParametricFunction[_, nodes_, __][d_] /; d == 0 := First[nodes]

            GeoPathParametricFunction[acc_, nodes_, __][d_] /; d == Last[acc] := Last[nodes]

            GeoPathParametricFunction[acc_, nodes_, nf_, args___][d_] /; 0 < d < Last[acc] :=
            Block[{i, v, s, n1, n2, dist, root, t = Unique["t"]},
            {i, v} = First[nf[d]];
            If[v > d, i--];
            s = If[i == 0, 0, acc[[i]]];
            n1 = nodes[[i+1, 1]];
            n2 = nodes[[i+2, 1]];

            dist[t_?NumericQ] := s + QuantityMagnitude[UnitConvert[GeoLength[GeoPath[{GeoPosition[n1], GeoPosition[(1-t)n1 + t n2]}, args]], "Kilometers"]];

            root = Quiet@FindRoot[dist[t] == d, {t, .5, 0, 1}];

            (
            GeoPosition[(1-t)n1 + t n2] /. root

            ) /; MatchQ[root, {t -> _Real}]
            ]

            GeoPathParametricFunction[___][d_?NumericQ] = Indeterminate;

            GeoPathParametricFunction /: MakeBoxes[expr:GeoPathParametricFunction[__], _] := InterpretationBox[RowBox[{"GeoPathParametricFunction", "[", ""[Ellipsis]"", "]"}], expr]


            Your example:



            path = GeoPath[{
            Entity["City", {"Boston", "Massachusetts", "UnitedStates"}],
            Entity["City", {"Rochester", "NewYork", "UnitedStates"}],
            Entity["City", {"Chicago", "Illinois", "UnitedStates"}]
            }, "Rhumb"];

            gpf = ParametrizeGeoPath[path];

            gpf[500]



             GeoPosition[{43.0932, -77.0359}]



            Manipulate[GeoGraphics[{
            path,
            GeoMarker[gpf[d]]
            },
            PlotLabel -> Row[{"Distance: ", Quantity[d, "Kilometers"]}]],
            {d, 0, gpf[[1, -1]]}
            ]


            enter image description here



            The points returned are very close to the initial path:



            ListLinePlot[
            GeoDistance[path, g /@ Range[0, 1300, 100]],
            TargetUnits -> "Meters",
            AxesLabel -> Automatic,
            DataRange -> {0, 1300}
            ]


            enter image description here






            share|improve this answer














            Here's my attempt to parametrize the path by arclength, where here arclength is GeoLength.



            First I build up a function that can be used on many values:



            ParametrizeGeoPath[g_GeoPath, t_] := ParametrizeGeoPath[g][t]

            ParametrizeGeoPath[GeoPath[locs_, args___]] :=
            Block[{line, nodes, lens, acc, nf, n1, n2, solver},
            line = GeoGraphics`GeoEvaluate[GeoPath[locs, args]];
            nodes = GeoPosition /@ Reverse[line[[1]], {2}];
            lens = QuantityMagnitude[UnitConvert[GeoLength[GeoPath[#, args]]& /@ Partition[nodes, 2, 1], "Kilometers"]];
            acc = Accumulate[lens];
            nf = Nearest[acc -> {"Index", "Element"}];

            GeoPathParametricFunction[acc, nodes, nf, args]
            ]


            Given a target distance, we can invert GeoLength with FindRoot:



            GeoPathParametricFunction[_, nodes_, __][d_] /; d == 0 := First[nodes]

            GeoPathParametricFunction[acc_, nodes_, __][d_] /; d == Last[acc] := Last[nodes]

            GeoPathParametricFunction[acc_, nodes_, nf_, args___][d_] /; 0 < d < Last[acc] :=
            Block[{i, v, s, n1, n2, dist, root, t = Unique["t"]},
            {i, v} = First[nf[d]];
            If[v > d, i--];
            s = If[i == 0, 0, acc[[i]]];
            n1 = nodes[[i+1, 1]];
            n2 = nodes[[i+2, 1]];

            dist[t_?NumericQ] := s + QuantityMagnitude[UnitConvert[GeoLength[GeoPath[{GeoPosition[n1], GeoPosition[(1-t)n1 + t n2]}, args]], "Kilometers"]];

            root = Quiet@FindRoot[dist[t] == d, {t, .5, 0, 1}];

            (
            GeoPosition[(1-t)n1 + t n2] /. root

            ) /; MatchQ[root, {t -> _Real}]
            ]

            GeoPathParametricFunction[___][d_?NumericQ] = Indeterminate;

            GeoPathParametricFunction /: MakeBoxes[expr:GeoPathParametricFunction[__], _] := InterpretationBox[RowBox[{"GeoPathParametricFunction", "[", ""[Ellipsis]"", "]"}], expr]


            Your example:



            path = GeoPath[{
            Entity["City", {"Boston", "Massachusetts", "UnitedStates"}],
            Entity["City", {"Rochester", "NewYork", "UnitedStates"}],
            Entity["City", {"Chicago", "Illinois", "UnitedStates"}]
            }, "Rhumb"];

            gpf = ParametrizeGeoPath[path];

            gpf[500]



             GeoPosition[{43.0932, -77.0359}]



            Manipulate[GeoGraphics[{
            path,
            GeoMarker[gpf[d]]
            },
            PlotLabel -> Row[{"Distance: ", Quantity[d, "Kilometers"]}]],
            {d, 0, gpf[[1, -1]]}
            ]


            enter image description here



            The points returned are very close to the initial path:



            ListLinePlot[
            GeoDistance[path, g /@ Range[0, 1300, 100]],
            TargetUnits -> "Meters",
            AxesLabel -> Automatic,
            DataRange -> {0, 1300}
            ]


            enter image description here







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Nov 28 at 18:54

























            answered Nov 28 at 15:52









            Chip Hurst

            20k15686




            20k15686












            • Excellent work. I will certainly be using some aspects of your answer in other geo data related work I have been doing.
              – kickert
              Nov 28 at 16:01


















            • Excellent work. I will certainly be using some aspects of your answer in other geo data related work I have been doing.
              – kickert
              Nov 28 at 16:01
















            Excellent work. I will certainly be using some aspects of your answer in other geo data related work I have been doing.
            – kickert
            Nov 28 at 16:01




            Excellent work. I will certainly be using some aspects of your answer in other geo data related work I have been doing.
            – kickert
            Nov 28 at 16:01










            up vote
            4
            down vote













            Here is a function for finding GeoPositions between 2 cities with certain step



            city1 = Entity["City", {"Boston", "Massachusetts", "UnitedStates"}];
            city2 = Entity["City", {"Rochester", "NewYork", "UnitedStates"}];
            city3 = Entity["City", {"Chicago", "Illinois", "UnitedStates"}];

            geopath[c1_, c2_, step_] := Module[{s = First@GeoDistance[c1, c2],
            a = GeoDirection[c1, c2]},
            GeoPath[NestList[GeoDestination[#,{1000 step,a}]&,c1,Floor[s/step]],"Rhumb"]]


            Now if you want to find positions from city1 to city2 every 100 km, type



            geopath[city1, city2, 100]    


            and you will get the positions




            GeoPath[{Entity["City", {"Boston", "Massachusetts", "UnitedStates"}],
            GeoPosition[{42.5124, -72.2106}], GeoPosition[{42.6928, -73.4044}],
            GeoPosition[{42.8732, -74.6017}], GeoPosition[{43.0535, -75.8026}],
            GeoPosition[{43.2338, -77.0069}]}, "Rhumb"]







            share|improve this answer



























              up vote
              4
              down vote













              Here is a function for finding GeoPositions between 2 cities with certain step



              city1 = Entity["City", {"Boston", "Massachusetts", "UnitedStates"}];
              city2 = Entity["City", {"Rochester", "NewYork", "UnitedStates"}];
              city3 = Entity["City", {"Chicago", "Illinois", "UnitedStates"}];

              geopath[c1_, c2_, step_] := Module[{s = First@GeoDistance[c1, c2],
              a = GeoDirection[c1, c2]},
              GeoPath[NestList[GeoDestination[#,{1000 step,a}]&,c1,Floor[s/step]],"Rhumb"]]


              Now if you want to find positions from city1 to city2 every 100 km, type



              geopath[city1, city2, 100]    


              and you will get the positions




              GeoPath[{Entity["City", {"Boston", "Massachusetts", "UnitedStates"}],
              GeoPosition[{42.5124, -72.2106}], GeoPosition[{42.6928, -73.4044}],
              GeoPosition[{42.8732, -74.6017}], GeoPosition[{43.0535, -75.8026}],
              GeoPosition[{43.2338, -77.0069}]}, "Rhumb"]







              share|improve this answer

























                up vote
                4
                down vote










                up vote
                4
                down vote









                Here is a function for finding GeoPositions between 2 cities with certain step



                city1 = Entity["City", {"Boston", "Massachusetts", "UnitedStates"}];
                city2 = Entity["City", {"Rochester", "NewYork", "UnitedStates"}];
                city3 = Entity["City", {"Chicago", "Illinois", "UnitedStates"}];

                geopath[c1_, c2_, step_] := Module[{s = First@GeoDistance[c1, c2],
                a = GeoDirection[c1, c2]},
                GeoPath[NestList[GeoDestination[#,{1000 step,a}]&,c1,Floor[s/step]],"Rhumb"]]


                Now if you want to find positions from city1 to city2 every 100 km, type



                geopath[city1, city2, 100]    


                and you will get the positions




                GeoPath[{Entity["City", {"Boston", "Massachusetts", "UnitedStates"}],
                GeoPosition[{42.5124, -72.2106}], GeoPosition[{42.6928, -73.4044}],
                GeoPosition[{42.8732, -74.6017}], GeoPosition[{43.0535, -75.8026}],
                GeoPosition[{43.2338, -77.0069}]}, "Rhumb"]







                share|improve this answer














                Here is a function for finding GeoPositions between 2 cities with certain step



                city1 = Entity["City", {"Boston", "Massachusetts", "UnitedStates"}];
                city2 = Entity["City", {"Rochester", "NewYork", "UnitedStates"}];
                city3 = Entity["City", {"Chicago", "Illinois", "UnitedStates"}];

                geopath[c1_, c2_, step_] := Module[{s = First@GeoDistance[c1, c2],
                a = GeoDirection[c1, c2]},
                GeoPath[NestList[GeoDestination[#,{1000 step,a}]&,c1,Floor[s/step]],"Rhumb"]]


                Now if you want to find positions from city1 to city2 every 100 km, type



                geopath[city1, city2, 100]    


                and you will get the positions




                GeoPath[{Entity["City", {"Boston", "Massachusetts", "UnitedStates"}],
                GeoPosition[{42.5124, -72.2106}], GeoPosition[{42.6928, -73.4044}],
                GeoPosition[{42.8732, -74.6017}], GeoPosition[{43.0535, -75.8026}],
                GeoPosition[{43.2338, -77.0069}]}, "Rhumb"]








                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Nov 28 at 15:40

























                answered Nov 28 at 13:37









                J42161217

                3,492220




                3,492220






















                    Gunnar is a new contributor. Be nice, and check out our Code of Conduct.










                    draft saved

                    draft discarded


















                    Gunnar is a new contributor. Be nice, and check out our Code of Conduct.













                    Gunnar is a new contributor. Be nice, and check out our Code of Conduct.












                    Gunnar is a new contributor. Be nice, and check out our Code of Conduct.
















                    Thanks for contributing an answer to Mathematica Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    Use MathJax to format equations. MathJax reference.


                    To learn more, see our tips on writing great answers.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f186878%2ffinding-position-at-given-distance-in-a-geopath%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    QoS: MAC-Priority for clients behind a repeater

                    Ивакино (Тотемский район)

                    Can't locate Autom4te/ChannelDefs.pm in @INC (when it definitely is there)