current position:Home>Vue openlayer add wind farm effect
Vue openlayer add wind farm effect
2022-04-29 05:21:18【Haocheng】
vue openlayer Add wind farm effect
A simple little demo, It's in one openlayers Add wind farm effect to the map .
Don't talk much , Go straight to the point .
First, we need to install a plug-in .
Plug-in address :https://www.npmjs.com/package/ol-wind
npm install ol-windy --save
Then we need a data to plot the wind field , Finally, upload the file .
It's very simple , This is the code below .
<template>
<div class="home">
<div id="map" ref="map"></div>
</div>
</template>
<script>
import 'ol/ol.css';
import Draw from 'ol/interaction/Draw';
import Map from 'ol/Map';
import Overlay from 'ol/Overlay';
import View from 'ol/View';
import {
Circle as CircleStyle, Fill, Stroke, Style } from 'ol/style';
import {
LineString, Polygon } from 'ol/geom';
import {
OSM, Vector as VectorSource } from 'ol/source';
import {
Tile as TileLayer, Vector as VectorLayer } from 'ol/layer';
import {
getArea, getLength } from 'ol/sphere';
import {
unByKey } from 'ol/Observable';
import {
WindLayer } from 'ol-wind'
import gfs from './gfs.json'
var map = null
export default {
name: "Home",
data() {
return {
}
},
mounted() {
this.initMap()
},
methods: {
// Initialize map
initMap() {
map = new Map({
layers: [
new TileLayer({
source: new OSM(),
}),
],
target: 'map',
view: new View({
center: [120, 35],
zoom: 5,
maxZoom: 18,
projection: 'EPSG:4326',
}),
});
this.addWindyLayer()
},
// Add wind particles
addWindyLayer() {
const windLayer = new WindLayer(gfs, {
foceRender: false,
windOptions: {
globalAlpha: 0.9, // Particle transparency
maxAge: 10, // Maximum surviving frames
velocityScale: 1/100, // Particle velocity
frameRate: 20, // Every time 50 Draw once
paths: 5000, // Number of particles
colorScale: () => {
return "#00b3ef"
},
width: 3,
}
})
map.addLayer(windLayer)
},
},
};
</script>
<style scoped>
.home {
width: 100%;
height: 100%;
background-color: aliceblue;
position: relative;
}
#map {
height: 100%;
width: 100%;
}
</style>
among gfs The file is the wind farm data .
gfs File download 【 Click here 】
Then look at the effect ~
copyright notice
author[Haocheng],Please bring the original link to reprint, thank you.
https://en.qdmana.com/2022/116/202204261119424872.html
The sidebar is recommended
- Rich text editor: ckeditor (using ckeditor4 Vue)
- The get request of nginx agent only returns part of the data. The problem is solved
- JavaScript traverses the irregularly nested multi-layer objects, returns the map with "index", and realizes the rapid positioning of sub attributes
- HTTP keep alive details
- [technical update] http / 3 quic Foundation
- Vue to react ----- can the constructor be omitted when using ES6?
- Use of nested HTML
- Vue to react to realize slot function
- When to use react PureComponent
- React 16.6 memo()
guess what you like
Deep understanding of children https://segmentfault.com/a/1190000011527160
This paper solves the cross domain problem Vue + springboot caused by the separation of front and back ends
The difference between shallow copy and deep copy is to use native JavaScript to realize deep copy
Definition of Vue slot
Sorting algorithm in JavaScript
JavaScript implements search algorithm, sequential search and binary search
leetcode20. Valid parentheses, implemented using JavaScript
'interface' declarations can only be used in typescript files in Vue 3.0 + ts resolvent
496 next element larger JavaScript implementation leetcode
leetcode 682. Implementation of JavaScript in baseball game
Random recommended
- Source code analysis, Vue What happens when using (), take initializing vuex as an example
- JavaScript optional chain
- Source code analysis, Vue global API set, del, nexttick, use, mixin, etc
- Brief introduction of Vue source code directory design
- Docxtemplator + Vue + docxtemplator image module free realize the front-end Word Download Text and free image download
- vue 2. What happens when x source code analyzes new vue()
- Vue bidirectional binding principle
- Use and principle of Vue keepalive
- Properties and usage of vuex
- Communication mode between Vue components
- Front end interview Foundation
- Usage scenario and principle of Vue nexttick
- Configuration and use of rich text editor ckeditor4 in Vue
- How does Java randomly get elements from a list
- Study summary of pytext: a search path from NLP research to production
- html+css+JavaScript
- Tunnel http://bt3xna.natappfree.cc Invalid cannot connect to 172.0.0.1:8080 The web service powered by natapp. Is not available on this port cn
- Next JS using react quill
- Vue Gaode map can only have one start point and end point. How to realize it
- Divide and conquer strategy -- find the k-th smallest element in the array
- Singleton mode - front end design mode
- QT sets that child elements do not inherit the parent style
- Using react to realize comment function
- Front end Vue template
- Front end vuejs set sail
- Front end Vue data binding and MVVM
- Vue data proxy and hijacking in front end
- Vue style of front end
- Front end Vue event handling
- Principle of Vue monitoring data change in front end
- Vue calculation attribute and monitoring attribute of the front end
- Front end Vue conditional rendering and list rendering
- The front-end Vue collects form data
- Vue built-in instruction of front end
- Unknown HttpClient factory netty at org. openqa. selenium. remote...
- What is the gutter principle of Ant Design Vue a-row
- Element form account password
- CSS to add horizontal lines around the text
- Solution to vscode Vue project always reporting space or semicolon warning
- Calling setcookie in Ajax fails without any error in the IDE