3

I have an output file data.json

 [{"5403": 2, "9734": 1, "2565": 5, "5087": 2, "9061": 1, "1761": 4, "4811": 7 "1111": 5, "3891": 3, "1962": 3}]

and a shapefile converted to geojson https://www.dropbox.com/s/uou0jxhpklgt8r6/pc4.json?dl=0

I use this code to generate the map in ipython notebook:

import folium
import numpy as np
from IPython.display import IFrame
from IPython.core.display import HTML

def inline_map(m, width=650, height=500):
    """Takes a folium instance and embed HTML."""
    m._build_map()
    srcdoc = m.HTML.replace('"', '"')
    embed = HTML('<iframe srcdoc="{}" '
                 'style="width: {}px; height: {}px; '
                 'border: none"></iframe>'.format(srcdoc, width, height))
    return embed

    mapa = folium.Map(width=900, height=600, zoom_start=7, location=[52.3, 5], tiles='Mapbox Bright')

mapa.geo_json(geo_path='pc4.json', 
              data_out='data.json', 
              data=pcs, 
              columns=["PC4","Count"], 
              key_on="feature.properties.PC4",
              fill_color='PuRd',
              fill_opacity=1, 
              line_opacity=1,
              legend_name='Demand',
              reset="True")

mapa.create_map('test.html')
IFrame('test.html', width=1000, height=700)

It creates the map fine, just as the output file, but it doesn't overlay any heatmap. It does show the legend though, but nothing else.

I know this question is similar to Geopandas/folium map not displaying but his solution doesn't do anything for me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.