6

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?

corey979
  • 23,947
  • 7
  • 58
  • 101
  • 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. – C. E. Jun 04 '17 at 21:10

2 Answers2

4

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

andre314
  • 18,474
  • 1
  • 36
  • 69
user34018
  • 869
  • 6
  • 10
3

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

Szabolcs
  • 234,956
  • 30
  • 623
  • 1,263