5
$\begingroup$

I have been going through the documentation of GeoMarker.

But I do not see any way to add text to these GeoMarkers. I would like to number them, is there anyway to do this?

$\endgroup$
  • $\begingroup$ You can use Text with a GeoPosition, which could be the position of the marker with a small offset. Please see my comment here or the answer here. $\endgroup$ – C. E. Jun 4 '17 at 21:10
4
$\begingroup$

If you want to add a custom value to your GeoMarker you can do as follows:

cities = {Entity["City", {"Rome", "Lazio", "Italy"}], 
   Entity["City", {"Padova", "Veneto", "Italy"}], 
   Entity["City", {"Palermo", "Sicily", "Italy"}]};  

 GeoGraphics[{GeoStyling["OutlineMap"], Polygon[Entity["Country", "Italy"]], 
 MapThread[{GeoMarker[#1], White, 
 Text[Style[#2, Bold], #1, {0, -2.5}]} &, {cities, {"10", "45", 
 "120"}}]}]

enter image description here

$\endgroup$
3
$\begingroup$

You can use Text and its third argument to place the label in the correct position.

cities = {Entity["City", {"Rome", "Lazio", "Italy"}], 
   Entity["City", {"Padova", "Veneto", "Italy"}], 
   Entity["City", {"Palermo", "Sicily", "Italy"}]};

GeoGraphics[{GeoStyling["OutlineMap"], 
  Polygon[Entity["Country", "Italy"]], 
  MapIndexed[{GeoMarker[#1], White, Text[Style[First[#2], Bold], #1, {0, -2.5}]} &, cities]}]

Mathematica graphics

$\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.