7
$\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$
1
  • $\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.
    Commented Jun 4, 2017 at 21:10

2 Answers 2

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 and acknowledge you have read our privacy policy.

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