做城市热力图的时候无意浏览到mapv强大的功能。比如地图上路线的汇聚效果,如下

 <!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title> <style type="text/css">
html, body { overflow: hidden;
} #map {
width: 500px;
height: 500px;
margin:0 auto;
}
</style>
</head>
<body> <div id="map"></div>
<canvas id="canvas"></canvas> <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=1XjLLEhZhQNUzd93EjU5nOGQ"></script>
<script type="text/javascript" src="../build/mapv.js"></script> <script type="text/javascript"> // 百度地图API功能
var map = new BMap.Map("map", {
enableMapClick: false
}); // 创建Map实例
map.centerAndZoom(new BMap.Point(108.154518,36.643346), 5); // 初始化地图,设置中心点坐标和地图级别
map.enableScrollWheelZoom(true); // 开启鼠标滚轮缩放 // 地图自定义样式
map.setMapStyle({
styleJson: [{
"featureType": "water",
"elementType": "all",
"stylers": {
"color": "#044161"
}
}, {
"featureType": "land",
"elementType": "all",
"stylers": {
"color": "#091934"
}
}, {
"featureType": "boundary",
"elementType": "geometry",
"stylers": {
"color": "#064f85"
}
}, {
"featureType": "railway",
"elementType": "all",
"stylers": {
"visibility": "off"
}
}, {
"featureType": "highway",
"elementType": "geometry",
"stylers": {
"color": "#004981"
}
}, {
"featureType": "highway",
"elementType": "geometry.fill",
"stylers": {
"color": "#005b96",
"lightness": 1
}
}, {
"featureType": "highway",
"elementType": "labels",
"stylers": {
"visibility": "on"
}
}, {
"featureType": "arterial",
"elementType": "geometry",
"stylers": {
"color": "#004981",
"lightness": -39
}
}, {
"featureType": "arterial",
"elementType": "geometry.fill",
"stylers": {
"color": "#00508b"
}
}, {
"featureType": "poi",
"elementType": "all",
"stylers": {
"visibility": "off"
}
}, {
"featureType": "green",
"elementType": "all",
"stylers": {
"color": "#056197",
"visibility": "off"
}
}, {
"featureType": "subway",
"elementType": "all",
"stylers": {
"visibility": "off"
}
}, {
"featureType": "manmade",
"elementType": "all",
"stylers": {
"visibility": "off"
}
}, {
"featureType": "local",
"elementType": "all",
"stylers": {
"visibility": "off"
}
}, {
"featureType": "arterial",
"elementType": "labels",
"stylers": {
"visibility": "off"
}
}, {
"featureType": "boundary",
"elementType": "geometry.fill",
"stylers": {
"color": "#029fd4"
}
}, {
"featureType": "building",
"elementType": "all",
"stylers": {
"color": "#1a5787"
}
}, {
"featureType": "label",
"elementType": "all",
"stylers": {
"visibility": "off"
}
}, {
"featureType": "poi",
"elementType": "labels.text.fill",
"stylers": {
"color": "#ffffff"
}
}, {
"featureType": "poi",
"elementType": "labels.text.stroke",
"stylers": {
"color": "#1e1c1c"
}
}, {
"featureType": "administrative",
"elementType": "labels",
"stylers": {
"visibility": "off"
}
},{
"featureType": "road",
"elementType": "labels",
"stylers": {
"visibility": "off"
}
}]
}); var randomCount = 500; var node_data = {
"0":{"x":108.154518, "y":36.643346},
"1":{"x":121.485124, "y":31.235317},
}; var edge_data = [
{"source":"1", "target":"0"}
] var citys = ["北京","天津","上海","重庆","石家庄","太原","呼和浩特","哈尔滨","长春","沈阳","济南","南京","合肥","杭州","南昌","福州","郑州","武汉","长沙","广州","南宁","西安","银川","兰州","西宁","乌鲁木齐","成都","贵阳","昆明","拉萨","海口"]; // 构造数据
for (var i = 1; i < randomCount; i++) {
var cityCenter = mapv.utilCityCenter.getCenterByCityName(citys[parseInt(Math.random() * citys.length)]);
node_data[i] = {
x: cityCenter.lng - 5 + Math.random() * 10,
y: cityCenter.lat - 5 + Math.random() * 10,
}
edge_data.push(
{"source": ~~(i * Math.random()), "target": '0'}
);
} var fbundling = mapv.utilForceEdgeBundling()
.nodes(node_data)
.edges(edge_data); var results = fbundling(); var data = [];
var timeData = []; for (var i = 0; i < results.length; i++) {
var line = results[i];
var coordinates = [];
for (var j = 0; j < line.length; j++) {
coordinates.push([line[j].x, line[j].y]);
timeData.push({
geometry: {
type: 'Point',
coordinates: [line[j].x, line[j].y]
},
count: 1,
time: j
});
}
data.push({
geometry: {
type: 'LineString',
coordinates: coordinates
}
});
} var dataSet = new mapv.DataSet(data); var options = {
strokeStyle: 'rgba(55, 50, 250, 0.3)',
globalCompositeOperation: 'lighter',
shadowColor: 'rgba(55, 50, 250, 0.5)',
shadowBlur: 10,
methods: {
click: function (item) {
}
},
lineWidth: 1.0,
draw: 'simple'
} var mapvLayer = new mapv.baiduMapLayer(map, dataSet, options); var dataSet = new mapv.DataSet(timeData); var options = {
fillStyle: 'rgba(255, 250, 250, 0.9)',
globalCompositeOperation: 'lighter',
size: 1.5,
animation: {
type: 'time',
steps: 100,
trails: 1,
duration: 5
},
draw: 'simple'
} var mapvLayer = new mapv.baiduMapLayer(map, dataSet, options); </script> </body>
</html>

 <!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title> <style type="text/css">
