Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate geoportal extensions leaflet #1042

Open
wants to merge 31 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
7f75233
Integrate geoportal-extensions-leaflet and start with adding a Geopor…
HaudinFlorence Aug 19, 2022
73b052a
Simplify Geoportal.js.
HaudinFlorence Aug 19, 2022
01de98b
Fix flake8 formatting issue.
HaudinFlorence Aug 22, 2022
784d987
Add an example in Geoportal notebook.
HaudinFlorence Aug 22, 2022
ecbd305
Remove WMS related classes in geoportal.py and Geoportal.js.
HaudinFlorence Aug 22, 2022
7b899f0
Change apiKey to api_key for the Python side, change layer_name to la…
HaudinFlorence Aug 23, 2022
c70fb9d
Add the attribute format to enable to set the format of the image of …
HaudinFlorence Aug 23, 2022
1ef06d9
Add the LayerSwitcher control.
HaudinFlorence Aug 23, 2022
6395e6f
Add SearchEngine control.
HaudinFlorence Aug 24, 2022
72b7067
Fix flake8 linting issue.
HaudinFlorence Sep 7, 2022
79b7fde
Add Route control.
HaudinFlorence Sep 7, 2022
6993f0d
Add MousePosition control.
HaudinFlorence Sep 7, 2022
f77f1fe
Add ElevationPath control.
HaudinFlorence Sep 8, 2022
db52eb3
Add Isocurve control.
HaudinFlorence Sep 9, 2022
9a580e8
Separate Geoportal.js between 2 separate files for layers and control…
HaudinFlorence Sep 12, 2022
1c07d05
Update ipyleaflet/geoportal.py
HaudinFlorence Sep 13, 2022
6fe69e9
Update ipyleaflet/geoportal.py
HaudinFlorence Sep 13, 2022
7d4ef08
Update ipyleaflet/geoportal.py
HaudinFlorence Sep 13, 2022
b5d9da4
Update ipyleaflet/geoportal.py
HaudinFlorence Sep 13, 2022
50b00f3
Update ipyleaflet/geoportal.py
HaudinFlorence Sep 13, 2022
74ce5f6
Update ipyleaflet/geoportal.py
HaudinFlorence Sep 13, 2022
c6f76de
Update ipyleaflet/geoportal.py
HaudinFlorence Sep 13, 2022
172d88c
Update ipyleaflet/geoportal.py
HaudinFlorence Sep 13, 2022
3c05e88
Update js/src/controls/GeoportalControls.js
HaudinFlorence Sep 13, 2022
39dafb8
Update or add options of the various controls.
HaudinFlorence Sep 13, 2022
231dacc
Revert "Update or add options of the various controls."
HaudinFlorence Sep 14, 2022
70fe8d6
Update the options of the controls.
HaudinFlorence Sep 14, 2022
3791744
Update options of various controls.
HaudinFlorence Sep 14, 2022
793b1cf
Add ReverseGeoCode control.
HaudinFlorence Sep 14, 2022
6d756c4
Re try CI test
HaudinFlorence Sep 15, 2022
a1585e4
Fix flake8 failingtest.
HaudinFlorence Sep 16, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 86 additions & 0 deletions examples/Geoportal.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "121b2e3e-faa5-4f53-87c9-9a3112440e98",
"metadata": {},
"outputs": [],
"source": [
"# Set up for JupyterLite\n",
"try:\n",
" import piplite\n",
" await piplite.install('ipyleaflet')\n",
"except ImportError:\n",
" pass"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "119aacd7-fb6b-4bf5-9a97-ac8301eabfed",
"metadata": {},
"outputs": [],
"source": [
"from ipyleaflet import *\n",
"from ipyleaflet.geoportal import GeoportalWMTS\n",
"m1 = Map(center=(48.799999, 2.26667), zoom=10, zoom_control=True)\n",
"layer1 = GeoportalWMTS() #default\n",
"m1.add(layer1)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "2936c8dc-1546-4f13-8c18-6984aaf1c0e3",
"metadata": {},
"outputs": [],
"source": [
"m2 = Map(center=(44.400002, 3.36667), zoom=8, zoom_control=True)\n",
"layer2 = GeoportalWMTS(layer_name = 'ELEVATION.SLOPES', apiKey = 'altimetrie')\n",
HaudinFlorence marked this conversation as resolved.
Show resolved Hide resolved
"m2.add(layer2)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "cfeff952-288f-4e56-9dd7-4b7e160e6305",
"metadata": {},
"outputs": [],
"source": [
"m3 = Map(center=(48.799999, 2.26667), zoom=10, zoom_control=True)\n",
"layer3 = GeoportalWMTS(layer_name = 'GEOGRAPHICALGRIDSYSTEMS.PLANIGNV2', apiKey = 'cartes')\n",
HaudinFlorence marked this conversation as resolved.
Show resolved Hide resolved
"m3.add(layer3)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "24a0dda1-4d07-437e-9c39-396176d5fa53",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.5"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
25 changes: 25 additions & 0 deletions ipyleaflet/geoportal.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
#
HaudinFlorence marked this conversation as resolved.
Show resolved Hide resolved


from traitlets import Unicode
from .leaflet import TileLayer


class GeoportalWMTS(TileLayer):
"""GeoportalWMTS class, with TileLayer as parent class


Attributes
----------
layer_name: string, default "ORTHOIMAGERY.ORTHOPHOTOS"
name of the layer to show.
apiKey: string, default "essentiels"
key to access a given ressource, detailed correspondances are given here : https://geoservices.ign.fr/documentation/services/tableau_ressources
"""

_view_name = Unicode('LeafletGeoportalWMTSView').tag(sync=True)
_model_name = Unicode('LeafletGeoportalWMTSModel').tag(sync=True)
layer_name = Unicode("ORTHOIMAGERY.ORTHOPHOTOS").tag(sync=True, o=True)
apiKey = Unicode("essentiels").tag(sync=True, o=True)
HaudinFlorence marked this conversation as resolved.
Show resolved Hide resolved
4 changes: 3 additions & 1 deletion js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@
"proj4": "^2.6.0",
"proj4leaflet": "^1.0.1",
"spin.js": "^4.1.0",
"stream-browserify": "^3.0.0"
"stream-browserify": "^3.0.0",
"geoportal-extensions-leaflet": "2.2.4"

},
"devDependencies": {
"@jupyterlab/builder": "^3.0.0",
Expand Down
1 change: 1 addition & 0 deletions js/src/jupyter-leaflet.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export * from './layers/LayerGroup.js';
export * from './layers/FeatureGroup.js';
export * from './layers/GeoJSON.js';
export * from './layers/DivIcon.js';
export * from './layers/Geoportal.js';

//Controls
export * from './controls/AttributionControl.js';
Expand Down
25 changes: 25 additions & 0 deletions js/src/layers/Geoportal.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.

const L = require('../leaflet.js');
const layer = require('./TileLayer.js');
const utils = require('../utils');

export class LeafletGeoportalWMTSModel extends layer.LeafletTileLayerModel {
defaults() {
return {
...super.defaults(),
_view_name: 'LeafletGeoportalWMTSView',
_model_name: 'LeafletGeoportalWMTSModel',
layer_name : "ORTHOIMAGERY.ORTHOPHOTOS",
HaudinFlorence marked this conversation as resolved.
Show resolved Hide resolved
apiKey : "essentiels"
};
}
}

export class LeafletGeoportalWMTSView extends layer.LeafletTileLayerView {
create_obj() {
this.obj = L.geoportalLayer.WMTS({layer : this.model.get('layer_name'), apiKey : this.model.get('apiKey')})
HaudinFlorence marked this conversation as resolved.
Show resolved Hide resolved
}
}

1 change: 1 addition & 0 deletions js/src/leaflet.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ require('leaflet-fullscreen');
require('leaflet-transform');
require('leaflet.awesome-markers');
require('leaflet-search');
require('geoportal-extensions-leaflet')

// Monkey patch GridLayer for smoother URL updates
L.patchGridLayer = function (layer) {
Expand Down