Python maps (Folium) not work on knime

Hi,

I have a python code to display a maps using Folium library, it works correctly, but i can’t execute it and diplay the maps on knime

is there a node for this please ?

Thanks

but i can’t execute it and diplay the maps on knime

Why not? What’s the issue you’re facing?

– Philipp

i don’t have error !! that is the question !!

when i execute the node, python script (1 =>1), no standard output

Can you provide the script you are trying to execute or the entire workflow? Would make debugging a bit easier :wink:

Hey,

any chance we can have a minimal workflow for debugging?

Best,

Christian

maps_france.knwf (7.8 KB)

Looking at the code snippet:

m

The documentation says this is for “display[ing] it in a Jupyter notebook”. But you’re not running it in a Jupyter notebook :slight_smile:

However, the documentation also mentions:

m.save('index.html')

So you could save the map to an HTML file and open this in the system browser. If you’re proficient with Java, you can even automate opening the browser using a Java Snippet node and something like this:

java.awt.Desktop.getDesktop().browse(new java.net.URI("file:///path/to/the/index.html");

Edit: Or maybe even simpler – use the Leaflet.js library directly within the JavaScript nodes? Avoids the Python overhead altogether.

– Philipp

Thanks,

i juste added this code in my python script

m.save(‘index.html’)


import webbrowser, os
from urllib import pathname2url
url = ‘file:{}’.format(pathname2url(os.path.abspath(‘index.html’)))
webbrowser.open(url)


:wink:

Nadir

1 Like