Open 00ricardo opened 4 years ago
I would bet you could do it with something like freehandshapes.addLayer(L.polygon([[0,0], [0,1], [1,0], [0,0]]), false)
See the addLayer method here: https://github.com/bozdoz/leaflet-freehandshapes/blob/master/src/index.js#L94-L103
Your solution is not really what i need
var fireLines = new L.FreeHandShapes({
polygon: {
className: 'fireLine',
color: 'red',
fillColor: 'red',
opacity: 0.7,
weight: 3,
smoothFactor: 1
},
polyline: {
color: '#D55F04',
smoothFactor: 1
},
simplify_tolerance: 0.001,
merge_polygons: true,
concave_polygons: false
});
fireLines.addLayer(L.polygon([
[0, 0],
[0, 1],
[1, 0],
[1, 1],
[0, 0]
]), false);
Check this:
It should be merged and same color as well.
Sorry, try addPolygon(latlngs, ...)
:
https://github.com/bozdoz/leaflet-freehandshapes/blob/master/src/index.js#L221-L232
You can see in that method that it will simplify the lat/lng pairs, and merge; it also uses getPolygon
which uses the styles you define in the options.
Hey... i found a problem. When i forced the latlngs to create a polygon it overlayed the others and it doesn't merge. How can i get this right?
Thats my result:
It should look something like this:
Hi there, there is a way to forced LatLng to a polygon? I want to create a polygon passing the coordinates into it.
something like: