Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions mapboxgl/viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import os

from IPython.core.display import HTML, display

from IPython.display import IFrame
import numpy
import requests

Expand All @@ -12,7 +12,7 @@
from mapboxgl import templates


GL_JS_VERSION = 'v1.5.0'
GL_JS_VERSION = 'v1.0.0'


class VectorMixin(object):
Expand Down Expand Up @@ -252,13 +252,26 @@ def as_iframe(self, html_data):
width=self.width,
height=self.height))

def show(self, **kwargs):
def as_iframe2(self, html_data):
"""Build the HTML representation for the mapviz, using Jupyter Iframe"""

srcdoc = html_data.replace('"', "'")
return ('<iframe id="{div_id}", srcdoc="{srcdoc}>'.format(
div_id=self.div_id,
srcdoc=srcdoc))

def show(self, iframe = False, **kwargs):
# Load the HTML iframe
html = self.create_html(**kwargs)
map_html = self.as_iframe(html)


# Display the iframe in the current jupyter notebook view
display(HTML(map_html))
if (iframe):
map_html = self.as_iframe2(html)
display(IFrame(map_html,self.width,self.height))
else:
map_html = self.as_iframe(html)
display(HTML(map_html))

def add_unique_template_variables(self, options):
pass
Expand Down