1
$\begingroup$
entity = RandomEntity["Country"]
cities = CityData[{Large, CanonicalName@entity}]



  Manipulate[
 {PopupMenu[x, cities], PopupMenu[y, cities]},
 Button["Random", entity = RandomEntity["Country"]], 
 Dynamic[DynamicGeoGraphics[{GeoMarker[cities], 
    GeoPath[{x, y}, "Geodesic"]}]]]

I have these lines of code and I want to create a geographic map that creates a GeoPath from city x to city y based on what the user chooses from the popup menu. The output is not working. What am I doing wrong?

$\endgroup$

1 Answer 1

1
$\begingroup$
entity = RandomEntity["Country"]

enter image description here

cities = CityData[{Large, CanonicalName @ entity}]

enter image description here

Manipulate[DynamicGeoGraphics[{GeoMarker[cities], GeoPath[{x, y}, "Geodesic"]}],
{{x, First @ cities}, Thread[cities -> CommonName /@ cities], ControlType -> PopupMenu},
{{y, Last @ cities}, Thread[cities -> CommonName /@ cities], ControlType -> PopupMenu}]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.