当前位置:网站首页>Leaflet that supports canvas Path. Dashflow dynamic flow direction line
Leaflet that supports canvas Path. Dashflow dynamic flow direction line
2022-06-12 23:48:00 【GIS weapon warehouse】
Through to leaflet And its plug-in learning , We learned to use Leaflet.Path.DashFlow The plug-in can realize dynamic display of trajectory 、 Dynamic display of pipeline flow direction 、 Dynamic display of river flow , To enhance the visual display effect . The plug-in is very simple to use , Just add lines normally , Join in dashArray and dashSpeed Parameters can be . The core code is as follows :

Be careful , stay
dashSpeedWhen it is negative , The line is a positive flow .
The effect is as follows :

But in the process of using , There is a drawback to the plug-in , It's when you use Canvas How to map ( Initialize map preferCanvas Parameter is true) when , Dynamic effects are not available . How to solve this problem ?
Through to Leaflet.Path.DashFlow as well as leaflet Source code research , It is found that the effect of dynamic line is mainly through dynamic refresh dashOffset The value of the parameter , To change the style of a line .

L.SVG stay _updateStyle When , Updated dashOffset Parameters , however L.Canvas stay _updateStyle when , No updates dashOffset Parameters . This is in Canvas The reason why there is no dynamic effect when drawing with .
L.SVG:

L.Canvas:

thus , We found a solution , That is to say L.Canvas Of _updateStyle In the method , Reference resources L.SVG Treatment mode , Add pair dashOffset Parameter control . The core code is as follows :

For ease of use , We will L.Path.DashFlow Plug in repackaging , This plug-in is cited , Can be in Canvas and SVG Use this plug-in in in two ways .
summary
- Use
Leaflet.Path.DashFlowThe plug-in can realize dynamic display of trajectory 、 Dynamic display of pipeline flow direction, etc . - The default plug-in uses
CanvasHow to map ( Initialize mappreferCanvasParameter istrue) when , Dynamic effects are not available . - By modifying the
L.CanvasIn the code , Can be inCanvasMode to achieve dynamic line effect . - take
L.Path.DashFlowPlug in repackaging , Reference plug-ins , Can be inCanvasandSVGTwo ways to achieve dynamic line effect .
Online example
Original address :http://gisarmory.xyz/blog/index.html?blog=LeafletPathDashFlow.
Focus on 《GIS Zeughaus 》 official account , The first time to get more high quality GIS article .

This article adopts Creative Commons signature - Noncommercial use - Share in the same way 4.0 International licensing agreement Licensing . Welcome to reprint 、 Use 、 Re release , But be sure to keep the signature of the article 《GIS Zeughaus 》( Include links : http://gisarmory.xyz/blog/), Not for commercial purposes , Based on this revised work must be released with the same license .
边栏推荐
- How SAP ui5 uses manifest JSON file defines third-party library dependencies
- 【Matlab】矩阵操作
- 2202 resume making
- Preparing for the Blue Bridge Cup Day11__ Basic operation of serial port communication
- 2202 - production de CV
- Running of NCF dapr application instance
- Common message oriented middleware selection
- 〖Kubernetes指南④〗Pod快速入门
- M_8:设计消息队列存储消息数据的 MySQL 表格
- 支持Canvas的Leaflet.Path.DashFlow动态流向线
猜你喜欢

Comprehensive analysis of C array

CV—BaseLine总结(从AlexNet到SENet的发展历程)
![CS for mobile security [nethunter]](/img/25/ad99256a1eebb09f639e95d00756a5.jpg)
CS for mobile security [nethunter]

36 krypton's debut | "osogena" won nearly ten million angel rounds of financing. The original DLR scientists of German Aerospace Research and development system modeling and simulation CAE software PA

For product managers, which of the two certificates, PMP and NPDP, is more authoritative?

Examination questions and online simulation examination for safety management personnel of hazardous chemical business units in 2022

Leetcode 2200. Find all k nearest neighbor subscripts in the array (yes, one pass)

2022年危险化学品经营单位安全管理人员考试试题及在线模拟考试
![[opencv learning] small ticket recognition based on perspective transformation and OCR recognition](/img/47/08b9dd9dbea9e9cb6deda975f4d652.jpg)
[opencv learning] small ticket recognition based on perspective transformation and OCR recognition

leaflet如何加载10万条数据
随机推荐
36 krypton's debut | "osogena" won nearly ten million angel rounds of financing. The original DLR scientists of German Aerospace Research and development system modeling and simulation CAE software PA
Buuctf-[ciscn 2019 preliminary]love math
Start of u-boot S analysis (IV)
Software development tools [3] theoretical basis of software development tools
Introduction to business rules service on SAP Business Technology Platform (BTP)
Design MySQL table structure for message queue to store information data
It is meaningful to define genus, and D can use it to explain semantics
Redis实现短信验证码登录
移动安全必备之CS呢【NETHUNTER】
2022年危险化学品经营单位安全管理人员考试试题及在线模拟考试
leaflet中如何优雅的解决百度、高德地图的偏移问题
Automatically obtain the position offset of member variables inside the structure
Day 3 of jsbom and DOM learning
AWS lambda: how to store secrets to external APIs- AWS Lambda: How to store secret to external API?
Case sharing of online real queuing system reconfiguration -- practical part
Actual combat | UI automation test framework design and pageobject transformation
leaflet如何优雅的展示重叠点位的气泡窗口
2022年G3锅炉水处理考题模拟考试平台操作
Alien skin exposure X7 color filter plug-in, raw post-processing tool
Save state when viewpager is used with fragment fragmentpageradapter