embed map workaround
See original GitHub issueAll of the guides I have read for getting Folium embedded into an iframe aren’t working. I think maybe it was updated but not included into the documentation?
Typically the instruction looks like this:
def inline(m, width, height):
"""Returns an embedded iframe of a folium.map."""
m._build_map()
src = m.HTML.replace('"', '"')
style = "width: {}px; height: {}px".format(width, height)
return '<iframe srcdoc="{}" style="{}"; border: none"></iframe>'.format(src, style)
HTML(inline(map, 900, 500))`
where ‘m’ is an instance of ‘folium.Map’
I have tried using this code to generate the code for embedding. But it always returns an error: AttributeError: 'Map' object has no attribute '_build_map'
Issue Analytics
- State:
- Created 8 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
The Maps Embed API overview - Google Developers
Easily embed and customize Google Maps on your web page or blog by setting the Google Maps Embed API URL.
Read more >Two Ways to Embed A Map Without Google API Key - YouTube
In this video, I'm going to show you two ways to embed a Google Map on your website without needing an API key.If...
Read more >Google Maps API: What's the workaround?
Clicking on the embedded map from your site takes the user to your Google My Business page on maps, which continues to collect...
Read more >Google Map embed not render #7280 - brave/brave-browser
Description Brave has a problem with website embed Google Map content with API restricted by HTTP referrers Steps to Reproduce Use Brave ...
Read more >How To Embed A Google Map In Divi for Free with No API ...
Thankfully there is an easy solution! I'll show you how to embed a Google Map in Divi in just a few clicks. Here's...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think he may just actually be busy with other responsibilities, is there something I or another contributor can help you with? Joshua Cano
folium is maintained by volunteers at their spare time without any personal profit. So no core dev concern is to close instead of answering.
The
inline
function you mentioned above was created with the notebook in mind. To embed in a webpage you can save theHTML
and work with pure text from there. That means you can skip the linesm._build_map()
andsrc = m.HTML.replace('"', '"')
(that are part of the internal API and not guaranteed to work acrossfolium
versions) from your script and substitute them withopen
andreadlines()
.