##// END OF EJS Templates
Add GeoJSON display class
Grant Nestor -
Show More
@@ -24,7 +24,7 b' from IPython.testing.skipdoctest import skip_doctest'
24 __all__ = ['display', 'display_pretty', 'display_html', 'display_markdown',
24 __all__ = ['display', 'display_pretty', 'display_html', 'display_markdown',
25 'display_svg', 'display_png', 'display_jpeg', 'display_latex', 'display_json',
25 'display_svg', 'display_png', 'display_jpeg', 'display_latex', 'display_json',
26 'display_javascript', 'display_pdf', 'DisplayObject', 'TextDisplayObject',
26 'display_javascript', 'display_pdf', 'DisplayObject', 'TextDisplayObject',
27 'Pretty', 'HTML', 'Markdown', 'Math', 'Latex', 'SVG', 'JSON', 'Javascript',
27 'Pretty', 'HTML', 'Markdown', 'Math', 'Latex', 'SVG', 'JSON', 'GeoJSON', 'Javascript',
28 'Image', 'clear_output', 'set_matplotlib_formats', 'set_matplotlib_close',
28 'Image', 'clear_output', 'set_matplotlib_formats', 'set_matplotlib_close',
29 'publish_display_data', 'update_display', 'DisplayHandle']
29 'publish_display_data', 'update_display', 'DisplayHandle']
30
30
@@ -680,6 +680,25 b' lib_t1 = """$.getScript("%s", function () {'
680 lib_t2 = """});
680 lib_t2 = """});
681 """
681 """
682
682
683 class GeoJSON(JSON):
684
685 @property
686 def data(self):
687 return self._data
688
689 @data.setter
690 def data(self, data):
691 if isinstance(data, str):
692 data = json.loads(data)
693 self._data = data
694
695 def _ipython_display_(self):
696 bundle = {
697 'application/geo+json': self.data,
698 'text/plain': '<jupyterlab_geojson.GeoJSON object>'
699 }
700 display(bundle, raw=True)
701
683 class Javascript(TextDisplayObject):
702 class Javascript(TextDisplayObject):
684
703
685 def __init__(self, data=None, url=None, filename=None, lib=None, css=None):
704 def __init__(self, data=None, url=None, filename=None, lib=None, css=None):
General Comments 0
You need to be logged in to leave comments. Login now