1
$\begingroup$

Given a list of {latitude, longitude, speed} e.g.

data = {{28.3861, -81.4824, 11.}, {28.3861, -81.4825, 6.}, {28.386, -81.4826, 16.},
{28.3859, -81.4829, 32.}, {28.3858, -81.4832, 43.}, {28.3857, -81.4837, 51.},
{28.3856, -81.4841, 54.}, {28.3855, -81.4846, 54.},{28.3853, -81.4849, 45.},
{28.3852, -81.485, 17.},{28.3852, -81.4849, 16.}, {28.3853, -81.4847, 28.},
{28.3854, -81.4843, 45.}, {28.3855, -81.4838, 56.},{28.3857, -81.4833, 64.},
{28.3858, -81.4827, 72.},{28.386, -81.4821, 78.}, {28.3862, -81.4814, 82.},
{28.3864, -81.4807, 83.}, {28.3866, -81.48, 83.},{28.3868, -81.4793, 85.}}

The lat/long points can be plotting using

GeoListPlot[GeoPosition[Most[#]] & /@ data, 
 GeoBackground -> "StreetMap", GeoProjection -> "Mercator"]

enter image description here

How can the points be plotted using a color that is proportional to speed? Like

range = MinMax[data[[All, 3]]]
ColorData["ThermometerColors"][Rescale[Last[#], range]] & /@ data

GeoListPlot does not accept a ColorFunction option.

$\endgroup$
2
$\begingroup$

You can wrap coordinates with Style using the Rescaled values of the third column to color the points:

GeoListPlot[Style @@@ 
  Transpose[{GeoPosition /@ data[[All, ;; 2]], 
    ColorData["ThermometerColors"]/@ Rescale[data[[All, -1]]]}], 
  GeoBackground -> "StreetMap", GeoProjection -> "Mercator"]

enter image description here

$\endgroup$
  • $\begingroup$ Thanks for this solution. If I add the Joined -> True option the points are joined, but the color mapping is ignored. Any ideas on how to solve that? $\endgroup$ – Rohit Namjoshi May 14 at 1:55
  • $\begingroup$ @Rohit, try GeoListPlot[{GeoPosition /@ data[[All, ;; 2]],Style @@@ Transpose[{GeoPosition /@ data[[All, ;; 2]], ColorData["ThermometerColors"]/@ Rescale[data[[All, -1]]]}]}, GeoBackground -> "StreetMap", GeoProjection -> "Mercator", Joined->{True, False}]. $\endgroup$ – kglr May 14 at 3:30
  • $\begingroup$ I see, first plot the points joined and then plot the colored points. Thanks! $\endgroup$ – Rohit Namjoshi May 14 at 18:34
3
$\begingroup$

You may use GeoRegionValuePlot.

GeoRegionValuePlot[GeoPosition@*Most@# -> Last@# & /@ data,
 GeoBackground -> "StreetMap",
 GeoProjection -> "Mercator"]

Mathematica graphics

Hope this helps.

$\endgroup$
1
$\begingroup$

Try this:

GeoListPlot[{GeoPosition[Most[#]]} & /@ data, 
  GeoBackground -> "StreetMap", GeoProjection -> "Mercator", 
  PlotLegends -> False, PlotMarkers -> Point, 
  PlotStyle -> 
  ColorConvert[(ColorData["Rainbow"][#3/85]) & @@@ data, "RGB"]]

enter image description here

$\endgroup$
  • $\begingroup$ Thanks Kevin. This works fine for small datasets. For large datasets ~3,000 points it is quite slow. $\endgroup$ – Rohit Namjoshi May 11 at 17:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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