Use the Heatmap plugin in an ArcGIS for JS API environment.
Because the latest heatmap does not provide for ARCGISJSAPI plug-ins, too lazy to study the new version of the code, so here is the old version of the heatmap.
However, the old version of the plugin has a problem, that is, when the point aggregation calculation is grouped according to the original coordinate points, which causes when the coordinate value of the precision is very high, all the points will be separate as a group, no matter how close the two points. The end result is that each point on the map will be the highest value, and the map looks like this.
The workaround is to intervene in the Parseheatmapdata method to group the screen coordinates instead of the more precise latitude and longitude (if you want a larger tolerance, you can also round the screen coordinates and increase the tolerance by 10 times times).
Modified Parseheatmapdata method
Parseheatmapdata:function(datapoints) {//variables varI, Parseddata, datapoint; //if data points exist if(datapoints) {//Create parsed data objectParseddata ={max:0, data: []}; if(! This. Config.uselocalmaximum) {Parseddata.max= This. GlobalMax; } //For each data point for(i = 0; i < datapoints.length; i++) { //Create Geometry PointVdatapoint =Esri.geometry.Point (datapoints[i].geometry); Datapoint= Esri.geometry.toScreenGeometry ( This. _map.extent, This. _map.width, This. _map.height, Vdatapoint); //Datapoint //If array value is undefined if(!Parseddata.data[datapoint.x]) { //Create empty array valueParseddata.data[datapoint.x] = []; } //array value array is undefined if(!Parseddata.data[datapoint.x][datapoint.y]) { //create object in arrayPARSEDDATA.DATA[DATAPOINT.X][DATAPOINT.Y] = {}; //if count is defined in Datapoint if(Datapoint.hasownproperty (' count ')) { //Create array value with Count of Count set in DatapointParseddata.data[datapoint.x][datapoint.y].count =Datapoint.count; } Else { //Create array value with Count of 0Parseddata.data[datapoint.x][datapoint.y].count = 0; } } //Add 1 to the CountParseddata.data[datapoint.x][datapoint.y].count + = 1; //Store datapoint varParseddata.data[datapoint.x][datapoint.y].datapoint =Vdatapoint; //if Count is greater than current Max if(Parseddata.max <Parseddata.data[datapoint.x][datapoint.y].count) { //set Max to this countParseddata.max =Parseddata.data[datapoint.x][datapoint.y].count; if(! This. Config.uselocalmaximum) { This. GlobalMax =Parseddata.data[datapoint.x][datapoint.y].count; } } } //convert parsed data into HEATMAP plugin formatted data This. Convertheatmapdata (Parseddata); } },
The modified effect:
Heatmap for Arcgisjsapi