html, body {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
overflow: hidden;
} #map {
width: 500px;
height: 500px;
margin: 0 auto;
}
</style>
</head>
<body> <div id="map"></div>
<canvas id="canvas"></canvas> <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=1XjLLEhZhQNUzd93EjU5nOGQ"></script>
<script type="text/javascript" src="../build/mapv.js"></script> <script type="text/javascript"> // 百度地图API功能
var map = new BMap.Map("map", {
enableMapClick: false
}); // 创建Map实例
map.centerAndZoom(new BMap.Point(105.403119, 38.028658), 6); // 初始化地图,设置中心点坐标和地图级别
map.enableScrollWheelZoom(true); // 开启鼠标滚轮缩放 map.setMapStyle({
style: 'midnight'
}); var randomCount = 1000; var data = []; var citys = ["北京","天津","上海","重庆","石家庄","太原","呼和浩特","哈尔滨","长春","沈阳","济南","南京","合肥","杭州","南昌","福州","郑州","武汉","长沙","广州","南宁","西安","银川","兰州","西宁","乌鲁木齐","成都","贵阳","昆明","拉萨","海口"]; // 构造数据
while (randomCount--) {
var cityCenter = mapv.utilCityCenter.getCenterByCityName(citys[parseInt(Math.random() * citys.length)]);
data.push({
geometry: {
type: 'Point',
coordinates: [cityCenter.lng - 2 + Math.random() * 4, cityCenter.lat - 2 + Math.random() * 4]
},
count: 30 * Math.random(),
time: 100 * Math.random()
});
} var dataSet = new mapv.DataSet(data); var options = {
size: 13,
gradient: { 0.25: "rgb(0,0,255)", 0.55: "rgb(0,255,0)", 0.85: "yellow", 1.0: "rgb(255,0,0)"},
max: 60,
animation: {
type: 'time',
stepsRange: {
start: 0,
end: 100
},
steps: 100,
trails: 10,
duration: 5,
},
draw: 'heatmap'
} var mapvLayer = new mapv.baiduMapLayer(map, dataSet, options);
</script> </body>
</html>

 <!DOCTYPE html>
<html> <head>
<meta charset="UTF-8">
<title></title> <style type="text/css">
#canvas {
border: 5px dotted red;
width: 800px;
height: 800px;
}
</style>
</head> <body> <div id="canvas"></div>
<!-- data -->
<script type="text/javascript" src="data/3d-simple.js"></script>
<!-- library -->
<script type="text/javascript" src="js/three.min.js"></script>
<script type="text/javascript" src="js/OrbitControls.js"></script>
<script type="text/javascript" src="../build/mapv.js"></script>
<script type="text/javascript">
var canvas = document.querySelector('#canvas');
var map = new mapv.x(canvas, {
center: {
lng: 105.403119,
lat: 38.028658
},
grid: {
size: 1,
}
});
</script> </body> </html>

