4
$\begingroup$

I want to create a heatmap in relation with a CityMap.

A example of my dataset is:

data = {{GeoPosition[{52.4221, 4.79205}], 
  0.000972465}, {GeoPosition[{52.4264, 4.84578}], 
  0.0010099}, {GeoPosition[{52.4177, 4.82724}], 
  0.00112501}, {GeoPosition[{52.4214, 4.88542}], 
  0.0177381}, {GeoPosition[{52.4205, 
    4.87914}], -0.0298788}, {GeoPosition[{52.4291, 4.85623}], 
  0.00296465}, {GeoPosition[{52.4291, 4.85623}], 
  0.00217909}, {GeoPosition[{52.4198, 
    4.88569}], -0.000724821}, {GeoPosition[{52.4208, 
    4.88559}], -0.00372882}, {GeoPosition[{52.42, 4.85725}], 
  0.0016284}, {GeoPosition[{52.42, 4.85725}], 
  0.00107895}, {GeoPosition[{52.42, 4.85725}], 
  0.0013905}, {GeoPosition[{52.4234, 4.88412}], 
  0.000964795}, {GeoPosition[{52.4236, 4.88547}], 
  0.000709201}, {GeoPosition[{52.4228, 4.88614}], 
  0.00030988}, {GeoPosition[{52.418, 
    4.88252}], -0.000596178}, {GeoPosition[{52.4192, 
    4.88384}], -0.000621033}, {GeoPosition[{52.4183, 
    4.88494}], -0.000895842}, {GeoPosition[{52.417, 
    4.88418}], -0.000822613}, {GeoPosition[{52.4177, 4.87921}], 
  0.000309823}, {GeoPosition[{52.4378, 4.86506}], 
  0.00184676}, {GeoPosition[{52.4378, 4.86506}], 
  0.00188428}, {GeoPosition[{52.4196, 
    4.88231}], -0.000894745}, {GeoPosition[{52.4188, 
    4.88161}], -0.000619265}, {GeoPosition[{52.422, 4.88651}], 
  0.00151762}, {GeoPosition[{52.4197, 4.88069}], 0.00505053}}

In this data I have the Latitude and Longitude and a value. This value can be positive or negative. This is important because the legend must show the reader how to interpretate the values (the values are water highs in a city like Amsterdam).

My approach is like

data1=WeightedData[data[[All, 1]], data[[All, 2]]]

GeoSmoothHistogram[data1, PlotLegends -> Placed[Automatic, Below], 
 GeoScaleBar -> "Metric", Mesh -> 6, MeshStyle -> {Red, Dotted}, 
 GeoRange -> {{52.2967, 52.4214}, {4.7696, 5.0190}}, 
 ImageSize -> 1000]

When I use WeightedData in combination with negative values, I get an error (Mathematica 12.0). Who has a suggestion to create this citymap?

$\endgroup$

1 Answer 1

1
$\begingroup$

I don't think weights can be negative. Try GeoRegionValuePlot

GeoRegionValuePlot[data,
 PlotLegends -> Placed[Automatic, Below],
 GeoScaleBar -> "Metric",
 GeoRange -> {{52.2967, 52.5214}, {4.7696, 5.0190}}]

enter image description here

$\endgroup$

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.