Skip to content

Commit db52eb3

Browse files
Add Isocurve control.
1 parent f77f1fe commit db52eb3

File tree

3 files changed

+87
-21
lines changed

3 files changed

+87
-21
lines changed

examples/GeoportalControls.ipynb

+17-19
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
"cells": [
33
{
44
"cell_type": "code",
5-
"execution_count": 1,
5+
"execution_count": null,
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, GeoportalElevationPath"
11+
"from ipyleaflet.geoportal import GeoportalWMTS, GeoportalLayerSwitcher, GeoportalSearchEngine, GeoportalRoute, GeoportalMousePosition, GeoportalElevationPath, GeoportalIsocurve"
1212
]
1313
},
1414
{
@@ -76,25 +76,10 @@
7676
},
7777
{
7878
"cell_type": "code",
79-
"execution_count": 2,
79+
"execution_count": null,
8080
"id": "17a9e9bb-f3a5-40e5-90ea-8d57049cda5f",
8181
"metadata": {},
82-
"outputs": [
83-
{
84-
"data": {
85-
"application/vnd.jupyter.widget-view+json": {
86-
"model_id": "de83e395ef634b6da1c061289ceac763",
87-
"version_major": 2,
88-
"version_minor": 0
89-
},
90-
"text/plain": [
91-
"Map(center=[44.799999, 2.26667], controls=(ZoomControl(options=['position', 'zoom_in_text', 'zoom_in_title', '…"
92-
]
93-
},
94-
"metadata": {},
95-
"output_type": "display_data"
96-
}
97-
],
82+
"outputs": [],
9883
"source": [
9984
"#ElevationPath control\n",
10085
"m4 = Map(center=(44.799999, 2.26667), zoom=10, zoom_control=True)\n",
@@ -108,6 +93,19 @@
10893
"id": "88acf040-74f1-419d-a3b8-766b9a538d43",
10994
"metadata": {},
11095
"outputs": [],
96+
"source": [
97+
"#Isocurve control\n",
98+
"m5 = Map(center=(44.799999, 2.26667), zoom=10, zoom_control=True)\n",
99+
"isocurve_control = GeoportalIsocurve()\n",
100+
"m5.add(isocurve_control)"
101+
]
102+
},
103+
{
104+
"cell_type": "code",
105+
"execution_count": null,
106+
"id": "b6ca529f-62dd-4464-ba19-e2f4b5b15df5",
107+
"metadata": {},
108+
"outputs": [],
111109
"source": []
112110
}
113111
],

ipyleaflet/geoportal.py

+11
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,14 @@ class GeoportalElevationPath(Control):
8181

8282
_view_name = Unicode('LeafletGeoportalElevationPathView').tag(sync=True)
8383
_model_name = Unicode('LeafletGeoportalElevationPathModel').tag(sync=True)
84+
85+
86+
class GeoportalIsocurve(Control):
87+
"""GeoportalIsocurve class, with Control as parent class
88+
89+
Attributes
90+
----------
91+
"""
92+
93+
_view_name = Unicode('LeafletGeoportalIsocurveView').tag(sync=True)
94+
_model_name = Unicode('LeafletGeoportalIsocurveModel').tag(sync=True)

js/src/layers/Geoportal.js

+59-2
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,22 @@ export class LeafletGeoportalLayerSwitcherModel extends control.LeafletControlMo
6161
this.map_view = this.options.map_view;
6262
}
6363
create_obj() {
64-
this.obj = L.geoportalControl.SearchEngine({position : "bottomleft"})
64+
this.obj = L.geoportalControl.SearchEngine({
65+
position : "topleft",
66+
collapsed : true,
67+
zoomTo : "auto",
68+
displayInfo : true,
69+
displayAdvancedSearch : true,
70+
resources : ["PositionOfInterest", "StreetAddress"],
71+
advancedSearch : {
72+
PositionOfInterest : [{name : "municipality", title : "Ville"}],
73+
StreetAddress : [{}],
74+
CadastralParcel : null,
75+
},
76+
apiKey : "cartes",
77+
geocodeOptions : {},
78+
autocompleteOptions : {}
79+
})
6580
}
6681
}
6782

@@ -81,7 +96,18 @@ export class LeafletGeoportalLayerSwitcherModel extends control.LeafletControlMo
8196
this.map_view = this.options.map_view;
8297
}
8398
create_obj() {
84-
this.obj = L.geoportalControl.Route({})
99+
this.obj = L.geoportalControl.Route({
100+
position : "bottomleft",
101+
collapsed : true,
102+
exclusions : {
103+
"toll" : true,
104+
"bridge" : false,
105+
"tunnel" : true
106+
},
107+
graphs : ['Pieton', 'Voiture'],
108+
autocompleteOptions : {},
109+
routeOptions : {}
110+
})
85111
}
86112
}
87113

@@ -125,5 +151,36 @@ export class LeafletGeoportalLayerSwitcherModel extends control.LeafletControlMo
125151
}
126152
}
127153

154+
export class LeafletGeoportalIsocurveModel extends control.LeafletControlModel {
155+
defaults() {
156+
return {
157+
...super.defaults(),
158+
_view_name: 'LeafletGeoportalIsocurve',
159+
_model_name: 'LeafletGeoportalIsocurveModel'
160+
};
161+
}
162+
}
163+
164+
export class LeafletGeoportalIsocurveView extends control.LeafletControlView {
165+
initialize(parameters) {
166+
super.initialize(parameters);
167+
this.map_view = this.options.map_view;
168+
}
169+
create_obj() {
170+
this.obj = L.geoportalControl.Isocurve({
171+
collapsed : false,
172+
methods : ["time", "distance"],
173+
exclusions : {
174+
toll : true,
175+
bridge : false,
176+
tunnel : true
177+
},
178+
graphs : ["Pieton", "Voiture"],
179+
isocurveOptions : {},
180+
autocompleteOptions : {}})
181+
}
182+
}
183+
184+
128185

129186

0 commit comments

Comments
 (0)