Create a GeoJSON display object given raw data. Parameters ---------- data : dict or list VegaLite data. Not an already-serialized JSON string. Scalar types (None, number, string) are not allowed, only dict or list containers. url_
(self, *args, **kwargs)
| 939 | """ |
| 940 | |
| 941 | def __init__(self, *args, **kwargs): |
| 942 | """Create a GeoJSON display object given raw data. |
| 943 | |
| 944 | Parameters |
| 945 | ---------- |
| 946 | data : dict or list |
| 947 | VegaLite data. Not an already-serialized JSON string. |
| 948 | Scalar types (None, number, string) are not allowed, only dict |
| 949 | or list containers. |
| 950 | url_template : string |
| 951 | Leaflet TileLayer URL template: http://leafletjs.com/reference.html#url-template |
| 952 | layer_options : dict |
| 953 | Leaflet TileLayer options: http://leafletjs.com/reference.html#tilelayer-options |
| 954 | url : unicode |
| 955 | A URL to download the data from. |
| 956 | filename : unicode |
| 957 | Path to a local file to load the data from. |
| 958 | metadata: dict |
| 959 | Specify extra metadata to attach to the json display object. |
| 960 | |
| 961 | Examples |
| 962 | -------- |
| 963 | |
| 964 | The following will display an interactive map of Mars with a point of |
| 965 | interest on frontend that do support GeoJSON display. |
| 966 | |
| 967 | >>> from IPython.display import GeoJSON |
| 968 | |
| 969 | >>> GeoJSON(data={ |
| 970 | ... "type": "Feature", |
| 971 | ... "geometry": { |
| 972 | ... "type": "Point", |
| 973 | ... "coordinates": [-81.327, 296.038] |
| 974 | ... } |
| 975 | ... }, |
| 976 | ... url_template="http://s3-eu-west-1.amazonaws.com/whereonmars.cartodb.net/{basemap_id}/{z}/{x}/{y}.png", |
| 977 | ... layer_options={ |
| 978 | ... "basemap_id": "celestia_mars-shaded-16k_global", |
| 979 | ... "attribution" : "Celestia/praesepe", |
| 980 | ... "minZoom" : 0, |
| 981 | ... "maxZoom" : 18, |
| 982 | ... }) |
| 983 | <IPython.core.display.GeoJSON object> |
| 984 | |
| 985 | In the terminal IPython, you will only see the text representation of |
| 986 | the GeoJSON object. |
| 987 | |
| 988 | """ |
| 989 | |
| 990 | super(GeoJSON, self).__init__(*args, **kwargs) |
| 991 | |
| 992 | |
| 993 | def _ipython_display_(self): |