# Can GeoLabels be controlled?

I am making maps of stuff like population density and would like to add labels but GeoLabels makes it awfully busy. Here is an example. I would like to be able to control what gets written, the color, the location. In the following I plot the population density for each county in New Mexico. GeoLabels makes black labels that say stuff like: "Santa Fe County, New Mexico, United States" which is a tad superfluous. I'd prefer it just said "Sante Fe".

Side comment:

I've learned an enormous amount from this site and appreciate it. I'm wondering whether you wizards would've used MapThread the way I did in the call to GeoRegionValue or if you'd have done it some other way. I'm a little slow grocking functional programming.

nmcounties = AdministrativeDivisionData[Entity["AdministrativeDivision", {"NewMexico", "UnitedStates"}], "Subdivisions"];
nmpopdensity =   AdministrativeDivisionData[#, "PopulationDensity"] & /@ nmcounties;
GeoRegionValuePlot[MapThread[Rule, {nmcounties, nmpopdensity}],  ColorFunction -> ColorData["Rainbow"]]
GeoRegionValuePlot[MapThread[Rule, {nmcounties, nmpopdensity}],  ColorFunction -> ColorData["Rainbow"], GeoLabels -> True]

• Not to be pedantic, but in the 10 months you've been a member of this site, you've accepted the answer to one of your questions, once. Did none of those answers serve your needs? If they didn't, did you make clarifications? Or, otherwise try to engage the answerers? If not, why not? – rcollyer Jan 20 '15 at 14:23
• Oops. Sorry. I didn't know there was anything I should have been doing other than up-voting the answers. I've accepted this answer and will try to find my other questions and accept their answers as well. – JEP Jan 20 '15 at 15:25
• Not necessarily a big deal. I just commented to nudge you in the right direction. I, too, have some questions that I have not accepted answers on, but they should be kept to a minimum. Also, I had not intended it as a push to have my answer accepted, so thank you. – rcollyer Jan 20 '15 at 15:46

This required a bit more work than I initially anticipated. To your second question first, per the documentation, GeoRegionValuePlot is quite versatile in what it accepts, and when you are working with a common, queryable propery, you should use the form

GeoRegionValuePlot[enityList -> "property"]


or

GeoRegionValuePlot[EntityClass -> "property"]


as it simplifies what you need to do considerably. So, you could use

GeoRegionValuePlot[
,
"Subdivisions"] -> "PopulationDensity"]


But, I'm partial to the more queryable form

GeoRegionValuePlot[
"PopulationDensity"]


On to the actual question. According to the GeoLabels documentation, the function form of GeoLabels accepts 4 parameters which are polygon, entity, position, and data. So, we need to use this function:

Function[{polygon, entity, pos, data},
{polygon, Black, Text[StringSplit[CommonName@entity, {",", " County"}][[1]], pos]}
]


which results in

An alternate approach is to truncate the labels. However, this does not center the labels.

nmcounties =

Note that you can only need Thread with Rule:
GeoRegionValuePlot[Thread[nmcounties -> nmpopdensity],