Skip to content

Commit d6b4259

Browse files
Add Isocurve control.
1 parent f77f1fe commit d6b4259

File tree

3 files changed

+75
-20
lines changed

3 files changed

+75
-20
lines changed

examples/GeoportalControls.ipynb

Lines changed: 17 additions & 19 deletions
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

Lines changed: 11 additions & 0 deletions
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

Lines changed: 47 additions & 1 deletion
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

@@ -125,5 +140,36 @@ export class LeafletGeoportalLayerSwitcherModel extends control.LeafletControlMo
125140
}
126141
}
127142

143+
export class LeafletGeoportalIsocurveModel extends control.LeafletControlModel {
144+
defaults() {
145+
return {
146+
...super.defaults(),
147+
_view_name: 'LeafletGeoportalIsocurve',
148+
_model_name: 'LeafletGeoportalIsocurveModel'
149+
};
150+
}
151+
}
152+
153+
export class LeafletGeoportalIsocurveView extends control.LeafletControlView {
154+
initialize(parameters) {
155+
super.initialize(parameters);
156+
this.map_view = this.options.map_view;
157+
}
158+
create_obj() {
159+
this.obj = L.geoportalControl.Isocurve({
160+
collapsed : false,
161+
methods : ["time", "distance"],
162+
exclusions : {
163+
toll : true,
164+
bridge : false,
165+
tunnel : true
166+
},
167+
graphs : ["Pieton", "Voiture"],
168+
isocurveOptions : {},
169+
autocompleteOptions : {}})
170+
}
171+
}
172+
173+
128174

129175

0 commit comments

Comments
 (0)