I also checked the code in the connector and I saw that you use some SVG path to create the marker icon around FontAwesome icons.
I would love to use my own SVG paths (as I did with Google Maps using their Symbol class) - Is that possible? Would I have to clone the add-ons code into my project and modify its client side and the connector in order to support that?
Oh, lots of questions Can’t answer all directly, should check some things.
Don’t remember the white square thing, might be a regression. If you think it is a bug as well, create an issue about it to github project page.
IIRC Leaflet 1.0 now contains a better way to put raw text on a map, should see if I could upgrade that example a bit.
Can’t remember how SVG icon/fontawesome thing works, could look at it soon, should look into updating to leaflet 1.0 final first.
For rotated markers, there is a GWT add-on, but its author hasn’t created a Vaadin version, I guess creating that shouldn’t be that difficult: https://vaadin.com/directory#!addon/g-leaflet-rotatedmarker
For rotating, I guess you could use some CSS magic as well…
I checked into teh white quare thing you mentioned. I guess you need to explicitly define the size, otherwise it will end up being some minimum size → small square. In the example I seem to use this kind of code:
LMarker m = new LMarker(0,0);
m.setDivIcon("Hello <strong>world</strong>!");
// define the size for the html box
m.setIconSize(new Point(80,20));
leafletMap.addLayer(m);
I guess Leaflet needs the size to properly position the divIcon. If you don’t want to show the background and border, you can probably just us CSS to get rid of that.
Does anybody knows why rotated marker icon is not where it should be on a map? It’s always moved for some distance from it should be on a map. Only when make max zoom in it’s where it should be?
Hi Matti,
is there a possibility to simply change the color of the marker? The setStyle()-Method doesn’t seem to do anything.
I just need to change the default color of the icon to e.g. red, green etc. The svg can stay unchanged.
Thanks!
The default marker is a raster image IIRC. It might be quite easy to make the color of SVG marker to be configured somehow. Do you have a static list of colors you’d use or would those need to be dynamic? If static, then the solution could use CSS.
Hi Matti,
static would be totally sufficient. It should be enough to have something like let’s say 10 or 20 predefined colors to play with. I tried with CSS, but no luck.
Can you provide an example pls?
Thanks
I’m finding that if I put setIconSize(…) the whole background of the icon will be a white box. If I leave it then I still get a whitebox but it’s much smaller. setIconAnchor only seems to adjust where the anchor is and has no bearing on the whitebox (whether you set it or not). As in has the fix changed over the last year?
Stephan, do you need that whitebox or not? I think most often you want to get rid of it using the v-leaflet-custom-svg stylename. If you need to block transparency, you can do that in the image/svg.
hello all,
I use v-leaflet to create my map in a web application i create many markers with different icon
I need to create a click listener on a marker and open a pop up window
Can you provide an example please?
Thanks