1,使用FeatureLayer創(chuàng)建熱力圖
目前 HeatmapRenderer 還不支持在SceneViews中使用,只能在二維點(diǎn)圖層中使用
//熱力圖渲染
let heatmap_style = {
type: "heatmap",
colorStops: [
{ color: "rgba(63, 40, 102, 0)", ratio: 0 },
{ color: "#472b77", ratio: 0.083 },
{ color: "#4e2d87", ratio: 0.166 },
{ color: "#563098", ratio: 0.249 },
{ color: "#5d32a8", ratio: 0.332 },
{ color: "#6735be", ratio: 0.415 },
{ color: "#7139d4", ratio: 0.498 },
{ color: "#7b3ce9", ratio: 0.581 },
{ color: "#853fff", ratio: 0.664 },
{ color: "#a46fbf", ratio: 0.747 },
{ color: "#c29f80", ratio: 0.83 },
{ color: "#e0cf40", ratio: 0.913 },
{ color: "#ffff00", ratio: 1 }
],
maxPixelIntensity: 25,
minPixelIntensity: 0
};
let artificialPatrol_ly = new FeatureLayer({
title: "artificialPatrol_ly",
fields: [
{
name: "ObjectID",
alias: "ObjectID",
type: "oid",
},
{
name: "id",
alias: "id",
type: "string",
},
{
name: "fileName",
alias: "fileName",
type: "string",
}
],
objectIdField: "ObjectID",
geometryType: "point",
outFields: ["*"],
spatialReference: this.m_spatialReference,
source: [],
renderer: heatmap_style
});
this.map.add(artificialPatrol_ly);
利用開源heatmap結(jié)合arcgis api for js實(shí)現(xiàn)
自定義HeatmapLayer類蒿褂,繼承DynamicMapServiceLayer琐凭,然后結(jié)合heatmap.js一起
這個(gè)之前在3.X中用過呜投。4.X中沒這么使用過