唐宋文学诗人分布展示
来源:互联网 发布:淘宝出售假冒商品退款 编辑:程序博客网 时间:2024/04/27 13:22
概述:
本文实现唐宋诗人分布数据的获取与webgis的展示。
效果:
获取的数据
概览
放大后
详细信息
实现:
1、数据获取
本文的数据是从搜韵获取而来的,地址为http://sou-yun.com/poetlife.html,为方便大家使用,将数据保存到了百度云盘,下载信息为:链接:http://pan.baidu.com/s/1b3fa4e 密码:xik1
2、实现
本示例实现代码如下:
$.get("../data/poets.json",function(result){ var markers = result.Traces[0]["Markers"]; console.log(markers); var features = []; for(var i=0,len=markers.length;i<len;i++){ var marker = markers[i]; var geom = new ol.geom.Point([marker.Longitude, marker.Latitude]); geom.transform('EPSG:4326', 'EPSG:3857'); var feature = new ol.Feature({ geometry: geom, detail: marker.Detail, title: marker.Title, uri:marker.RequestUri}); features.push(feature); } var vectorSource = new ol.source.Vector({ features: features});var vector = new ol.layer.Vector({source: vectorSource,style: function(feature, res){var title = feature.get("title"); return new ol.style.Style({ image: new ol.style.Icon({ anchor: [0, 0], src: "img/red.png" }), text: new ol.style.Text({text: title,offsetX:15,offsetY:30,textAlign:"center",fill: new ol.style.Fill({color: '#ffffff'}),stroke: new ol.style.Stroke({color: '#0000ff',width: 2})}) }) }});map.addLayer(vector);var select = new ol.interaction.Select({ condition: ol.events.condition.click }); map.addInteraction(select); var container = document.getElementById('popup'); var content = document.getElementById('popup-content'); var title = document.getElementById('popup-title'); var closer = document.getElementById('popup-closer'); closer.onclick = function(){ container.style.display = 'none'; closer.blur(); return false; }; var overlay = new ol.Overlay({ element: container }); map.addOverlay(overlay); select.on('select', function(e) { var feature = e.target.getFeatures().item(0); var coordinate = feature.getGeometry().getCoordinates(); overlay.setPosition(coordinate); //districtname,districtcode,latitude,longitude,name,address,picinfo $(content).html("").append(feature.get("detail")); container.style.display = 'block'; title.innerHTML = feature.get("title"); title.style.display = 'block'; map.getView().setCenter(coordinate); }); });
---------------------------------------------------------------------------------------------------------------
技术博客
CSDN:http://blog.csdn.NET/gisshixisheng
博客园:http://www.cnblogs.com/lzugis/
在线教程
http://edu.csdn.Net/course/detail/799
Github
https://github.com/lzugis/
联系方式
q q:1004740957
e-mail:niujp08@qq.com
公众号:lzugis15
Q Q 群:452117357(webgis)
337469080(Android)
阅读全文
1 0
- 唐宋文学诗人分布展示
- 文学青年、诗和诗人
- 分词统计(四)唐宋元诗人吟诗作词的时候,最偏爱哪些词语呢?(附上AI写的1000句诗!)
- 文学
- 文学
- 唐宋饮茶法
- 唐宋的两个女人
- 唐宋元明清
- 诗人2
- 诗人毛泽东
- 图雅砍文学
- 文学细胞
- 文学在线
- 文学少女
- 文学常识
- 房屋文学
- 苹果文学
- 盛大文学
- Bmob 导入android studio
- Windows下各种机器学习python库安装
- python : 新概念英语 课文转为html
- poj3450
- oralce的单行函数
- 唐宋文学诗人分布展示
- 學習編程爲什麽這麽難
- CF816A-Karen and Morning
- hibernate的工作原理
- CSDN——一个新的开始
- 网易邮箱被盗用记录
- struts2的工作原理
- 计算机常用通信指标和术语
- 机器学习python库sklearn安装