diff --git a/examples/cubic_planar.html b/examples/cubic_planar.html index 5a0d72db86..6be4008fbd 100644 --- a/examples/cubic_planar.html +++ b/examples/cubic_planar.html @@ -30,6 +30,7 @@ var obj; var offset; var tileLayer; + var config; var wmsLayers = [ 'fpc_fond_plan_communaut.fpcilot', @@ -108,42 +109,49 @@ parent.add(obj); obj.updateMatrixWorld(true); - tileLayer = itowns.createPlanarLayer('planar' + wms + index, extent, { object3d: obj }); - tileLayer.disableSkirt = true; + config = { + object3d: obj, + // Since the elevation layer use color textures, specify min/max z + materialOptions: { + useColorTextureElevation: true, + colorTextureElevationMinZ: -600, + colorTextureElevationMaxZ: 400, + }, + disableSkirt: true, + }; + + tileLayer = itowns.createPlanarLayer('planar' + wms + index, extent, config); view.addLayer(tileLayer); view.addLayer({ - url: 'https://download.data.grandlyon.com/wms/grandlyon', - networkOptions: { crossOrigin: 'anonymous' }, type: 'color', - protocol: 'wms', - version: '1.3.0', id: 'wms_imagery' + wms + index, - name: wms, - projection: 'EPSG:3946', - format: 'image/jpeg', + source: { + protocol: 'wms', + url: 'https://download.data.grandlyon.com/wms/grandlyon', + version: '1.3.0', + name: wms, + projection: 'EPSG:3946', + format: 'image/jpeg', + extent, + }, }, tileLayer); view.addLayer({ - url: 'https://download.data.grandlyon.com/wms/grandlyon', - type: 'elevation', - protocol: 'wms', - networkOptions: { crossOrigin: 'anonymous' }, - version: '1.3.0', id: 'wms_elevation' + wms + index, - name: 'MNT2012_Altitude_10m_CC46', - projection: 'EPSG:3946', - heightMapWidth: 256, - format: 'image/jpeg', + type: 'elevation', + source: { + protocol: 'wms', + extent, + version: '1.3.0', + name: 'MNT2012_Altitude_10m_CC46', + projection: 'EPSG:3946', + heightMapWidth: 256, + format: 'image/jpeg', + url: 'https://download.data.grandlyon.com/wms/grandlyon', + }, }, tileLayer); - - // Since the elevation layer use color textures, specify min/max z - tileLayer.materialOptions = { - useColorTextureElevation: true, - colorTextureElevationMinZ: -600, - colorTextureElevationMaxZ: 400, - }; } // Since PlanarView doesn't create default controls, we manipulate directly three.js camera diff --git a/examples/globe_geojson_to3D.html b/examples/globe_geojson_to3D.html new file mode 100644 index 0000000000..dc9b4daa1f --- /dev/null +++ b/examples/globe_geojson_to3D.html @@ -0,0 +1,80 @@ + + + Itowns - Globe + geoson to 3d + + + + + + + + +
+ +
+ + + + + + + + + diff --git a/examples/globe_vector.html b/examples/globe_vector.html index 3c9383e3be..39b7395f2b 100644 --- a/examples/globe_vector.html +++ b/examples/globe_vector.html @@ -43,6 +43,7 @@ diff --git a/examples/globe_vector_tiles.html b/examples/globe_vector_tiles.html index 4282206fa0..d76e99c950 100644 --- a/examples/globe_vector_tiles.html +++ b/examples/globe_vector_tiles.html @@ -33,6 +33,8 @@ // define pole texture view.wgs84TileLayer.noTextureColor = new itowns.THREE.Color(0x95c1e1); + view.atmosphere.visible = false; + setupLoadingScreen(viewerDiv, view); function addLayerCb(layer) { return view.addLayer(layer); @@ -40,8 +42,9 @@ // Add two elevation layers. // These will deform iTowns globe geometry to represent terrain elevation. - promises.push(itowns.Fetcher.json('./layers/JSONLayers/WORLD_DTM.json').then(addLayerCb)); - promises.push(itowns.Fetcher.json('./layers/JSONLayers/IGN_MNT_HIGHRES.json').then(addLayerCb)); + // promises.push(itowns.Fetcher.json('./layers/JSONLayers/Ortho.json').then(addLayerCb)); + // promises.push(itowns.Fetcher.json('./layers/JSONLayers/WORLD_DTM.json').then(addLayerCb)); + // promises.push(itowns.Fetcher.json('./layers/JSONLayers/IGN_MNT_HIGHRES.json').then(addLayerCb)); // Add a vector tile layer itowns.Fetcher.json('https://raw.githubusercontent.com/Oslandia/postile-openmaptiles/master/style.json').then(function (style) { @@ -56,14 +59,21 @@ } }); + function isValidData(data, extentDestination) { + return extentDestination.zoom - data.extent.zoom < 4; + } + promises.push(view.addLayer({ type: 'color', - protocol: 'xyz', id: 'MVT', - // eslint-disable-next-line no-template-curly-in-string - url: 'https://osm.oslandia.io/data/v3/${z}/${x}/${y}.pbf', - format: 'application/x-protobuf;type=mapbox-vector', - options: { + isValidData: isValidData, + source: { + protocol: 'xyz', + // eslint-disable-next-line no-template-curly-in-string + url: 'https://osm.oslandia.io/data/v3/${z}/${x}/${y}.pbf', + format: 'application/x-protobuf;type=mapbox-vector', + projection: 'EPSG:4326', + origin: 'top', attribution: { name: 'OpenStreetMap', url: 'http://www.openstreetmap.org/', @@ -72,10 +82,7 @@ min: 2, max: 14, }, - opacity: 0.5, - }, - updateStrategy: { - type: itowns.STRATEGY_DICHOTOMY, + tileMatrixSet: 'PM', }, style: mapboxStyle, filter: mapboxFilter(supportedLayers), @@ -89,6 +96,7 @@ Promise.all(promises).then(function () { menuGlobe.addImageryLayersGUI(view.getLayers(function (l) { return l.type === 'color'; })); menuGlobe.addElevationLayersGUI(view.getLayers(function (l) { return l.type === 'elevation'; })); + // itowns.ColorLayersOrdering.moveLayerToIndex(view, 'Ortho', 0); }).catch(console.error); }); diff --git a/examples/globe_wfs_color.html b/examples/globe_wfs_color.html new file mode 100644 index 0000000000..3c4738638b --- /dev/null +++ b/examples/globe_wfs_color.html @@ -0,0 +1,96 @@ + + + Itowns - Globe WFS color + + + + + + + + + +
+ + + + +
+

Information Batiment

+ +
+ + + diff --git a/examples/globe_wfs_extruded.html b/examples/globe_wfs_extruded.html index 4c332d57e8..ca5bff671b 100644 --- a/examples/globe_wfs_extruded.html +++ b/examples/globe_wfs_extruded.html @@ -91,6 +91,7 @@ globeView.addLayer({ name: 'lyon_tcl_bus', + id: 'WFS Bus lines', type: 'geometry', update: itowns.FeatureProcessing.update, convert: itowns.Feature2Mesh.convert({ @@ -98,20 +99,22 @@ altitude: altitudeLine }), linewidth: 5, filter: acceptFeatureBus, - url: 'https://download.data.grandlyon.com/wfs/rdata?', - protocol: 'wfs', - version: '2.0.0', - id: 'WFS Bus lines', - typeName: 'tcl_sytral.tcllignebus', - level: 9, - projection: 'EPSG:3946', - extent: { - west: 1822174.60, - east: 1868247.07, - south: 5138876.75, - north: 5205890.19, - }, - format: 'geojson', + source: { + protocol: 'wfs', + url: 'https://download.data.grandlyon.com/wfs/rdata?', + version: '2.0.0', + typeName: 'tcl_sytral.tcllignebus', + projection: 'EPSG:3946', + extent: { + west: 1822174.60, + east: 1868247.07, + south: 5138876.75, + north: 5205890.19, + }, + zoom: { min: 9, max: 9 }, + format: 'geojson', + networkOptions: { crossOrigin: 'anonymous' }, + } }); function colorBuildings(properties) { @@ -154,6 +157,7 @@ globeView.addFrameRequester(itowns.MAIN_LOOP_EVENTS.BEFORE_RENDER, scaler); globeView.addLayer({ + id: 'WFS Buildings', type: 'geometry', update: itowns.FeatureProcessing.update, convert: itowns.Feature2Mesh.convert({ @@ -165,16 +169,23 @@ meshes.push(mesh); }, filter: acceptFeature, - url: 'http://wxs.ign.fr/72hpsel8j8nhb5qgdh07gcyp/geoportail/wfs?', - networkOptions: { crossOrigin: 'anonymous' }, - protocol: 'wfs', - version: '2.0.0', - id: 'WFS Buildings', - typeName: 'BDTOPO_BDD_WLD_WGS84G:bati_remarquable,BDTOPO_BDD_WLD_WGS84G:bati_indifferencie,BDTOPO_BDD_WLD_WGS84G:bati_industriel', - level: 14, - projection: 'EPSG:4326', - ipr: 'IGN', - format: 'application/json', + source: { + url: 'http://wxs.ign.fr/72hpsel8j8nhb5qgdh07gcyp/geoportail/wfs?', + networkOptions: { crossOrigin: 'anonymous' }, + protocol: 'wfs', + version: '2.0.0', + typeName: 'BDTOPO_BDD_WLD_WGS84G:bati_remarquable,BDTOPO_BDD_WLD_WGS84G:bati_indifferencie,BDTOPO_BDD_WLD_WGS84G:bati_industriel', + projection: 'EPSG:4326', + ipr: 'IGN', + format: 'application/json', + zoom: { min: 14, max: 14 }, + extent: { + west: 4.568, + east: 5.18, + south: 45.437, + north: 46.03, + }, + } }); function configPointMaterial(result) { @@ -217,16 +228,23 @@ size: 5, onMeshCreated: configPointMaterial, filter: selectRoad, - url: 'http://wxs.ign.fr/72hpsel8j8nhb5qgdh07gcyp/geoportail/wfs?', - networkOptions: { crossOrigin: 'anonymous' }, - protocol: 'wfs', - version: '2.0.0', - id: 'WFS Route points', - typeName: 'BDPR_BDD_FXX_LAMB93_20170911:pr', - level: 12, - projection: 'EPSG:2154', - ipr: 'IGN', - format: 'application/json', + source: { + url: 'http://wxs.ign.fr/72hpsel8j8nhb5qgdh07gcyp/geoportail/wfs?', + networkOptions: { crossOrigin: 'anonymous' }, + protocol: 'wfs', + version: '2.0.0', + id: 'WFS Route points', + typeName: 'BDPR_BDD_FXX_LAMB93_20170911:pr', + zoom: { min: 12, max: 12 }, + projection: 'EPSG:2154', + ipr: 'IGN', + format: 'application/json', + extent: new itowns.Extent('EPSG:4326', + -5.160007066832147, + 10.671941031325312, + 41.338373237911036, + 51.07519774631159).as('EPSG:2154'), + } }); var menuGlobe = new GuiTools('menuDiv', globeView); @@ -260,12 +278,12 @@ } for (let layer of globeView.getLayers()) { - if (layer.id === 'WFS Bus lines') { - layer.whenReady.then( function _(layer) { - var gui = debug.GeometryDebug.createGeometryDebugUI(menuGlobe.gui, globeView, layer); - debug.GeometryDebug.addMaterialLineWidth(gui, globeView, layer, 1, 10); - }); - } + // if (layer.id === 'WFS Bus lines') { + // layer.whenReady.then( function _(layer) { + // var gui = debug.GeometryDebug.createGeometryDebugUI(menuGlobe.gui, globeView, layer); + // debug.GeometryDebug.addMaterialLineWidth(gui, globeView, layer, 1, 10); + // }); + // } if (layer.id === 'WFS Buildings') { layer.whenReady.then( function _(layer) { var gui = debug.GeometryDebug.createGeometryDebugUI(menuGlobe.gui, globeView, layer); @@ -273,12 +291,12 @@ window.addEventListener('mousemove', picking, false); }); } - if (layer.id === 'WFS Route points') { - layer.whenReady.then( function _(layer) { - var gui = debug.GeometryDebug.createGeometryDebugUI(menuGlobe.gui, globeView, layer); - debug.GeometryDebug.addMaterialSize(gui, globeView, layer, 1, 50); - }); - } + // if (layer.id === 'WFS Route points') { + // layer.whenReady.then( function _(layer) { + // var gui = debug.GeometryDebug.createGeometryDebugUI(menuGlobe.gui, globeView, layer); + // debug.GeometryDebug.addMaterialSize(gui, globeView, layer, 1, 50); + // }); + // } } diff --git a/examples/index.html b/examples/index.html index 1576dfc1a7..8dd3af9425 100644 --- a/examples/index.html +++ b/examples/index.html @@ -147,6 +147,17 @@

synchronisation cameras with Ca +
+

wfs source to color layer

+ + +
+
+

geojson to geometry layer

+ + +
+