I would like to draw a GeoDisk[] that covers the entire path between 2 given locations.
Path can be GeoPath[] or TravelDirections[]. How do i do this? Any suggestions?
Do you want precisely the smallest? I think some iterative algorithm might be the easiest options: draw a circle with a radius that equals the distance to the furthest point. as a function of lat and long, starting at the mean location all of the points. Using FindMinimum (on the radius) the lat and long should be quite quickly found…
Yes, a smallest disk that has both points inside it.
td = TravelDirections[{Entity[“Building”,
“EmpireStateBuilding::h583b”],
Entity[“Building”, “GrandCentralTerminal::xyg9f”]}];
points = Union[
Cases[td[“TravelPath”] /.
GeoPath[GeoPosition[a_], “TravelPath”] → a, {_, _}, {2}]];
combo = Flatten[
Table[{points[[i]], points[[j]]}, {i, Length@points - 1}, {j,
i + 1, Length@points}], 1];
last = SortBy[{GeoPosition[Mean[#]], #,
EuclideanDistance[#[1], #[[2]]]} & /@ combo, Last] // Last;
GeoGraphics[{GeoPath@td,
GeoDisk[last[1], 0.5 GeoDistance[Sequence@last[[2]]]]}]
I was thinking roughly the same, at first, but it does not always cover all the points:
points={{40.74789000000001`,-73.98916`},{40.753990000000016`,-73.97420000000001`},{40.75607100561154`,-73.98731010197233`}};
combo = Subsets[points, {2}];
last=SortBy[{GeoPosition[Mean[#]],#,EuclideanDistance[#[[1]],#[[2]]]}&/@combo,Last]//Last;
GeoGraphics[{GeoMarker@GeoPosition@points,GeoDisk[last[[1]],0.5 GeoDistance[Sequence@last[[2]]]]}]


