GithubHelp home page GithubHelp logo

maksimhan / cesium-heatmap-es6 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cesium-plugin/cesium-heatmap-es6

0.0 0.0 0.0 5.72 MB

热度图插件

Shell 0.01% JavaScript 9.53% CSS 25.11% HTML 57.43% Less 0.17% TypeScript 7.76%

cesium-heatmap-es6's Introduction

参考源码

1.《117颗星 manuelnas/CesiumHeatmap》 基于heatmap.min.js,通过绘制Entity(矩形)实体实现,364行代码,有三维效果 2. 《32颗星 postor/cesiumjs-heat 》 基于heatmap.min.js,使用SingleTileImageryProvider图层实现,根据镜头移动具有重绘功能,239行代码,无三维效果 3. 《16颗星 wangzhongliang/CesiumHeatmap》 使用Primitive图元实现,提供了两种方式,优点在于计算范围的方法。 方式一基于heatmap.min.js,157行代码,无三维效果; 方式二基于webgl-heatmap.js,128行代码,无三维效果;

特点

  1. 提供三种绘制方式,实体(可贴模型,有三维效果)、图元、图层
  2. 提供重绘,通过摄像头的高度进行重绘
  3. 提供heatmap.js的所有配置参数入口
  4. 源码ts编写,发布支持es6和umd两种模式
  5. 支持npm安装

效果图

效果图

在这里插入图片描述 在这里插入图片描述

插件使用方法

安装

npm install cesium-heatmap-es6

文档

自行打开docs文件夹

umd模式

<script type="text/javascript" src="./CesiumHeatmap/dist/cesium-heatmap-es6.umd.js"></script>
 const defaultDataValue = [10, 500]
        const defaultOpacityValue = [0, 1]
  const points = []
        fetch("/datas/geojson/busstop2016.geojson", {
            method: 'GET',
            headers: {
                'Content-Type': 'application/json'
            },
        }).then((response) => {
            response.json().then((data) => {
                if (data)
                    data.features.forEach(function (feature) {
                        const lon = feature.geometry.coordinates[0]
                        const lat = feature.geometry.coordinates[1]
                        points.push({
                            x: lon,
                            y: lat,
                            value: 100 * Math.random()
                        })
                    })
                const earthHeatMap = new CesiumHeatmap(viewer,
                    {
                        zoomToLayer: true,
                        points,
                        heatmapDataOptions: { max: defaultDataValue[1], min: defaultDataValue[0] },
                        heatmapOptions: {
                            maxOpacity: defaultOpacityValue[1],
                            minOpacity: defaultOpacityValue[0]
                        }
                    }
                )
            })
        })

es6模式

 const defaultDataValue = [10, 500]
        const defaultOpacityValue = [0, 1]
import { CesiumHeatmap, HeatmapPoint } from "cesium-heatmap-es6"

 const points: HeatmapPoint[] = []
        fetch("/datas/geojson/busstop2016.geojson", {
            method: 'GET',
            headers: {
                'Content-Type': 'application/json'
            },
        }).then((response) => {
            response.json().then((data) => {
                if (data)
                    data.features.forEach(function (feature) {
                        const lon = feature.geometry.coordinates[0]
                        const lat = feature.geometry.coordinates[1]
                        points.push({
                            x: lon - 0.05,
                            y: lat - 0.04,
                            value: 100 * Math.random()
                        })
                    })
                cesiumHeatmap = new CesiumHeatmap(viewer,
                    {
                        zoomToLayer: true,
                        points,
                        heatmapDataOptions: { max: defaultDataValue[1], min: defaultDataValue[0] },
                        heatmapOptions: {
                            maxOpacity: defaultOpacityValue[1],
                            minOpacity: defaultOpacityValue[0]
                        }
                    }
                )
            })
        })

源码使用方法

依赖安装

npm run a

项目运行

npm start

项目打包

npm run build

发布

npm run release

cesium-heatmap-es6's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.