Code Monkey home page Code Monkey logo

leaflet-velocity-ts's Introduction

leaflet-velocity-ts NPM version

This is a typescript updated version of leaflet-velocity

Compared to the other version :

  • This version is compatible with the latest version of leaflet.
  • This version adds a better particles management when zooming and moving the map which gives better performance on mobile devices.
  • This version does not need leaflet-velocity.css to be included.

Example use:

const velocityLayer = L.velocityLayer({
	displayValues: true,
	displayOptions: {
		showCardinal: true,
		velocityType: 'Global Wind',

		// 'topleft' | 'topright' | 'bottomleft' | 'bottomright'
		position: 'bottomleft',

		// no data at cursor

		emptyString: 'No velocity data',

		// direction label prefix
		directionString: "Direction",

		// speed label prefix
		speedString: "Speed",

		// 'kt' | 'k/h' | 'mph' | 'm/s'
		speedUnit: 'm/s',

		// Could be any combination of 'bearing' (angle toward which the flow goes) or
		// 'meteo' (angle from which the flow comes) and 'CW' (angle value increases clock-wise) 
		// or 'CCW' (angle value increases counter clock-wise)
		angleConvention: 'bearingCW',
	},
	// see demo/*.json, or wind-js-server for example data service
	data: data,

	// OPTIONAL
	particleAge: 64,
	particleMultiplier: 0.0033,
	particlelineWidth: 1,
	frameRate: 15,
	minVelocity: 0,
	maxVelocity: 10,
	velocityScale: 0.005,
	opacity: 0.97,
	// define your own array of hex/rgb colors
	colorScale: [],
	onAdd: () => console.log('onAdd'),
	onRemove: () => console.log('onRemove'),
	// optional pane to add the layer, will be created if doesn't exist
	// leaflet v1+ only (falls back to overlayPane for < v1)
	paneName: "overlayPane",
});

velocityLayer.addTo(mymap);

License

MIT License (MIT)

leaflet-velocity-ts's People

Contributors

0nza1101 avatar blakemarchal avatar landru29 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

leaflet-velocity-ts's Issues

Outdated project

Hello, the optimisation you did with particle is mind blowing. Leaflet-velocity is very slow without what you did. Is there any chance you update the projet to add the features they added over the time? (exemple : the option for opacity, the two public methods( setData and setOptions and lets you modify the layer's propreties on the fly).

I can't use your fork because of that. I am forced to use the standard library, but it is killing me inside because of the buggy particle.

Merci ! :)

Examples of Use

Bruh you literally copied the JavaScript from the other github repo. Could you provide an example actually using the velocity layer in TypeScript??

How to import?

Hello, thank you for making this library!

How do I import it into a simple TS file? I've tried:

import * as L from 'leaflet-velocity-ts'

import 'leaflet-velocity-ts'

import 'leaflet-velocity-ts/dist/leaflet-velocity'

import { velocityLayer } from 'leaflet-velocity-ts'

but nothing seems to work.

Default opacity setting (1) breaks particle rendering in WebKit (safari)

Screenshot 2024-02-14 at 16 25 11 Screenshot 2024-02-14 at 16 25 04

Above are two screenshots, the former taken in Chrome (macOS client), the latter taken in safari (macOS & iPadOS have same result). Exact same code, exact same options.

The Chrome app for iPad also displays this abnormal behavior, likely because it is using WebKit to render the content as well.

I am not sure what the underlying cause is, or if this library is maintained anymore. But for anyone else trying to get this to work properly on mobile Apple devices, you need to have the opacity setting in the velocity layer options set to 0.98 or lower to make it normal again.

求助!感谢!

您好,我想问一下您这个风场用到的关键性技术算法有哪些呢?感谢!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.