John
John

Reputation: 750

Folium map issue in PyCharm

I am using Pycharm and the folium maps are not being displayed. My code is as follows:

import folium
from folium import plugins
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from IPython.core.display import display, HTML

m = folium.Map([52.5, 2], zoom_start=5.5)
display(m)

But I am able to save it as html and it is correctly displayed in html.

m.save('aee.html')

Upvotes: 2

Views: 7831

Answers (1)

user12177026
user12177026

Reputation:

You can't open the map directly in pycharm. Yet, as you stated you can make an HTML File of it.

Here's a little function to auto-open it in browser:

    def auto_open(path):
        html_page = f'{path}'
        f_map.save(html_page)
        # open in browser.
        new = 2
        webbrowser.open(html_page, new=new)

I'm using fuliom like this in a Django app, it's quite useful as render tool as well.

Folium also provides ability to save the map to images, check it out.

Upvotes: 7

Related Questions