Skip to content

Commit 2415238

Browse files
authored
Merge pull request #549 from martinRenou/release_cleaning
Release cleaning
2 parents 7186116 + 0226108 commit 2415238

File tree

5 files changed

+39
-42
lines changed

5 files changed

+39
-42
lines changed

docs/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ clean:
5555

5656
html:
5757
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
58-
sed -i 's/div.jupyter_container \*/div.jupyter_container/g' $(BUILDDIR)/html/_static/jupyter-sphinx.css
5958
@echo
6059
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
6160

docs/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
ipyleaflet
2-
jupyter-sphinx>=0.2.3,<0.3
2+
jupyter-sphinx==0.2.4a1
33
scipy
44
netcdf4
55
geopandas

docs/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010

1111
def setup(app):
12-
app.add_stylesheet("main_stylesheet.css")
12+
app.add_css_file("main_stylesheet.css")
1313

1414
master_doc = 'index'
1515
source_suffix = '.rst'

examples/Vector Tiles Example.ipynb renamed to examples/VectorTiles.ipynb

Lines changed: 35 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
"source": [
1818
"from traitlets import Unicode, Dict\n",
1919
"\n",
20+
"# This is a custom VectorTileLayer subclass, allowing to pass our api key to the url\n",
2021
"class CustomVectorTileLayer(VectorTileLayer):\n",
21-
" api_key = Unicode('gCZXZglvRQa6sB2z7JzL1w').tag(sync=True, o=True)\n",
22-
" attribution = Unicode('<a href=\"https://nextzen.com/\">&copy; NextZen</a>, <a href=\"http://www.openstreetmap.org/copyright\">&copy; OpenStreetMap</a> contributors').tag(sync=True, o=True)\n"
22+
" api_key = Unicode('gCZXZglvRQa6sB2z7JzL1w').tag(sync=True, o=True)"
2323
]
2424
},
2525
{
@@ -80,12 +80,15 @@
8080
"aeroway = dict(\n",
8181
" weight=1, fillColor=\"#51aeb5\", color=\"#51aeb5\", fillOpacity=0.2, opacity=0.4\n",
8282
")\n",
83+
"\n",
8384
"road = dict(\n",
8485
" weight=1, fillColor=\"#f2b648\", color=\"#f2b648\", fillOpacity=0.2, opacity=0.4\n",
8586
")\n",
87+
"\n",
8688
"transit = dict(\n",
8789
" weight=0.5, fillColor=\"#f2b648\", color=\"#f2b648\", fillOpacity=0.2, opacity=0.4\n",
8890
")\n",
91+
"\n",
8992
"buildings = dict(\n",
9093
" fill=\"true\",\n",
9194
" weight=1,\n",
@@ -94,27 +97,33 @@
9497
" fillOpacity=0.2,\n",
9598
" opacity=0.4,\n",
9699
")\n",
100+
"\n",
97101
"water_name = dict(\n",
98102
" weight=1, fillColor=\"#022c5b\", color=\"#022c5b\", fillOpacity=0.2, opacity=0.4\n",
99103
")\n",
104+
"\n",
100105
"transportation_name = dict(\n",
101106
" weight=1, fillColor=\"#bc6b38\", color=\"#bc6b38\", fillOpacity=0.2, opacity=0.4\n",
102107
")\n",
108+
"\n",
103109
"place = dict(\n",
104110
" weight=1, fillColor=\"#f20e93\", color=\"#f20e93\", fillOpacity=0.2, opacity=0.4\n",
105111
")\n",
112+
"\n",
106113
"housenumber = dict(\n",
107114
" weight=1, fillColor=\"#ef4c8b\", color=\"#ef4c8b\", fillOpacity=0.2, opacity=0.4\n",
108115
")\n",
116+
"\n",
109117
"poi = dict(weight=1, fillColor=\"#3bb50a\", color=\"#3bb50a\", fillOpacity=0.2, opacity=0.4)\n",
118+
"\n",
110119
"earth = dict(\n",
111120
" fill=\"true\",\n",
112121
" weight=1,\n",
113122
" fillColor=\"#c0c0c0\",\n",
114123
" color=\"#c0c0c0\",\n",
115124
" fillOpacity=0.2,\n",
116125
" opacity=0.4,\n",
117-
")\n"
126+
")"
118127
]
119128
},
120129
{
@@ -124,25 +133,28 @@
124133
"outputs": [],
125134
"source": [
126135
"url = 'https://tile.nextzen.org/tilezen/vector/v1/512/all/{z}/{x}/{y}.mvt?api_key={apiKey}'\n",
127-
"vectorTileLayerStyles=dict(water=water_style,\n",
128-
" waterway=waterway_style,\n",
129-
" admin=admin_style,\n",
130-
" andcover=landcover_style,\n",
131-
" landuse=landuse_style,\n",
132-
" park=park_style,\n",
133-
" boundaries=boundary_style,\n",
134-
" aeroway=aeroway,\n",
135-
" roads=road,\n",
136-
" transit=transit,\n",
137-
" buildings=buildings,\n",
138-
" water_name=water_name,\n",
139-
" transportation_name=transportation_name,\n",
140-
" places=place,\n",
141-
" housenumber=housenumber,\n",
142-
" pois=poi,\n",
143-
" earth=earth,)\n",
136+
"vector_tile_layer_styles = dict(\n",
137+
" water=water_style,\n",
138+
" waterway=waterway_style,\n",
139+
" admin=admin_style,\n",
140+
" andcover=landcover_style,\n",
141+
" landuse=landuse_style,\n",
142+
" park=park_style,\n",
143+
" boundaries=boundary_style,\n",
144+
" aeroway=aeroway,\n",
145+
" roads=road,\n",
146+
" transit=transit,\n",
147+
" buildings=buildings,\n",
148+
" water_name=water_name,\n",
149+
" transportation_name=transportation_name,\n",
150+
" places=place,\n",
151+
" housenumber=housenumber,\n",
152+
" pois=poi,\n",
153+
" earth=earth\n",
154+
")\n",
155+
"\n",
144156
"m = Map(center=(52.204793, 360.121558), zoom=9)\n",
145-
"vl = CustomVectorTileLayer(url=url, vector_tile_layer_styles=vectorTileLayerStyles)\n",
157+
"vl = CustomVectorTileLayer(url=url, vector_tile_layer_styles=vector_tile_layer_styles)\n",
146158
"m.add_layer(vl)\n",
147159
"m"
148160
]
@@ -153,7 +165,7 @@
153165
"metadata": {},
154166
"outputs": [],
155167
"source": [
156-
"m.zoom=3.58"
168+
"m.zoom = 3.58"
157169
]
158170
},
159171
{
@@ -164,15 +176,6 @@
164176
"source": [
165177
"vl.url = \"https://basemaps.arcgis.com/v1/arcgis/rest/services/World_Basemap/VectorTileServer/tile/{z}/{y}/{x}.pbf\""
166178
]
167-
},
168-
{
169-
"cell_type": "code",
170-
"execution_count": null,
171-
"metadata": {},
172-
"outputs": [],
173-
"source": [
174-
"m.remove_layer(m.layers[0])"
175-
]
176179
}
177180
],
178181
"metadata": {
@@ -191,7 +194,7 @@
191194
"name": "python",
192195
"nbconvert_exporter": "python",
193196
"pygments_lexer": "ipython3",
194-
"version": "3.7.3"
197+
"version": "3.8.2"
195198
}
196199
},
197200
"nbformat": 4,

ipyleaflet/leaflet.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -393,19 +393,14 @@ class VectorTileLayer(Layer):
393393
_model_name = Unicode('LeafletVectorTileLayerModel').tag(sync=True)
394394

395395
url = Unicode().tag(sync=True, o=True)
396+
attribution = Unicode().tag(sync=True, o=True)
397+
396398
vector_tile_layer_styles = Dict().tag(sync=True, o=True)
397399

398400
def __init__(self, **kwargs):
399401
super(VectorTileLayer, self).__init__(**kwargs)
400402
self.on_msg(self._handle_leaflet_event)
401403

402-
def _handle_leaflet_event(self, _, content, buffers):
403-
if content.get('event', '') == 'load':
404-
self._load_callbacks(**content)
405-
406-
def on_load(self, callback, remove=False):
407-
self._load_callbacks.register_callback(callback, remove=remove)
408-
409404
def redraw(self):
410405
self.send({'msg': 'redraw'})
411406

0 commit comments

Comments
 (0)