question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

embed map workaround

See original GitHub issue

All 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('"', '&quot;') 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:closed
  • Created 8 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
joshuacanocommented, Mar 17, 2017

I think he may just actually be busy with other responsibilities, is there something I or another contributor can help you with? Joshua Cano

On Mar 16, 2017, at 14:12, Ed Miles notifications@github.com wrote:

@ocefpaf is more interested in closing issues than actually answering questions it seems

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

0reactions
ocefpafcommented, Mar 17, 2017

@ocefpaf is more interested in closing issues than actually answering questions it seems

folium is maintained by volunteers at their spare time without any personal profit. So no core dev concern is to close instead of answering.

@ocefpaf I am talking about embedding the map into a webpage. Not really sure what notebooks is.

The inline function you mentioned above was created with the notebook in mind. To embed in a webpage you can save the HTML and work with pure text from there. That means you can skip the lines

m._build_map() and src = m.HTML.replace('"', '&quot;') (that are part of the internal API and not guaranteed to work across folium versions) from your script and substitute them with open and readlines().

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found