Comments (6)
Amazing thanks. L.divicon worked really nicely - I also managed to customise it making the css styling on the server side for more reactivity. Thanks again.
from leaflet.extras2.
Hey, I just pushed 7afffe8, which exposes the new argument name
to addPlayback
. With it you can access feature.name
in the marker function and style the icons as you want.
marker = htmlwidgets::JS("
function(feature) {
var color = 'blue';
var icon = null;
switch (feature.name) {
case 'ALPHA':
color = 'red';
icon = 'glass';
break;
}
return {
icon: L.AwesomeMarkers.icon({
icon: icon,
markerColor: color
})
}
}")
You can see a full example here:
https://github.com/trafficonese/leaflet.extras2/blob/master/inst/examples/playback_app_awesomemarkers.R
Note that I also have to include the AwesomeMarker dependencies (leaflet:::leafletAwesomeMarkersDependencies()
).
from leaflet.extras2.
Thanks, this is really neat addition and very much appreciated! Yes if it was possible to include the awesomemarker dependencies as well super, e.g. I guess for the moveable markers to act more like circleMarkers perhaps? Incidentally, this is for animation visualisation of animal tracking data in a Shiny app and I've found yours to be a fast render of the animation so far in my trials.
Not looking to leave a full "wish list" here :) but I also wondered as well if it was possible to retain lagged interpolated points on the map for a period of time before they disappear leading up to the current location, if that makes sense? Reason for that question is because I was experimenting with some other options in leaftime
inspired by this discussion for polylines in that regard, but perhaps this is more of a technical challenge, e.g. perhaps even lines and points on the same map feeding off the same play slider...
Totally fine to leave this query as it is though if the second paragraph is a step too far. Thanks so much for your help again.
from leaflet.extras2.
Hm I guess the movableMarker is not a circleMarker as the GPS-track is already visualized with circleMarkers and I think its nice be able to include an Icon.
For the lagged interpolated points, I guess that should be raised in the underlying JS-library.
from leaflet.extras2.
Thanks. Fully appreciate this function as it is, it is great addition (was just exploring options).
Just one more thing - is there an easy way to pass hex colours through to the switch? e.g.
case 'ALPHA':
color = '#ff7800';
icon = 'glass';
break;
At the moment the above would default to 'red' I think (in my version), so expect I am missing something obvious.
from leaflet.extras2.
As per the https://github.com/lennardv2/Leaflet.awesome-markers definition, the Awesome Markers can only have a few colors and not hex-colors.
markerColor | Color of the marker | 'blue' | 'red', 'darkred', 'orange', 'green', 'darkgreen', 'blue', 'purple', 'darkpurple', 'cadetblue' |
---|
But you could use L.divIcon and use your own CSS-class for every Marker. I just pushed an example for this:
https://github.com/trafficonese/leaflet.extras2/blob/master/inst/examples/playback_app_divicon.R
from leaflet.extras2.
Related Issues (20)
- awesomeIcons in addMovingMarker for direction HOT 7
- New Feature Request : Leaflet Pattern HOT 1
- Sidebar v2 working with crosstalk HOT 4
- Using CQL or OGC filters on addWMS() HOT 2
- addArrowhead function not rendering HOT 4
- addEasyprint does only export the top part of a map for "Current Size" HOT 3
- Overlaying sidebar using shinydashboard and addSidebar HOT 13
- Spinner does not appear in Shiny application HOT 6
- "addHexbin" in leaflet.extras2 doesn't allow for mean/sum HOT 2
- addVelocity not work HOT 1
- addWMS with interactive options HOT 1
- addWMS - authentication for title layer HOT 2
- addWMS() does not hide the attribution when corresponding group is hidden HOT 2
- Release leaflet.extras2 1.2.1
- addSidebar causing issues if multiple leaflet maps are in one R shiny app HOT 6
- Feature Request: Function to Recolor Polygons in Shiny without Redrawing them HOT 2
- airDatePickerInput (ShinyWidgets) not rendering properly in leaflet sidebar menu HOT 1
- Release leaflet.extras2 1.2.2
- Integrating GetLegendGraphic from Geoserver WMS Layers HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from leaflet.extras2.