I have latitude and longitude locations that I need density (or contour) plot to overlay on a map. For example:
dat = {{40.5`, -111.35`}, {37.84`, -112.87`}, {38.79`, -112.05`},
{40.28`, -109.23`}, {38.79`, -112.04`}, {41.42`, -112.87`}, {37.09`,
-112.9`}, {37.82`, -113.1`}, {42, -112.6`}, {39.58`, -111.69`},
{40.69`, -109.31`}, {38.074`, -112.192`}, {38.71`, -112.43`},
{38.73`, -112.44`}, {38.73`, -112.45`}, {38.72`, -112.46`}, {38.71`,
-112.44`}, {38.73`, -112.44`}, {41.42`, -112.87`}, {38.88`,
-111.98`}, {38.86`, -111.97`}, {38.89`, -111.98`}, {39.75`,
-110.84`}, {40.61`, -109.41`}};
ad = AdministrativeDivisionData[{"Utah", "UnitedStates"}];
GeoGraphics[{Gray, ad["Polygon"], Red, PointSize[.01],
Point[GeoPosition /@ Rest@dat]}, GeoBackground -> None]
I create the density plot.
sdh = SmoothDensityHistogram[Reverse[dat, 2], PlotRange -> Full,
PlotRangePadding -> None, Frame -> False, ImagePadding -> None]
However, when I overlay it on the geographic region the density plot is not aligned with the geographic locations.
GeoGraphics[{
{Gray, GeoStyling[{"GeoImage", sdh}], ad["Polygon"]},
{Red, PointSize[.01], Point[GeoPosition /@ Rest@dat]}},
GeoBackground -> None]
What am I doing wrong? Should I be using something other than "GeoImage"
?
RegionFunction
for the histogram plot $\endgroup$GeoGraphics
it may be a good workaround if nothing else materializes. Please post as an answer. $\endgroup$