Generate image from a Map (v-leaflet or google maps addon)


I wonder if this can be done: I have a map, say, generated using V-Leaflet plugin. What I want is to generate a simple image file from the previous map (PNG, JPEG…).

I’ve seen this function somewhere in vaadin or elsewhere…

PS: afterwards, I’d like to generate a new column in a grid and add the image, make the column behave using ImageRenderer and a LatLng to Resource converter (this piece of code is written already).

Thanks for you help, appreciate it!


If you want to do that on the server side, you’ll want to use some generic Java mapping library, nothing related to Vaadin. From the Vaadin map widget you’ll need to get the “viewport”/extent and constrcut a similar map on the the server side to generate the PDF.

An alternative would be to ask the browser to generate an image of the area. I think you could do something like that with canvas and modern browsers, but that’s kind of a hack.

If you data in the maps is rather static, I’d consider using
google maps static maps api