Answer the question
In order to leave comments, you need to log in
How to make a polyline painted in different colors?
How to make a polyline painted in different colors? The bottom line is that you need to paint a certain percentage of the polyline with a different color, roughly speaking, there will be a load indicator, it must be displayed somehow.
Any ideas?
Answer the question
In order to leave comments, you need to log in
Specify a different color when creating a line
var polyline = L.polyline(latlngs, {color: 'red'}).addTo(map);
L.geoJSON(states, {
style: function(feature) {
switch (feature.properties.party) {
case 'Republican': return {color: "#ff0000"};
case 'Democrat': return {color: "#0000ff"};
}
}
}).addTo(map);
Well, you can change the color, I understand that, but for example, I would like to know if there is a method that allows you to paint a polyline, for example, 70 percent of the length in orange and the rest in black ....
I found such an extension https://github.com/hgoebl /Leaflet.MultiOptionsPolyline
but it somehow builds on other data...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question