Skip to content

Commit

Permalink
Merge pull request #251 from IGNF/vectorTiles_itowns
Browse files Browse the repository at this point in the history
Merge branche vectorTile iTowns : mise à jour d'iTowns pour l'ajout de couche vecteur tuilé via les extensions Géoportail pour iTowns.
  • Loading branch information
elias75015 authored Dec 5, 2019
2 parents a2cbd69 + d748318 commit bca4c22
Show file tree
Hide file tree
Showing 13 changed files with 9,518 additions and 30 deletions.
Binary file not shown.
Binary file modified build/scripts/release/geoportal-extensions-itowns-2.2.4.tgz
Binary file not shown.
56 changes: 28 additions & 28 deletions build/scripts/release/package-itowns.json
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
{
"peerDependencies" : {},
"bugs" : {},
"repository" : {
"url" : "https://github.com/IGNF/geoportal-extensions.git",
"type" : "git"
},
"license" : "CECILL-B",
"author" : "IGNF",
"bundleDependencies" : [],
"directories" : {},
"homepage" : "https://geoservices.ign.fr/documentation/utilisation_web/extension-itowns.html",
"description" : "French Geoportal Extensions for iTowns",
"devDependencies" : {},
"version" : "2.2.4",
"module" : "src/Itowns/index.js",
"name" : "geoportal-extensions-itowns",
"date" : "29/11/2019",
"keywords" : [
"geoportail",
"plugin",
"javascript",
"Itowns"
],
"version" : "2.2.4",
"license" : "CECILL-B",
"directories" : {},
"peerDependencies" : {},
"description" : "French Geoportal Extensions for iTowns",
"scripts" : {},
"devDependencies" : {},
"repository" : {
"type" : "git",
"url" : "https://github.com/IGNF/geoportal-extensions.git"
},
"bugs" : {},
"homepage" : "https://geoservices.ign.fr/documentation/utilisation_web/extension-itowns.html",
"name" : "geoportal-extensions-itowns",
"bundleDependencies" : [],
"dependencies" : {
"loglevel" : "~1.6.1",
"xmldom" : "^0.1.27",
"itowns" : "2.16.0",
"three.meshline" : "~1.2.0",
"geoportal-access-lib" : "^2.1.6",
"sortablejs" : "1.8.4",
"request" : "^2.83.0",
"three" : "~0.109.0",
"proj4" : "2.5.0"
},
"main" : "dist/GpPluginItowns-src.js",
"author" : "IGNF",
"files" : [
"dist/",
"src/",
"LICENCE.md",
"README.md",
"package.json"
],
"dependencies" : {
"request" : "^2.83.0",
"geoportal-access-lib" : "^2.1.6",
"proj4" : "2.5.0",
"three.meshline" : "~1.2.0",
"sortablejs" : "1.8.4",
"three" : "~0.109.0",
"loglevel" : "~1.6.1",
"xmldom" : "^0.1.27",
"itowns" : "2.15.3"
},
"date" : "16/10/2019"
]
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
"dependencies": {
"eventbusjs": "^0.2.0",
"geoportal-access-lib": "^2.1.6",
"itowns": "2.15.3",
"itowns": "2.16.0",
"leaflet": "1.5.1",
"leaflet-draw": "1.0.4",
"loglevel": "~1.6.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ <h2>Ajout d'un contrôle de gestion des couches : LayerSwitcher</h2>
layer: "ELEVATION.ELEVATIONGRIDCOVERAGE",
ssl: true
}));

