0
$\begingroup$

I have created a code to get information about countries. I created a tooltip to identify cities on a graphics but when I go through the popup menu and click another country, the code doesn't reevaluate the points to label new cities.

Manipulate[

 Graphics[{Gray, CountryData[Country, "Polygon"], PointSize[Large], 
   Red, Tooltip[Point[Reverse[CityData[#, "Coordinates"]]], 
      CityData[#, "Name"]] & /@ 
    CityData[{Large, Country}]}], {{Country, "Afghanistan"}, 
  Dynamic[CountryData[], SynchronousUpdating -> True], 
  ControlType -> PopupMenu},

 Style["Full Name", FontFamily -> "American Typewriter", 
  FontSize -> 15],
        Panel[Dynamic[CountryData[Country, "FullName"]]],
         Style["Area", FontFamily -> "American Typewriter", 
  FontSize -> 15],
        Panel[Dynamic[CountryData[Country, "Area"]]],
    Style["Population", FontFamily -> "American Typewriter", 
  FontSize -> 15],
        Panel[Dynamic[CountryData[Country, "Population"]]],
    Style["Flag", FontFamily -> "American Typewriter", FontSize -> 15],
          Panel[Dynamic[CountryData[Country, "Flag"]]], 

 Style["Coordinates", FontFamily -> "American Typewriter", 
  FontSize -> 15],
                 Panel[Dynamic[CityData["Chicago", "Coordinates"]]]
$\endgroup$
2
$\begingroup$

Using county entities in CityData does not work:

CityData[{Large, Entity["Country", "Austria"]}]

need to use:

CityData[{Large, "Austria"}]

Here is a small example of corrected code:

Manipulate[
 Graphics[
  { Gray, CountryData[Country, "Polygon"], 
    PointSize[Large], Red, 
    Tooltip[
      Point[Reverse[CityData[#, "Coordinates"]]], 
      CityData[#, "Name"]
    ] & /@ CityData[{Large, Country["Name"]  (*!!!*)}]}
  ],
 {{Country, Entity["Country", "Afghanistan"] (*!!!*)}, CountryData[], ControlType -> PopupMenu}
 ]
|improve this answer|||||
$\endgroup$

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.