Open jimbok8 opened 4 years ago
I have finally answered my own question. You need to read this excellent article: "Where should I place my Vaadin 10+ static files?"
Its says for Vaadin 14, and I can verify Vaadin 15, for SPRING-BOOT applications, you should put images here: src\main\resources\META-INF\resources\images Then you can refer to them like this new Icon("images/leaf-green.png"). Hope this helps. Jim
Hi Jim, Thank you for your issue request and also your quick response. It is good to know. I'm very happy to know it works for you. Alternatively, you can use DivIcon instead of Icon and then you can style it with CSS.
Eg. new DivIcon("my-custom-class");
and in your CSS file: .my-custom-class: { background: url("images/leaf-green.png"); }
Of course, you need to put your images to the correct location.
Best regards, Gabor
Sorry not sure if this is a bug or feature request! Firstly thanks for your program! I am trying to use my own .png images (e.g colored triangles) for marker icons.
I can see a marker if I use the default icon (marker-icon.png).
I have tried creating an image called tri.png and I put it in the folder called "images". This is where the confusion arises as it took me a while to appreciate that there are two "images" locations: "src\webapp\images" and of course "node_modules\leaflet\dist\images" Unfortunately, I cannot load images from either of these two locations. Ideally, I think the best location would be "src\main\resources\images".
Now I am just very confused, and I don't know if it is possible to load my own .png file or where to put it. Please could you advise? Thanks. Jim
P.S. Just noticed that localhost:8080/images contains marker-icon.png, marker-icon-demo.png, layers-2x.png but I don't what creates this folder and copies the files there.