1

I am working on Databricks and have a folium map:

import geopandas as gpd
import matplotlib as plt
import os
import folium
from IPython.display import display

map_osm = folium.Map(location=[45.5236, -122.6750])
map_osm

I get the following:

<folium.folium.Map at 0x7f9978eec748>

I tried Folium map not displaying to no avail.

Any suggestions

frank
  • 3,036
  • 7
  • 33
  • 65

2 Answers2

1

Try this

import folium
import webbrowser
map_osm = folium.Map(location=[45.5236, -122.6750])
map_osm.save('map.html')
webbrowser.open('map.html')

The output of the function is a HTML file and Python IDLE fails to render the html document unless explicitly called. You can also try using the same code on Jupyter notebook which runs on a browser and can render html map at ease.

Himanshu Poddar
  • 7,112
  • 10
  • 47
  • 93
1

Turning the map into HTML then displaying worked for me in Databricks using Python 3.5

world_map = folium.Map()
html_map = world_map._repr_html_()
displayHTML(html_map)

The original answer came from Databricks forums by ShumZZ: https://forums.databricks.com/questions/444/how-to-create-maps-in-databricks.html

Petar Luketina
  • 449
  • 6
  • 18