0
$\begingroup$
cityList = Sort[CityData[{All, "California"}]]    
distanceToSanFrancisco[s_] := 
 QuantityMagnitude[
  TravelDistance[cityList[[859]], Interpreter["City"][s]]]
(* table1 takes a while to run on my system*)
table1 = Table[{cityList[[k]], 
    distanceToSanFrancisco[cityList[[k]]]}, {k, Length[cityList]}];
citiesWithin[range_] := 
 Module[{s = {}}, 
  Do[If[table1[[k, 2]] <= range, s = Join[s, {cityList[[k]]}]], {k, 
    Length[cityList]}]; s] (*This lists all cities in California that are within `range` of San Francisco.*)
radius = 25;
tolerance = 0.05;
a1 = GeoDisk[
   QuantityMagnitude[
    LatitudeLongitude[Interpreter["City"]["San Francisco"]]],
   Quantity[radius, "Miles"]];
a3 =
  Complement[
   citiesWithin[radius*(1 + tolerance)],
   citiesWithin[radius*(1 - tolerance)]
   ];
Table[a3[[k]] -> distanceToSanFrancisco[a3[[k]]], {k, 1, Length[a3]}]
Show[a2, GeoListPlot[a3, PlotMarkers -> Point], ImageSize -> Medium]

This last one is what I want the tooltips on. For the red points around San Francisco, ideally I would like to get just city name. TIA

$\endgroup$

1 Answer 1

1
$\begingroup$

Using GeoLabels vice Tooltips

Clear["Global`*"]

cityList = Sort[CityData[{All, "California"}]];

Length@cityList

(* 1096 *)

distanceToSanFrancisco[s_] := 
   QuantityMagnitude[TravelDistance[
       Entity["City", {"SanFrancisco", "California", 
            "UnitedStates"}], s]]

table1 = {#, distanceToSanFrancisco[#]} & /@ cityList;

radius = 25;
tolerance = 0.05;

a3 = Select[table1, 
   radius*(1 - tolerance) <= #[[2]] <= radius*(1 + tolerance) &];

GeoListPlot[(First /@ a3),
 PlotMarkers -> Point,
 GeoLabels -> True,
 GeoRangePadding -> Scaled[0.2],
 ImageSize -> Medium]

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.