Skip to content

Commit c27ed09

Browse files
committed
changed raster to webgl
1 parent d031f24 commit c27ed09

File tree

5 files changed

+26
-28
lines changed

5 files changed

+26
-28
lines changed

examples/introduction.ipynb

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
"source": [
2525
"import configparser\n",
2626
"config = configparser.ConfigParser()\n",
27-
"config.read('.config')\n",
28-
"key = config['DEFAULT']['token']"
27+
"config.read('.config.ini')\n",
28+
"key = config['DEFAULT']['key']"
2929
]
3030
},
3131
{
@@ -38,7 +38,7 @@
3838
{
3939
"data": {
4040
"application/vnd.jupyter.widget-view+json": {
41-
"model_id": "",
41+
"model_id": "e041191333a64c19bbd2db471ae28a2e",
4242
"version_major": 2,
4343
"version_minor": 0
4444
},

ipyopenlayers/Map.py

+7-14
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,7 @@ class Layer(Widget):
2323
_view_module = Unicode(module_name).tag(sync=True)
2424
_view_module_version = Unicode(module_version).tag(sync=True)
2525

26-
<<<<<<< HEAD
27-
class RasterTileLayer(Layer):
28-
<<<<<<< HEAD
29-
30-
_model_name = Unicode('RasterTileLayerModel').tag(sync=True)
31-
_view_name = Unicode('RasterTileLayerView').tag(sync=True)
32-
=======
33-
>>>>>>> 4c0c99b (added vectortilelayer +change tilelayer to ratsertilelayer)
34-
=======
3526
class TileLayer(Layer):
36-
>>>>>>> ff8cce2 (added types to VectorTileLayer)
3727

3828
url = Unicode('https://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png').tag(sync=True)
3929
attribution = Unicode("").tag(sync=True)
@@ -42,6 +32,11 @@ class TileLayer(Layer):
4232
min_zoom = Int(0).tag(sync=True)
4333
max_zoom = Int(18).tag(sync=True)
4434
source_format = Dict().tag(sync=True)
35+
36+
class GeoTIFFTileLayer(Layer):
37+
_model_name = Unicode('GeoTIFFTileLayerModel').tag(sync=True)
38+
_view_name = Unicode('GeoTIFFTileLayerView').tag(sync=True)
39+
url = Unicode('').tag(sync=True)
4540

4641

4742
class RasterTileLayer(TileLayer):
@@ -64,10 +59,6 @@ class GeoJSON(Layer):
6459
style = Dict({}).tag(sync=True)
6560
visible = Bool(True).tag(sync=True)
6661

67-
class GeoTIFFTileLayer(Layer):
68-
_model_name = Unicode('GeoTIFFTileLayerModel').tag(sync=True)
69-
_view_name = Unicode('GeoTIFFTileLayerView').tag(sync=True)
70-
url = Unicode('').tag(sync=True)
7162

7263
class HeatmapLayer(Layer):
7364
_view_name = Unicode('HeatmapLayerView').tag(sync=True)
@@ -77,6 +68,8 @@ class HeatmapLayer(Layer):
7768
radius = Int(8).tag(sync=True)
7869

7970

71+
72+
8073
class BaseOverlay(DOMWidget):
8174

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

src/index.ts

-5
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,3 @@
22
// Distributed under the terms of the Modified BSD License.
33
export * from './version';
44
export * from './widget';
5-
<<<<<<< HEAD
6-
=======
7-
export * from './rastertilelayer';
8-
export * from './basecontrol';
9-
>>>>>>> 4c0c99b (added vectortilelayer +change tilelayer to ratsertilelayer)

src/rastertilelayer.ts

+11-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
// Copyright (c) QuantStack
22
// Distributed under the terms of the Modified BSD License.
33
import { DOMWidgetModel, ISerializers } from '@jupyter-widgets/base';
4-
import TileLayer from 'ol/layer/Tile';
5-
import XYZ from 'ol/source/XYZ';
6-
import OSM from 'ol/source/OSM';
4+
import TileLayer from 'ol/layer/WebGLTile.js';
5+
import XYZ from 'ol/source/XYZ.js'; // Ensure the correct path
76
import { MODULE_NAME, MODULE_VERSION } from './version';
87
import { MapView } from './widget';
98
import { LayerModel, LayerView } from './layer';
@@ -19,6 +18,11 @@ export class RasterTileLayerModel extends LayerModel {
1918
_view_module: RasterTileLayerModel.view_module,
2019
_view_module_version: RasterTileLayerModel.view_module_version,
2120
layers: [],
21+
url: '', // Ensure you have a default value for 'url'
22+
attributions: [],
23+
tileSize: 256,
24+
max_zoom: 19,
25+
min_zoom: 0,
2226
};
2327
}
2428

@@ -30,16 +34,17 @@ export class RasterTileLayerModel extends LayerModel {
3034
static model_name = 'RasterTileLayerModel';
3135
static model_module = MODULE_NAME;
3236
static model_module_version = MODULE_VERSION;
33-
static view_name = 'RasterTileLayerVIew';
37+
static view_name = 'RasterTileLayerView'; // Corrected typo
3438
static view_module = MODULE_NAME;
3539
static view_module_version = MODULE_VERSION;
3640
}
3741

3842
export class RasterTileLayerView extends LayerView {
3943
map_view: MapView;
44+
4045
render() {
4146
super.render();
42-
this.urlChanged();
47+
this.urlChanged(); // Call this method after creating the object
4348
this.model.on('change:url', this.urlChanged, this);
4449
}
4550

@@ -69,5 +74,5 @@ export class RasterTileLayerView extends LayerView {
6974
}
7075
}
7176

72-
tileLayer: TileLayer<OSM>;
77+
tileLayer: TileLayer;
7378
}

src/widget.ts

+5
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ export * from './fullscreen';
2828
export * from './scaleline';
2929
export * from './mouseposition';
3030
export * from './heatmap';
31+
export * from './rastertilelayer'
32+
export * from './geotifflayer'
33+
export * from './vectortilelayer'
34+
35+
3136

3237
const DEFAULT_LOCATION = [0.0, 0.0];
3338

0 commit comments

Comments
 (0)