Extract map components and put those on a page.
()
| 55 | |
| 56 | @app.route("/components") |
| 57 | def components(): |
| 58 | """Extract map components and put those on a page.""" |
| 59 | m = folium.Map( |
| 60 | width=800, |
| 61 | height=600, |
| 62 | ) |
| 63 | |
| 64 | m.get_root().render() |
| 65 | header = m.get_root().header.render() |
| 66 | body_html = m.get_root().html.render() |
| 67 | script = m.get_root().script.render() |
| 68 | |
| 69 | return render_template_string( |
| 70 | """ |
| 71 | <!DOCTYPE html> |
| 72 | <html> |
| 73 | <head> |
| 74 | {{ header|safe }} |
| 75 | </head> |
| 76 | <body> |
| 77 | <h1>Using components</h1> |
| 78 | {{ body_html|safe }} |
| 79 | <script> |
| 80 | {{ script|safe }} |
| 81 | </script> |
| 82 | </body> |
| 83 | </html> |
| 84 | """, |
| 85 | header=header, |
| 86 | body_html=body_html, |
| 87 | script=script, |
| 88 | ) |
| 89 | |
| 90 | |
| 91 | if __name__ == "__main__": |
nothing calls this directly
no test coverage detected
searching dependent graphs…