Skip to content

Commit 973de7f

Browse files
committed
changed url
1 parent ed26819 commit 973de7f

File tree

5 files changed

+36
-39
lines changed

5 files changed

+36
-39
lines changed

Diff for: examples/.config.ini

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[DEFAULT]
2+
key = dQgZTyb2Wy7LIcwn3gSJ

Diff for: examples/introduction.ipynb

+16-15
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
},
1010
{
1111
"cell_type": "code",
12-
"execution_count": 25,
12+
"execution_count": 1,
1313
"metadata": {},
1414
"outputs": [],
1515
"source": [
@@ -18,21 +18,21 @@
1818
},
1919
{
2020
"cell_type": "code",
21-
"execution_count": 26,
21+
"execution_count": 2,
2222
"metadata": {},
2323
"outputs": [
2424
{
2525
"data": {
2626
"application/vnd.jupyter.widget-view+json": {
27-
"model_id": "47a42e9446f44146a853ebba1de8b8c8",
27+
"model_id": "2f268e1adb234ab19da2eecccc7167c0",
2828
"version_major": 2,
2929
"version_minor": 0
3030
},
3131
"text/plain": [
3232
"Map(center=[5.314329221346643, 16.3625002926901], zoom=9.0)"
3333
]
3434
},
35-
"execution_count": 26,
35+
"execution_count": 2,
3636
"metadata": {},
3737
"output_type": "execute_result"
3838
}
@@ -44,7 +44,7 @@
4444
},
4545
{
4646
"cell_type": "code",
47-
"execution_count": 27,
47+
"execution_count": 3,
4848
"metadata": {},
4949
"outputs": [],
5050
"source": [
@@ -54,7 +54,7 @@
5454
},
5555
{
5656
"cell_type": "code",
57-
"execution_count": 21,
57+
"execution_count": 4,
5858
"metadata": {},
5959
"outputs": [],
6060
"source": [
@@ -64,26 +64,27 @@
6464
},
6565
{
6666
"cell_type": "code",
67-
"execution_count": 28,
67+
"execution_count": 6,
6868
"metadata": {},
6969
"outputs": [],
7070
"source": [
71-
"geo_tiff_layer = GeoTIFFTileLayer(\n",
72-
" sources=[\n",
73-
" {'url': 'https://sentinel-cogs.s3.us-west-2.amazonaws.com/sentinel-s2-l2a-cogs/36/Q/WD/2020/7/S2A_36QWD_20200701_0_L2A/TCI.tif'}\n",
74-
" ]\n",
75-
")\n",
71+
"geo_tiff_layer = GeoTIFFTileLayer(url= 'https://sentinel-cogs.s3.us-west-2.amazonaws.com/sentinel-s2-l2a-cogs/36/Q/WD/2020/7/S2A_36QWD_20200701_0_L2A/TCI.tif')\n",
7672
"m.add_layer(geo_tiff_layer)"
7773
]
7874
},
7975
{
80-
"cell_type": "code",
81-
"execution_count": 15,
76+
"cell_type": "markdown",
8277
"metadata": {},
83-
"outputs": [],
8478
"source": [
8579
"m.remove_layer(geo_tiff_layer)"
8680
]
81+
},
82+
{
83+
"cell_type": "code",
84+
"execution_count": null,
85+
"metadata": {},
86+
"outputs": [],
87+
"source": []
8788
}
8889
],
8990
"metadata": {

Diff for: ipyopenlayers/Map.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class GeoJSON(Layer):
4242
class GeoTIFFTileLayer(Layer):
4343
_model_name = Unicode('GeoTIFFTileLayerModel').tag(sync=True)
4444
_view_name = Unicode('GeoTIFFTileLayerView').tag(sync=True)
45-
sources = List(Dict).tag(sync=True)
45+
url = Unicode('').tag(sync=True)
4646

4747
class HeatmapLayer(Layer):
4848
_view_name = Unicode('HeatmapLayerView').tag(sync=True)
@@ -52,8 +52,6 @@ class HeatmapLayer(Layer):
5252
radius = Int(8).tag(sync=True)
5353

5454

55-
56-
5755
class BaseOverlay(DOMWidget):
5856

5957
_model_module = Unicode(module_name).tag(sync=True)

Diff for: src/geotifflayer.ts

+15-18
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export class GeoTIFFTileLayerModel extends LayerModel {
1616
_view_name: GeoTIFFTileLayerModel.view_name,
1717
_view_module: GeoTIFFTileLayerModel.view_module,
1818
_view_module_version: GeoTIFFTileLayerModel.view_module_version,
19-
source: [],
19+
url: '',
2020
};
2121
}
2222

@@ -37,33 +37,30 @@ export class GeoTIFFTileLayerView extends LayerView {
3737
render() {
3838
super.render();
3939
this.sourcesChanged();
40-
this.model.on('change:sources', this.sourcesChanged, this);
40+
this.model.on('change:url', this.sourcesChanged, this);
4141
}
4242

4343
create_obj() {
44-
const sources = this.model.get('sources').map((source: any) => ({
45-
url: source.url,
46-
}));
44+
const url = this.model.get('url');
4745

48-
this.obj = this.tileLayer = new WebGLTileLayer({
49-
source: new GeoTIFF({
50-
sources: sources,
51-
}),
52-
});
46+
if (url) {
47+
this.obj = new WebGLTileLayer({
48+
source: new GeoTIFF({
49+
sources: [{ url: url }],
50+
}),
51+
});
52+
}
5353
}
54-
5554
sourcesChanged() {
56-
const newSources = this.model.get('sources').map((source: any) => ({
57-
url: source.url,
58-
}));
55+
const newUrl = this.model.get('url');
5956

60-
if (newSources) {
57+
if (newUrl) {
6158
const newSource = new GeoTIFF({
62-
sources: newSources,
59+
sources: [{ url: newUrl }],
6360
});
64-
this.tileLayer.setSource(newSource);
61+
this.obj.setSource(newSource);
6562
}
6663
}
6764

68-
tileLayer: WebGLTileLayer;
65+
obj: WebGLTileLayer;
6966
}

Diff for: ui-tests/tests/notebooks/map_update.ipynb

+2-3
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212
"outputs": [],
1313
"source": [
1414
"from ipyopenlayers import (\n",
15-
" Map, TileLayer, ImageOverlay, VideoOverlay, PopupOverlay,\n",
16-
" ZoomSlider, FullScreen, ScaleLine, MousePosition\n",
15+
" Map, RasterTileLayer\n",
1716
")\n",
1817
"\n",
1918
"m = Map(center=[0.0, 0.0], zoom=2)\n",
@@ -31,7 +30,7 @@
3130
},
3231
"outputs": [],
3332
"source": [
34-
"layer = TileLayer()\n",
33+
"layer = RasterTileLayer()\n",
3534
"m.add_layer(layer)"
3635
]
3736
}

0 commit comments

Comments
 (0)