openlayers 点线面
vue页面 Demo2
<template><div id="map" class="map"><form class="form-inline"><label for="type">Geometry type </label><select id="type"><option value="Point">Point</option><option value="LineString">LineString</option><option value="Polygon">Polygon</option><option value="Circle">Circle</option></select></form></div>
</template>
<script>
import 'ol/ol.css';
import Map from 'ol/Map';
import View from 'ol/View';
import {Circle as CircleStyle, Fill, Stroke, Style} from 'ol/style';
import {Draw, Modify, Snap} from 'ol/interaction';
import {OSM, Vector as VectorSource} from 'ol/source';
import {Tile as TileLayer, Vector as VectorLayer} from 'ol/layer';
export default {mounted() {var raster = new TileLayer({source: new OSM(),});var source = new VectorSource();var vector = new VectorLayer({source: source,style: new Style({fill: new Fill({color: 'rgba(255, 255, 255, 0.2)',}),stroke: new Stroke({color: '#ffcc33',width: 2,}),image: new CircleStyle({radius: 7,fill: new Fill({color: '#ffcc33',}),}),}),});//底图var map = new Map({layers: [raster, vector],target: 'map',view: new View({// projection: "EPSG:4326" , //使用这个坐标系center: [116.401969,39.91737],zoom: 8,extent: [87251.34, 821101.96, 916327.09, 6636950.72],}),});var modify = new Modify({source: source});map.addInteraction(modify);var draw, snap; // global so we can remove them latervar typeSelect = document.getElementById('type');function addInteractions() {draw = new Draw({source: source,type: typeSelect.value,});map.addInteraction(draw);snap = new Snap({source: source});map.addInteraction(snap);}/*** Handle change event.*/typeSelect.onchange = function () {map.removeInteraction(draw);map.removeInteraction(snap);addInteractions();};addInteractions();},setup() {},}
</script><style>.map {width: 100vw;height:100vh;}</style>
路由 index
import Vue from 'vue'
import Router from 'vue-router'
import HelloWorld from '@/components/HelloWorld'
import Demo1 from '@/Demo1/index'
import Demo2 from '@/Demo2/index' //跳转页面
Vue.use(Router)export default new Router({routes: [{path: '/',name: 'HelloWorld',component: HelloWorld},{path: '/demo1',name: 'demo1',component: Demo1 //页面输入这个地址},{path: '/demo2',name: 'demo2',component: Demo2 //页面输入这个地址},// {// path: '/demo5',// name: 'demo5',// component: Demo5// }]
})
openlayers 点线面相关推荐
- openlayers绘制自定义点线面样式,带清除功能Vue版
openlayers绘制自定义点线面样式,带清除功能 初学openlayers 有不足之处还望轻喷,多谢 项目用的是vue,elementUI,以及scss 啊-本来点线面都录制了一个gif图,因为某 ...
- OpenLayers学习笔记高级篇(一、openlayers画点线面)
话不多说直接上代码: <!doctype html> <html xmlns=http://www.w3.org/1999/xhtml> <head> <me ...
- openlayers入门添加百度地图绘制点线面
1.构建一个地图容器 <div id="map" class="map"></div> 2.创建一个地图 2.1初始化一个openlay ...
- Openlayers 添加 WKT WKB GeoJson 格式点线面数据
Openlayers 添加 WKT WKB GeoJson 格式点线面数据 OpenLayers 教程 Openlayers 添加 WKT WKB GeoJson 格式点线面数据 在线示例 OpenL ...
- OpenLayers 在Vue中画点线面
VUE代码如下 <template><div id="map" ref="rootmap"><div style="po ...
- OpenLayers实现交互绘制点线面
实现OpenLayers交互绘制 这快内容是临时添加进来的,算是提前写完这篇博文,可能存在问题,请大家批评指正,谢谢! 这一部分主要是讲解利用按钮在OpenLayers上进行交互绘制的一个实现过程,代 ...
- html点线面制作,openlayers 添加点线面 Demo(可直接运行)
Document 几何图形类型: 无 点 线 多边形 圆 正方形 var map = new ol.Map({ target: 'map', layers: [ new ol.layer.Tile({ ...
- 开源GIS(九)——openlayers中简单要素的添加与geojson数据修改添加
目录 一.引言 二.简单要素点线面的添加 1.创建feature 2.创建style,添加source.style到layer 3.添加layer到map 三.WFS获取geojson数据并修改 四. ...
- Openlayers 图形要素 Feature 移动和编辑
Openlayers 图形要素 Feature 移动和编辑 OpenLayers 教程 Openlayers 图形要素 Feature 移动和编辑 在线示例 OpenLayers 教程 Openlay ...
最新文章
- 1.5 字符串大小写转换(toLowerCase()和toUpperCase())
- drf实现常用数据缓存
- 基于react开发package.json的配置
- Ubuntu安装之python开发
- ubuntu下修改时区和时间
- php引入odbc模块,php如何用odbc调用存储过程?
- python类介绍_Python基础介绍 | Class类
- TCPIP header
- python文件都是脚本吗_脚本语言系列之Python | Python文件IO
- 开启MyBatis(三)工作原理
- 如何解决Mac苹果上运行VMware Fusion虚拟机提示“未找到文件”
- IntelliJ IDEA之Java开发常规项目配置介绍
- JavaMail API详解
- dimm和udimm_服务器内存UDIMM与RDIMM区别
- SOSO移动服务大厅项目分析
- [投资笔记]2016-11-25日
- 七日杀服务器直连教程,七日杀连接服务器延迟几万 | 手游网游页游攻略大全
- PPT制作(文字排版)
- noip c语言算法教学视频,信息学奥赛课课通(C++)课程视频课程课件与代码
- 自动化运维神器——Ansible
热门文章
- php mysql 设置字符_php mysql字符集设置方法
- mysql报错1200_关于MYSQL配置replicate出现1200错误_MySQL
- vue 子组件给父组件传值
- ospf 指定dr_OSPF的基本配置及DR /BDR选举的实验
- php设计模式-责任链模式
- MongoDB使用过程中的报错处理(持续更新)
- linux配置https站点
- mvc:annotation-driven /注解意义(转)
- OpenCV实现基于图像内容检索--视频播放(上)
- sql 2005中全文索引的使用