Skip to content

Commit

Permalink
Implement __geo_interface__ for relevant GeoJSON and GeoData classes (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
vpipkt authored Jun 16, 2020
1 parent 782b846 commit c0aaf66
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions ipyleaflet/leaflet.py
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,16 @@ def _get_data(self):

return self.data

@property
def __geo_interface__(self):
"""
Return a dict whose structure aligns to the GeoJSON format
For more information about the ``__geo_interface__``, see
https://gist.github.com/sgillies/2217756
"""

return self.data

def _apply_style(self, feature, style_callback):
if 'properties' not in feature:
feature['properties'] = {}
Expand Down Expand Up @@ -595,6 +605,16 @@ def _update_data(self, change):
def _get_data(self):
return json.loads(self.geo_dataframe.to_json())

@property
def __geo_interface__(self):
"""
Return a dict whose structure aligns to the GeoJSON format
For more information about the ``__geo_interface__``, see
https://gist.github.com/sgillies/2217756
"""

return self.geo_dataframe.__geo_interface__


class Choropleth(GeoJSON):
geo_data = Dict()
Expand Down

0 comments on commit c0aaf66

Please sign in to comment.