{"id":21716709,"url":"https://github.com/postor/cesiumjs-heat","last_synced_at":"2025-04-12T20:13:03.435Z","repository":{"id":57196225,"uuid":"183579804","full_name":"postor/cesiumjs-heat","owner":"postor","description":"heatmap for cesium | cesium的热力图","archived":false,"fork":false,"pushed_at":"2024-03-29T09:20:51.000Z","size":2529,"stargazers_count":61,"open_issues_count":5,"forks_count":14,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-12T20:12:58.498Z","etag":null,"topics":["cesiumjs","heatmap"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/cesiumjs-heat","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/postor.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-04-26T07:27:05.000Z","updated_at":"2025-01-06T09:31:11.000Z","dependencies_parsed_at":"2023-09-27T09:55:20.215Z","dependency_job_id":"a1df7306-1f7b-47af-a132-c788c63b51de","html_url":"https://github.com/postor/cesiumjs-heat","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/postor%2Fcesiumjs-heat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/postor%2Fcesiumjs-heat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/postor%2Fcesiumjs-heat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/postor%2Fcesiumjs-heat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/postor","download_url":"https://codeload.github.com/postor/cesiumjs-heat/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248625505,"owners_count":21135513,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cesiumjs","heatmap"],"created_at":"2024-11-26T01:12:51.304Z","updated_at":"2025-04-12T20:13:03.414Z","avatar_url":"https://github.com/postor.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cesium-heat\n\nheatmap for cesium | cesium的热力图\n\n![screenshot](./screenshot.gif)\n\nquick glance https://www.youtube.com/watch?v=m4_9aNZcv90\u0026list=PLM1v95K5B1ntVsYvNJIxgRPppngrO_X4s\n\n## usage\n\ninstall\n\n```\nnpm i cesiumjs-heat --save\n```\n\ncode\n\n```\nimport * as Cesium from 'cesium'\nimport data from './data/last-all-airbox'\nimport getCesiumHeat from 'cesiumjs-heat'\n\n// handle Cesium import on your own | 剔除了Cesium的依赖，因为在npm依赖了也不能直接使用，因为amd标准需要配置webpac \nconst CesiumHeat = getCesiumHeat(Cesium)\nconst viewer = new Cesium.Viewer('container')\n\n// auto add after construct | 构造后自动添加到cesium图层\nlet heat = new CesiumHeat(\n  viewer, \n  // data list, each has x, y, and value | 数据数组，每个包含 x,y,value字段\n  data.feeds.map(({ gps_lon, gps_lat, s_d0 }) =\u003e {\n    return {\n      x: gps_lon,\n      y: gps_lat,\n      value: s_d0,\n    }\n  }),\n  // bbox for heatmap | 只在范围内显示热力图拉近会清晰些，默认整个地球但拉近后巨模糊\n  [120.106188593, 21.9705713974, 121.951243931, 25.2954588893]\n)\n\n// destory | 销毁\nsetTimeout(()=\u003eheat.destory(),10*1000)\n\n```\n\n## params\n\n```\nlet heat = new CesiumHeat(\n  // cesium viewer\n  viewer, \n\n  // data list, each has x, y, and value | 数据数组，每个包含 x,y,value字段\n  {\n    autoMaxMin: true,       // 自动计算最大值和最小值\n    min: 0,                 // 指定最小值，autoMaxMin时无效，非autoMaxMin时必填\n    max: 100,               // 指定最大值，autoMaxMin时无效，非autoMaxMin时必填\n    data: [                 // 数据数组，默认空数组\n      {\n        x: 120.106188593,   // 经度坐标（-180~180）\n        y: 21.9705713974,   // 纬度坐标 （-90~90）\n        value: 10,          // 值\n      }\n    ]\n  },\n\n  // bbox for heatmap | 只在范围内显示热力图拉近会清晰些，不填默认整个地球但拉近后巨模糊\n  [120.106188593, 21.9705713974, 121.951243931, 25.2954588893],\n\n  // heatmap.js construction | heatmap.js的构造配置，不填默认如下，参考 https://www.patrick-wied.at/static/heatmapjs/docs.html\n  {},\n\n  // auto radius change with height | 自动按高度控制热点的辐射，默认值如下\n  {\n    enabled: true,  // 是否开启，关闭的话不会自动更新\n    min: 6375000,   // 最低高度，对应高度的辐射为minRadius\n    max: 10000000,  // 最大高度，对应高度的辐射为maxRadius\n    maxRadius: 20 * 2,\n    minRadius: 5 * 2,\n  },\n\n  // auto resize canvas | 自动按bbox形状控制canvas形状，默认值如下，canvas面积越大越清晰，也越卡\n  {  \n    autoResize: true,   // 是否自动调整canvas\n    totalArea: 360 * 2 * 720 * 2,  // 总面积，如果自动，必填，如果不自动，无效\n    width: 720 * 2, // canvas宽度，如果不自动，必填，如果自动，无效\n    height: 360 * 2, // canvas高度，如果不自动，必填，如果自动，无效\n  }\n)\n\n// 动态增加数据（多个）\nheat.addData([           // 数据数组\n  {\n    x: 120.106188593,   // 经度坐标（-180~180）\n    y: 21.9705713974,   // 纬度坐标 （-90~90）\n    value: 10,          // 值\n  }\n])\n\n// 动态增加数据（单个）\nheat.addData({\n  x: 120.106188593,   // 经度坐标（-180~180）\n  y: 21.9705713974,   // 纬度坐标 （-90~90）\n  value: 10,          // 值\n})\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpostor%2Fcesiumjs-heat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpostor%2Fcesiumjs-heat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpostor%2Fcesiumjs-heat/lists"}