How to use Heat Map Renderer in Swift 5

166
1
2 weeks ago
mohdarshad
New Contributor

Hi,

I want to implement a heat map with AGSArcGISTiledLayer but I could not find any document. My mobile application displays multiple markers and marker has their counts. I want to use that count and create a heat map. It would be very helpful If anyone could share some samples or suggestions.

Thanks

Tags (3)
0 Kudos
1 Reply
Destiny_Hochhalter
Esri Contributor

Hello mohdarshad,

Thanks for your question. This question should likely be posted under the ArcGIS Runtime SDK for iOS Questions forum since it specifies use of AGSArcGISTiledLayer.

In regards to constructing a HeatMapRenderer, it can be constructed in the Swift SDK by creating a Web Map in the AGOL Map Viewer, where the renderer is accessible from the map's feature layer. Another option to construct a HeatMapRenderer is by using the "fromJSON(_:)" method with custom JSON which is covered in this api ref doc.

let renderer = try? HeatmapRenderer.fromJSON(
    """
    {
      "type": "heatmap",
      "blurRadius": 10,
      "colorStops": [
        { "ratio": 0, "color": [ 255, 255, 255, 0 ] },
        { "ratio": 0.1, "color": [ 255, 255, 0, 50 ] },
        { "ratio": 1, "color": [ 255, 0, 0, 200 ] }
      ],
      "field": null,
      "maxPixelIntensity": 100,
      "minPixelIntensity": 0
    }
    """
)

 

 

Please reach out with any further questions.

0 Kudos