keplergl / kepler.gl

Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.
http://kepler.gl
MIT License
10.39k stars 1.74k forks source link

Image export function with map config #647

Open trietphan94 opened 5 years ago

trietphan94 commented 5 years ago

I want to export images with map config. Do we have this feature yet?

macrigiuseppe commented 5 years ago

Hi @trietphan94 can you provide more details for your use case?

You can export your map to an image via the export image feature: https://github.com/keplergl/kepler.gl/blob/master/docs/user-guides/k-save-and-export.md#export-image

You can also export your map configuration/data via __export_map__ feature: https://github.com/keplergl/kepler.gl/blob/master/docs/user-guides/k-save-and-export.md#export-map

When you export a map and choose JSON as your media, you are going to download both map configuration and data

trietphan94 commented 5 years ago

Hi @macrigiuseppe, Thanks for your support. In my case, I have JSON with my current map config and data. I need an image export function that I just need to pass JSON into and export the image, no need to export the map. Input: { datasets: datasets, config: config }

Output: Kepler image from the above input.

heshan0131 commented 5 years ago

@trietphan94 our image export is using dom-to-image which means you still need to run kepler in a browser, We can provide a callback prop getMapImage or some sort for you to gather the map image with input like width and height resolution etc. Needs more details on how frequently you need to get an map image

trietphan94 commented 5 years ago

@heshan0131, Thanks for your support. Very happy if the getMapImage function has the following parameters: type (optinal): The content-type of the file to output. Can be one of 'image/png', 'image/jpeg', 'application/pdf'. filename (optinal): The name of the exported file. Defaults to 'Kepler'. width (optinal): Set the exact pixel width of the exported image or pdf. callback

tanveer21 commented 4 years ago

@heshan0131 Is there any update on getMapImage ? it would be a great help if this helps me to export the image of the map. Basically i want to save the thumbnail image of the visualization in database?

agdhruv commented 3 years ago

I agree, exporting the visualization as an image programmatically is a highly desired feature. There's often a requirement of creating many visualizations, for example per day, per month. Obviously, it's inconvenient to open 100s of images in a browser and saving them as image manually through the DOM.

d-shiri commented 2 years ago

Hi, @heshan0131 I am using google colab and there is no export button in the menu (generally when using Keplergl on a notebook). so, I am trying to find a way to save the output map as an image or better a pdf file. how can I access the image? if there is a way then I can use PIL to manipulate the image and save it as a pdf. one more thing, how can I save the map as JSON(via python)?