google-maps-ios-utils icon indicating copy to clipboard operation
google-maps-ios-utils copied to clipboard

HeatMap not visible when it is zoomed in.

Open gurjnderSingh opened this issue 4 years ago • 7 comments

When I do zoom in, HeatMap is visible. As soon I started zoon in I am unable to see the color of the Heat Map.

I am using the same code private var gradientColors = [UIColor.green, UIColor.red] private var gradientStartPoints = [0.2, 1.0] as [NSNumber]

  mapView.delegate = self
  heatmapLayer = GMUHeatmapTileLayer()
  heatmapLayer.radius = 100
  heatmapLayer.opacity = 0.7
  heatmapLayer.gradient = GMUGradient(colors: gradientColors,
                                        startPoints: gradientStartPoints,
                                        colorMapSize: 156)

My code is same as you provided on Google developer site Please let me know if anything is misssing Thanks!

gurjnderSingh avatar Apr 30 '21 12:04 gurjnderSingh

Before ZoomIn CropUploadTeek

After Zoom In CropWrong

gurjnderSingh avatar May 05 '21 06:05 gurjnderSingh

This is perhaps due to the radius size you have set. Based on our docs, the value is recommended to be between 10 and 50. See: https://developers.google.com/maps/documentation/ios-sdk/utility/heatmap#customize-the-heatmap

arriolac avatar May 05 '21 19:05 arriolac

@arriolac Thanks! for your reply. But radius has no effect on this. I have tried all values from 10-60 for radius, for opacity value 1, and colorMapSize value 256. All these have no effect when I do zoom in. The result is the same as the above ss. Even I tried in the sample GitHub code the result is the same. In Android, the same is working fine i.e I have to do the same.

gurjnderSingh avatar May 06 '21 13:05 gurjnderSingh

@arriolac Please help to find the solution.

gurjnderSingh avatar May 16 '21 06:05 gurjnderSingh

Set maxIntensity: 3, as an option of the HeatmapLayer. Before setting this there was just a blur. This map has over ~14k points.

Screenshot 2022-06-13 at 12 51 31 pm

Or where there is a high density of points replace them with one point with a greater weight for performance if you don't require the pin point detail.

james-innes avatar Jun 13 '22 11:06 james-innes

Try this


private var gradientColors = [UIColor.green, UIColor.red]
private var gradientStartPoints = [0.05, 0.5] as [NSNumber]
.
.
.
// Set heatmap options.
heatmapLayer = GMUHeatmapTileLayer()
heatmapLayer.radius = 100
heatmapLayer.opacity = 1.0
heatmapLayer.gradient = GMUGradient(colors: gradientColors,
                                  startPoints: gradientStartPoints,
                                  colorMapSize: 256)
heatmapLayer.maximumZoomIntensity = 17
heatmapLayer.minimumZoomIntensity = 10

after that add your lat lng list to weightData

// Add the latlngs to the heatmap layer.
heatmapLayer.weightedData = list

Simulator Screen Shot - iPhone 14 Pro - 2022-12-01 at 13 18 12 Simulator Screen Shot - iPhone 14 Pro - 2022-12-01 at 13 19 42

hanandika avatar Dec 01 '22 08:12 hanandika

Set the colorMapSize to 16000 @gurjnderSingh

Rob-Biemans avatar Jul 18 '23 12:07 Rob-Biemans