// Couche WMTS Geoportail
globeView.addLayer(new Gp.itownsExtended.layer.GeoportalWMTS({
layer: "ORTHOIMAGERY.ORTHOPHOTOS",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
{{#extend "layout-itowns-sample-amd"}} {{#content "head"}}
<title>Sample itowns LayerSwitcher</title>
{{/content}} {{#content "style"}}
<style>
html {
height: 100%;
}

body {
margin: 0;
overflow: hidden;
height: 100%;
}

#viewerDiv {
margin: auto auto;
width: 100%;
height: 70%;
padding: 0;
}
</style>
{{/content}} {{#content "body"}}
<h2>Ajout d'un contrôle de gestion des couches : LayerSwitcher</h2>
<!-- map -->
<div id="viewerDiv"></div>
{{/content}} {{#content "js"}}
<script type="text/javascript">
requirejs([
"itowns",
"Gp"
],
function (
itowns,
Gp
) {
var createMap = function () {
/* global itowns,document,GuiTools*/
const positionOnGlobe = { longitude: 2.3465, latitude: 48.88, altitude: 250000 };

// iTowns namespace defined here
const viewerDiv = document.getElementById('viewerDiv');
const globeView = new Gp.itownsExtended.GlobeViewExtended(viewerDiv, positionOnGlobe);

globeView.listen(Gp.itownsExtended.GlobeViewExtended.EVENTS.GLOBE_INITIALIZED, () => {

// ajout des couches
// Couche MNT Geoportail (WMTS)
globeView.addLayer(new Gp.itownsExtended.layer.GeoportalElevation({
layer: "ELEVATION.ELEVATIONGRIDCOVERAGE",
ssl: true
}));

// Couche WMTS Geoportail
globeView.addLayer(new Gp.itownsExtended.layer.GeoportalWMTS({
layer: "ORTHOIMAGERY.ORTHOPHOTOS",
ssl: true
}));

// Ajout couche Vecteur tuilé par itowns (fx: 2.5 => transparent)
var mvtSource = new itowns.VectorTilesSource({
style: '../../resources/itowns/planign.json',
filter: function (layer) { return ['fill', 'line'].includes(layer.type) },
zoom: {
min: 2,
max: 16,
},
});

var mvtLayer = new itowns.ColorLayer('PlanIGN', {
//FIXME wait for next itowns release to remove this
isValidData: function() {
return false;
},
source: mvtSource
//fx: 2.5,
});

globeView.addLayer(mvtLayer);

// ajout du control
var layerSwitcher = new Gp.itownsExtended.control.LayerSwitcher({
options: {
collapsed: true
},
layers: [
{
id: "ORTHOIMAGERY.ORTHOPHOTOS$GEOPORTAIL:OGC:WMTS",
displayed: true,
config: {
title: "Couche de Photos IGN Orthos",
description: "Description de ma couche",
quicklookUrl: "lien/Vers/UnApercuRapide.png",
legends: [
{
url: "lien/Vers/UneLegende.png"
}
],
metadata: [
{
url: "lien/Vers/Une/MetaDonnee.xml"
}
],
visibility: true
}
}
]
});

globeView.addWidget(layerSwitcher);
});
}

Gp.Services.getConfig({
serverUrl : "./../../resources/AutoConf.js",
callbackSuffix : '',
// apiKey: "{{ apikey }}",
timeOut: 20000,
onSuccess: createMap
});
});
</script> {{/content}} {{/extend}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
{{#extend "layout-itowns-sample-amd"}} {{#content "head"}}
<title>Sample itowns LayerSwitcher</title>
{{/content}} {{#content "style"}}
<style>
html {
height: 100%;
}

body {
margin: 0;
overflow: hidden;
height: 100%;
}

#viewerDiv {
margin: auto auto;
width: 100%;
height: 70%;
padding: 0;
}
</style>
{{/content}} {{#content "body"}}
<h2>Ajout d'un contrôle de gestion des couches : LayerSwitcher</h2>
<!-- map -->
<div id="viewerDiv"></div>
{{/content}} {{#content "js"}}
<script type="text/javascript">
requirejs([
"itowns",
"Gp"
],
function (
itowns,
Gp
) {
var createMap = function () {
/* global itowns,document,GuiTools*/
const positionOnGlobe = { longitude: 2.3465, latitude: 48.88, altitude: 250000 };

// iTowns namespace defined here
const viewerDiv = document.getElementById('viewerDiv');
const globeView = new Gp.itownsExtended.GlobeViewExtended(viewerDiv, positionOnGlobe);

globeView.listen(Gp.itownsExtended.GlobeViewExtended.EVENTS.GLOBE_INITIALIZED, () => {

// Couche WMTS Geoportail
globeView.addLayer(new Gp.itownsExtended.layer.GeoportalWMTS({
layer: "ORTHOIMAGERY.ORTHOPHOTOS",
ssl: true
}));

// Couche Vecteur tuilé Geoportail

var vectorTileLayer = new Gp.itownsExtended.layer.VectorTileLayer({
layer: "PLAN.IGN",
id : "MVT",
url: '../../resources/itowns/planign.json',
zoom : {
min: 0,
max: 13
}
})

globeView.addLayer(vectorTileLayer);

// ajout du control
var layerSwitcher = new Gp.itownsExtended.control.LayerSwitcher({
options: {
collapsed: true
},
layers: [
{
id: "ORTHOIMAGERY.ORTHOPHOTOS$GEOPORTAIL:OGC:WMTS",
displayed: true,
config: {
title: "Couche de Photos IGN Orthos",
description: "Description de ma couche",
quicklookUrl: "lien/Vers/UnApercuRapide.png",
legends: [
{
url: "lien/Vers/UneLegende.png"
}
],
metadata: [
{
url: "lien/Vers/Une/MetaDonnee.xml"
}
],
visibility: true
}
}
]
});

globeView.addWidget(layerSwitcher);
});
}

Gp.Services.getConfig({
serverUrl : "./../../resources/AutoConf_VT.js",
callbackSuffix : '',
// apiKey: "{{ apikey }}",
timeOut: 20000,
onSuccess: createMap
});
});
</script> {{/content}} {{/extend}}
14 changes: 14 additions & 0 deletions samples-src/resources/itowns/enseignement.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "Enseignement",
"description": "PAI science et enseignement",
"minzoom": 6,
"maxzoom": 16,
"crs": "EPSG:3857",
"center": [2.463684,48.776024],
"bounds": [2.307129,48.687334,2.620239,48.864715],
"format": "pbf",
"tiles":["https://vectortiles.ign.fr/rok4server/1.0.0/Enseignement/{z}/{x}/{y}.pbf"],
"vector_layers": [
{"id":"Enseignement","geometry":"POINT","maxzoom":"16","minzoom":"6","filedsCount":"10","fields":{"designat_1":{"attribute":"designat_1","count":"62","type":"character varying(80)"},"adresse_po":{"attribute":"adresse_po","count":"61278","type":"character varying(80)"},"nom_d_usag":{"attribute":"nom_d_usag","count":"51253","type":"character varying(200)"},"identifi_1":{"attribute":"identifi_1","count":"78306","type":"character varying(200)"},"ogc_fid":{"attribute":"ogc_fid","count":"100541","type":"integer","min":221885,"max":322425},"insee_comm":{"attribute":"insee_comm","count":"23885","type":"character varying(80)"},"cleabs":{"attribute":"cleabs","count":"100541","type":"character varying(80)"},"nature":{"attribute":"nature","count":"9","type":"character varying(80)","values":["Collège","Autre","Science","Enseignement primaire","Université","Lycée","Enseignement secondaire","Enseignement supérieur"]},"designatio":{"attribute":"designatio","count":"2115","type":"character varying(80)"},"statut":{"attribute":"statut","count":"1","type":"character varying"}}}
]
}
Loading

0 comments on commit bca4c22

Please sign in to comment.