Say I have some location data.

locs = GeoPosition[
  Reverse[RandomPoint[Rectangle[{-88.6273, 29.6616}, {-84.2036, 32.7994}], 400], 2]]

I want to create a fully interactive GeoHistogram (with tooltips and other additions still functioning) but with a GeoStyling["OutlineMap"] specification for the states/provencies (EntityClass["AdministrativeDivision", "ADM2"]) within the GeoBounds of the data (plus any GeoPadding).

Unfortunately it appears that GeoBackground cannot be used as you cannot specify the geo-polygons directly or with an "AdministrativeDivision" class.

 GeoRangePadding -> Quantity[2, "AngularDegrees"],
 GeoBackground -> {GeoStyling["OutlineMap", 
    Directive[Lighter[LightGray, .25], EdgeForm[LightYellow]]], 
   EntityClass["AdministrativeDivision", "ADM2"]}]

Mathematica graphics

You can however, create the backround and the histrogram separately and use Show but this appears to be broken.

With the map background you have to know what areas you are in since simply specifying EntityClass["AdministrativeDivision", "ADM2"]["Polygon"] starts the download of ten's of thousand's of polygons.

map =
    Directive[Lighter[LightGray, .25], EdgeForm[LightYellow]]], 
   EntityClass["AdministrativeDivision", "ContinentalUSStates"]["Polygon"]},
  GeoBackground -> Lighter[LightBlue, .25],
  GeoRange -> GeoBounds[locs],
  GeoRangePadding -> Quantity[2, "AngularDegrees"]

Mathematica graphics

Creating an none background for a GeoHistogram is easy enough.

geoHist = 
 GeoHistogram[locs, GeoRangePadding -> Quantity[2, "AngularDegrees"], 
  GeoBackground -> None]

Mathematica graphics

However it appears that Show does not work with GeoGraphics. It completely ignores the GeoBounds option. However, interactivity is preserved.

Show[map, geoHist]

Mathematica graphics

Overlay works but kills the interactivity. Tooltips and other added functionality do not work.

Overlay[{map, geoHist}]

Mathematica graphics

Therefore, I would like to know if there are some hidded options/features for GeoHistogram that will preserve interactivity while allowing a GeoStyling["OutlineMap"] specification at an "AdministrativeDivision" class level ("ADM1", "ADM2", or "ADM3") without having to EntityPrefetch all "AdministrativeDivision" "Polygon"s available. Any ideas? Also, confirmation on the apparent Show bug.

Mma 11.3.0 on Win 10 Ent

  • 1
    $\begingroup$ Side note first, by setting the second layer as the active one you can preserve tooltips etc: Overlay[{map, geoHist}, All, 2] I'm not sure about geo options (and don't want to investigate) but if you repeat relevant ones in Show it looks ok too: Show[map, geoHist , GeoRange -> GeoBounds[locs] , GeoRangePadding -> Quantity[2, "AngularDegrees"] ] $\endgroup$
    – Kuba
    May 9, 2018 at 20:08
  • $\begingroup$ This was an answer but I realized it does not address the question :) $\endgroup$
    – Kuba
    May 9, 2018 at 20:19
  • $\begingroup$ @Kuba This Show and Overlay clarification is very helpful. Thanks. $\endgroup$
    – Edmund
    May 9, 2018 at 20:26

1 Answer 1


You could use this line at the Show statement...

Show[map, geoHist, GeoRange -> OptionValue[Options[geoHist], GeoRange]]

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.