openlayers 显示点击位置的经纬度
来源:互联网 发布:qq空间绑定独立域名 编辑:程序博客网 时间:2024/05/16 17:46
<!doctype html><html><head><meta charset="utf-8"><title>ol</title><link href="https://openlayers.org/en/v4.5.0/css/ol.css" rel="stylesheet"><script src="https://openlayers.org/en/v4.5.0/build/ol.js"></script><script src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script></head><body><div id="map" style="width: 100%"></div><script type="text/javascript"> var map = new ol.Map({ layers: [ new ol.layer.Tile({ source: new ol.source.OSM() }) ], target: 'map', view: new ol.View({ center: ol.proj.transform( [104, 30], 'EPSG:4326', 'EPSG:3857'), zoom: 10 }) }); // 监听singleclick事件 map.on('singleclick', function(e){alert(e.coordinate);alert(ol.proj.transform(e.coordinate, 'EPSG:3857', 'EPSG:4326')); // 通过getEventCoordinate方法获取地理位置,再转换为wgs84坐标,并弹出对话框显示alert(map.getEventCoordinate(e.originalEvent)); alert(ol.proj.transform(map.getEventCoordinate(e.originalEvent), 'EPSG:3857', 'EPSG:4326')); var lonlat = map.getCoordinateFromPixel(e.pixel);alert(lonlat); alert(ol.proj.transform(lonlat,"EPSG:3857", "EPSG:4326")); //由3857坐标系转为4326 })</script></body></html>
阅读全文
0 0
- openlayers 显示点击位置的经纬度
- 根据指定的经纬度显示地图位置
- 定位显示出经纬度和当前的位置名
- openlayers 的点击地图事件
- Android定位获取经纬度并显示位置
- 百度地图的经纬度位置
- 必应地图显示点击事件经纬度
- OpenLayers下将浮云框显示位置固定
- 百度地图---获取当前的位置返回的是汉字显示而不是经纬度
- flex4.7 在IE界面显示鼠标位置的经纬度坐标值
- Win8 获得点击控件的位置,显示上下文菜单
- wpf 对话框显示在鼠标点击的位置
- 控件显示之后,点击其他位置隐藏的实现
- 占位置的选项卡 + 点击哪个哪个显示颜色
- 点击百度地图上任意一点,显示该点的经纬度的信息窗
- 根据经纬度计算该位置点与附近某一经纬度位置点的位置偏移角
- 根据经纬度计算该位置点与附近某一经纬度位置点的位置偏移角
- 根据经纬度获取当地的位置
- 远程访问oracle数据库
- html复习小结
- TensorFlow实现基于深度学习的图像补全
- 动画的布局
- zabbix客户端
- openlayers 显示点击位置的经纬度
- 检查型异常与非检查型异常
- 第一份Makefile
- Tomcat服务器
- list排序(Collections.sort())
- 解决Windows安装解压版MySQL出现服务正在启动-服务无法启动的问题
- Android AES 16字节加解密
- Netty源码分析之番外篇【Java NIO的前生今世】
- 代理几种实现方式