酷酷的mapv的更多相关文章

  1. csuoj 1505: 酷酷的单词

    http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1505 1505: 酷酷的单词 时间限制: 1 Sec  内存限制: 128 MB 提交: 340  ...

  2. CSU 1505 酷酷的单词 湖南省赛第十届题目

    题目链接:http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1505 题意:技巧题,就是一行字符串中,每个字母出现的次数互不相同,复即为酷的单词. 解题 ...

  3. CSU 1505: 酷酷的单词【字符串】

    Description 输入一些仅由小写字母组成的单词.你的任务是统计有多少个单词是“酷”的,即每种字母出现的次数都不同.比如ada是酷的,因为a出现2次,d出现1次,而1和2不同.再比如,banan ...

  4. 酷酷的CSS3三角形运用

    概述 在早期的前端Web设计开发年代,完成一些页面元素时,我们必须要有专业的PS美工爸爸,由PS美工爸爸来切图,做一些圆角.阴影.锯齿或者一些小图标. 在CSS3出现后,借助一些具有魔力的CSS3属性 ...

  5. 酷酷的jQuery classicAccordion 手风琴

    在线实例 效果一 效果二 效果三 使用方法 手风琴ul li列表 <ul class="accordion">      <li>          < ...

  6. 【转载】酷酷的CSS3三角形运用

    转载:http://www.cnblogs.com/keepfool/p/5616326.html 概述 在早期的前端Web设计开发年代,完成一些页面元素时,我们必须要有专业的PS美工爸爸,由PS美工 ...

  7. [ios]ipad下的splitViewController 让你的APP看起来酷酷的!

    在ipad下可以使用splitViewController splitViewController下包含两个viewController 这是一种将屏幕一分为二的方式. 在水平状态下会出现成两个左右两 ...

  8. 玩转html5(一)-----盘点html5新增的那些酷酷的input类型和属性

    今天正式开始学习html5了,相比html以前的版本,html5新增了好多功能,属性,使我们做出来的界面更加的绚丽,而且使用起来超级简单,这篇文章先来说说html增加的那些input类型和属性. 这些 ...

  9. [others] 一个酷酷的站

    https://xkcd.com/ https://xkcd.com/1080/

随机推荐

  1. 响应式图片菜单式轮播,兼容手机,平板,PC

    昨天在给自己用bootstrap写一个响应式主业模版时想用一个图片轮播js,看到了bootstrap里面的unslider.js,只有1.7k,很小,很兴奋,但使用到最后发现不兼容手机,当分辨率变化的 ...

  2. [Ant]Ant简易教程

    前言 Apache Ant,是一个将软件编译.测试.部署等步骤联系在一起加以自动化的一个工具,大多用于Java环境中的软件开发.由Apache软件基金会所提供. Ant是纯Java语言编写的,所以具有 ...

  3. RFC4035笔记

    章 节 标题 说明 补充说明 支持级别 1 介绍 1.定义DNSSEC协议修改点2.定义以下概念:已签名域(signed zone)和域签名的要求列表3.描述权威域名服务器为了处理签名域的行为变化4. ...

  4. MyCat源码分析系列之——结果合并

    更多MyCat源码分析,请戳MyCat源码分析系列 结果合并 在SQL下发流程和前后端验证流程中介绍过,通过用户验证的后端连接绑定的NIOHandler是MySQLConnectionHandler实 ...

  5. Windows 10 安装 Sql Server 2014 反复提示需要安装 .NET Framework 3.5 SP1 的解决方案

    一.首先安装.NET Framework 3.5: 离线安装方式: 1.装载相对应的系统安装盘,我是Windows 10 x64 企业版,所以装载Windows 10 x64 企业版安装镜像ISO,盘 ...

  6. 基于CkEditor实现.net在线开发之路(7)列表页面开发动作介绍

    一个列表页面不止是查询,它也包含了很多业务上功能的实现,这些业务功能的实现的逻辑我称之为动作.如触发单击按钮删除数据,更改业务表数据,调用webService,调用WCF接口,弹出新窗体新增.修改.查 ...

  7. python 数据类型---列表使用 之一

    列表的表现形式:其中的元素可以使任何数据类型,像 字符串,数字, 字典, 列表,变量 等任何类型 age = 28 name = ["Frank", "Lee" ...

  8. JDBC 制作简单的登录验证

    两种方法: 一.直接拼接到SQL语句 public static void main(String[] args) throws Exception{ //输入账号密码 Scanner sc = ne ...

  9. Redis(li)

    一.Redis基础介绍 redis是一个key-value存储系统.和Memcached类似,它支持存储的value类型相对更多,包括string(字符串).list(链表).set(集合).zset ...

  10. IntelliJ IDEA使用(一):创建maven web项目

    在公司用eclipse开发maven web项目后,慢慢开始明白大家的那句话"受不了eclipse".的确,在开发大型的web项目,尤其是maven构建的项目,eclipse很不友 ...