Skip to content

Commit f77f1fe

Browse files
Add ElevationPath control.
1 parent 6993f0d commit f77f1fe

File tree

3 files changed

+60
-60
lines changed

3 files changed

+60
-60
lines changed

examples/GeoportalControls.ipynb

+28-60
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,21 @@
22
"cells": [
33
{
44
"cell_type": "code",
5-
"execution_count": 3,
5+
"execution_count": 1,
66
"id": "6bb0dd68-f96d-45c5-b3de-48c2092f2690",
77
"metadata": {},
88
"outputs": [],
99
"source": [
1010
"from ipyleaflet import *\n",
11-
"from ipyleaflet.geoportal import GeoportalWMTS, GeoportalLayerSwitcher, GeoportalSearchEngine, GeoportalRoute, GeoportalMousePosition"
11+
"from ipyleaflet.geoportal import GeoportalWMTS, GeoportalLayerSwitcher, GeoportalSearchEngine, GeoportalRoute, GeoportalMousePosition, GeoportalElevationPath"
1212
]
1313
},
1414
{
1515
"cell_type": "code",
16-
"execution_count": 4,
16+
"execution_count": null,
1717
"id": "fdeacb8e-3113-453d-ab63-a5ab639bf0c8",
1818
"metadata": {},
19-
"outputs": [
20-
{
21-
"data": {
22-
"application/vnd.jupyter.widget-view+json": {
23-
"model_id": "6a239c9944c143c8ad49af3d1d5417c2",
24-
"version_major": 2,
25-
"version_minor": 0
26-
},
27-
"text/plain": [
28-
"Map(center=[44.799999, 2.26667], controls=(ZoomControl(options=['position', 'zoom_in_text', 'zoom_in_title', '…"
29-
]
30-
},
31-
"metadata": {},
32-
"output_type": "display_data"
33-
}
34-
],
19+
"outputs": [],
3520
"source": [
3621
"#Route control for itinerary calculation\n",
3722
"layer = GeoportalWMTS(layer = 'GEOGRAPHICALGRIDSYSTEMS.PLANIGNV2', api_key = 'cartes', format = 'image/png')\n",
@@ -43,25 +28,10 @@
4328
},
4429
{
4530
"cell_type": "code",
46-
"execution_count": 5,
31+
"execution_count": null,
4732
"id": "3a686d99-c3ca-4596-81aa-24442564bea2",
4833
"metadata": {},
49-
"outputs": [
50-
{
51-
"data": {
52-
"application/vnd.jupyter.widget-view+json": {
53-
"model_id": "c8dacf4132a44828a29e0d238dcdc266",
54-
"version_major": 2,
55-
"version_minor": 0
56-
},
57-
"text/plain": [
58-
"Map(center=[44.799999, 2.26667], controls=(ZoomControl(options=['position', 'zoom_in_text', 'zoom_in_title', '…"
59-
]
60-
},
61-
"metadata": {},
62-
"output_type": "display_data"
63-
}
64-
],
34+
"outputs": [],
6535
"source": [
6636
"#LayerSwitcher control\n",
6737
"m1 = Map(center=(44.799999, 2.26667), zoom=10, zoom_control=True)\n",
@@ -79,25 +49,10 @@
7949
},
8050
{
8151
"cell_type": "code",
82-
"execution_count": 6,
52+
"execution_count": null,
8353
"id": "57062455-fe86-4e3b-8eaf-94e996b44830",
8454
"metadata": {},
85-
"outputs": [
86-
{
87-
"data": {
88-
"application/vnd.jupyter.widget-view+json": {
89-
"model_id": "ca2a469baad0480780ead5013c4d7395",
90-
"version_major": 2,
91-
"version_minor": 0
92-
},
93-
"text/plain": [
94-
"Map(center=[44.799999, 2.26667], controls=(ZoomControl(options=['position', 'zoom_in_text', 'zoom_in_title', '…"
95-
]
96-
},
97-
"metadata": {},
98-
"output_type": "display_data"
99-
}
100-
],
55+
"outputs": [],
10156
"source": [
10257
"#SearchEngine control\n",
10358
"m2 = Map(center=(44.799999, 2.26667), zoom=10, zoom_control=True)\n",
@@ -108,14 +63,27 @@
10863
},
10964
{
11065
"cell_type": "code",
111-
"execution_count": 7,
66+
"execution_count": null,
11267
"id": "0a7ca855-c96d-4864-9b9c-1873712033bb",
11368
"metadata": {},
69+
"outputs": [],
70+
"source": [
71+
"#MousePosition control\n",
72+
"m3 = Map(center=(44.799999, 2.26667), zoom=10, zoom_control=True)\n",
73+
"mouse_position_control = GeoportalMousePosition()\n",
74+
"m3.add(mouse_position_control)"
75+
]
76+
},
77+
{
78+
"cell_type": "code",
79+
"execution_count": 2,
80+
"id": "17a9e9bb-f3a5-40e5-90ea-8d57049cda5f",
81+
"metadata": {},
11482
"outputs": [
11583
{
11684
"data": {
11785
"application/vnd.jupyter.widget-view+json": {
118-
"model_id": "fa99ee68017947eba8768c90410b9e03",
86+
"model_id": "de83e395ef634b6da1c061289ceac763",
11987
"version_major": 2,
12088
"version_minor": 0
12189
},
@@ -128,16 +96,16 @@
12896
}
12997
],
13098
"source": [
131-
"#MousePosition control\n",
132-
"m3 = Map(center=(44.799999, 2.26667), zoom=10, zoom_control=True)\n",
133-
"mouse_position_control = GeoportalMousePosition()\n",
134-
"m3.add(mouse_position_control)"
99+
"#ElevationPath control\n",
100+
"m4 = Map(center=(44.799999, 2.26667), zoom=10, zoom_control=True)\n",
101+
"elevation_path_control = GeoportalElevationPath()\n",
102+
"m4.add(elevation_path_control)"
135103
]
136104
},
137105
{
138106
"cell_type": "code",
139107
"execution_count": null,
140-
"id": "17a9e9bb-f3a5-40e5-90ea-8d57049cda5f",
108+
"id": "88acf040-74f1-419d-a3b8-766b9a538d43",
141109
"metadata": {},
142110
"outputs": [],
143111
"source": []

ipyleaflet/geoportal.py

+11
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,14 @@ class GeoportalMousePosition(Control):
7070

7171
_view_name = Unicode('LeafletGeoportalMousePositionView').tag(sync=True)
7272
_model_name = Unicode('LeafletGeoportalMousePositionModel').tag(sync=True)
73+
74+
75+
class GeoportalElevationPath(Control):
76+
"""GeoportalMousePosition class, with Control as parent class
77+
78+
Attributes
79+
----------
80+
"""
81+
82+
_view_name = Unicode('LeafletGeoportalElevationPathView').tag(sync=True)
83+
_model_name = Unicode('LeafletGeoportalElevationPathModel').tag(sync=True)

js/src/layers/Geoportal.js

+21
Original file line numberDiff line numberDiff line change
@@ -105,4 +105,25 @@ export class LeafletGeoportalLayerSwitcherModel extends control.LeafletControlMo
105105
}
106106
}
107107

108+
export class LeafletGeoportalElevationPathModel extends control.LeafletControlModel {
109+
defaults() {
110+
return {
111+
...super.defaults(),
112+
_view_name: 'LeafletGeoportalElevationPathView',
113+
_model_name: 'LeafletGeoportalElevationPathModel'
114+
};
115+
}
116+
}
117+
118+
export class LeafletGeoportalElevationPathView extends control.LeafletControlView {
119+
initialize(parameters) {
120+
super.initialize(parameters);
121+
this.map_view = this.options.map_view;
122+
}
123+
create_obj() {
124+
this.obj = L.geoportalControl.ElevationPath({})
125+
}
126+
}
127+
128+
108129

0 commit comments

Comments
 (0)