itowns 2.36.2 → 2.37.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTRIBUTING.md +30 -17
- package/changelog.md +52 -0
- package/dist/debug.js +1 -1
- package/dist/debug.js.LICENSE.txt +1 -1
- package/dist/debug.js.map +1 -1
- package/dist/itowns.js +1 -1
- package/dist/itowns.js.map +1 -1
- package/dist/itowns_widgets.js +2 -0
- package/dist/itowns_widgets.js.map +1 -0
- package/examples/config.json +25 -6
- package/examples/css/widgets.css +248 -0
- package/examples/geoid_geoidLayer.html +102 -0
- package/examples/images/compass.svg +60 -0
- package/examples/images/widget-logo.svg +66 -0
- package/examples/itowns-potree.html +252 -0
- package/examples/js/GUI/GuiTools.js +17 -0
- package/examples/js/Scale.js +1 -0
- package/examples/source_file_from_fetched_data.html +90 -0
- package/examples/source_file_from_format.html +85 -0
- package/examples/source_file_from_methods.html +87 -0
- package/examples/source_file_from_parsed_data.html +104 -0
- package/examples/source_file_geojson_raster.html +21 -45
- package/examples/source_file_gpx_raster.html +28 -36
- package/examples/source_file_kml_raster.html +1 -4
- package/examples/source_file_shapefile.html +39 -34
- package/examples/source_stream_wfs_25d.html +21 -13
- package/examples/source_stream_wfs_3d.html +21 -12
- package/examples/source_stream_wfs_raster.html +20 -20
- package/examples/view_immersive.html +13 -14
- package/examples/widgets_minimap.html +122 -0
- package/examples/widgets_navigation.html +119 -0
- package/lib/Controls/GlobeControls.js +13 -0
- package/lib/Controls/PlanarControls.js +1 -1
- package/lib/Converter/convertToTile.js +5 -1
- package/lib/Core/3DTiles/C3DTBoundingVolume.js +4 -1
- package/lib/Core/Deprecated/Undeprecator.js +1 -1
- package/lib/Core/Feature.js +3 -4
- package/lib/Core/Geographic/Extent.js +1 -1
- package/lib/Core/Geographic/GeoidGrid.js +143 -0
- package/lib/Core/MainLoop.js +1 -1
- package/lib/Core/Math/Ellipsoid.js +1 -1
- package/lib/Core/Prefab/Globe/SkyShader.js +3 -1
- package/lib/Core/Prefab/Planar/PlanarLayer.js +3 -1
- package/lib/Core/Style.js +1 -1
- package/lib/Core/TileGeometry.js +3 -1
- package/lib/Core/TileMesh.js +11 -17
- package/lib/Core/View.js +40 -2
- package/lib/Layer/ElevationLayer.js +6 -2
- package/lib/Layer/FeatureGeometryLayer.js +3 -1
- package/lib/Layer/GeoidLayer.js +131 -0
- package/lib/Layer/InfoLayer.js +1 -1
- package/lib/Layer/Layer.js +1 -1
- package/lib/Layer/LayerUpdateStrategy.js +1 -1
- package/lib/Layer/PotreeLayer.js +3 -1
- package/lib/Layer/TiledGeometryLayer.js +3 -1
- package/lib/Main.js +214 -174
- package/lib/MainBundle.js +1 -1
- package/lib/Parser/B3dmParser.js +2 -1
- package/lib/Parser/GDFParser.js +118 -0
- package/lib/Parser/GTXParser.js +92 -0
- package/lib/Parser/ISGParser.js +121 -0
- package/lib/Parser/LASParser.js +3 -1
- package/lib/Parser/XbilParser.js +1 -1
- package/lib/Process/3dTilesProcessing.js +2 -2
- package/lib/Process/FeatureProcessing.js +3 -1
- package/lib/Process/LayeredMaterialNodeProcessing.js +7 -4
- package/lib/Provider/URLBuilder.js +1 -1
- package/lib/Renderer/LayeredMaterial.js +2 -2
- package/lib/Renderer/OBB.js +18 -25
- package/lib/Renderer/PointsMaterial.js +5 -6
- package/lib/Renderer/RasterTile.js +1 -1
- package/lib/Renderer/Shader/ShaderUtils.js +4 -2
- package/lib/Source/C3DTilesSource.js +3 -1
- package/lib/Source/EntwinePointTileSource.js +3 -1
- package/lib/Source/PotreeSource.js +3 -1
- package/lib/Source/Source.js +15 -10
- package/lib/Source/WMTSSource.js +3 -1
- package/lib/ThreeExtended/loaders/GLTFLoader.js +85 -35
- package/lib/Utils/CameraUtils.js +11 -1
- package/lib/Utils/DEMUtils.js +1 -1
- package/lib/Utils/FeaturesUtils.js +8 -4
- package/package.json +25 -25
|
@@ -57,8 +57,8 @@
|
|
|
57
57
|
itowns.Fetcher.json('./layers/JSONLayers/IGN_MNT_HIGHRES.json').then(addElevationLayerFromConfig);
|
|
58
58
|
|
|
59
59
|
|
|
60
|
-
// Display the content of
|
|
61
|
-
// The
|
|
60
|
+
// Display the content of two GeoJSON files on terrain with ColorLayer and FileSource.
|
|
61
|
+
// The GeoJSONs are loaded from url, set in FileSource
|
|
62
62
|
|
|
63
63
|
// Declare the source for the data on Ariege area
|
|
64
64
|
const ariegeSource = new itowns.FileSource({
|
|
@@ -85,37 +85,18 @@
|
|
|
85
85
|
view.addLayer(ariegeLayer).then(FeatureToolTip.addLayer);
|
|
86
86
|
|
|
87
87
|
|
|
88
|
-
//
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
// The second parameter of the `parse` method we use here defines options for the transformation from
|
|
101
|
-
// data to FeatureCollection.
|
|
102
|
-
return itowns.GeoJsonParser.parse(geojson, {
|
|
103
|
-
// Information on the fetched data.
|
|
104
|
-
// See http://www.itowns-project.org/itowns/docs/#api/Source/ParsingOptions.
|
|
105
|
-
in: {
|
|
106
|
-
crs: 'EPSG:4326',
|
|
107
|
-
},
|
|
108
|
-
// Information on the FeatureCollection that should be created from the fetched data
|
|
109
|
-
// Here, we pass a FeatureBuildingOptions (http://www.itowns-project.org/itowns/docs/#api/Base/FeatureBuildingOptions)
|
|
110
|
-
out: {
|
|
111
|
-
crs: view.tileLayer.extent.crs,
|
|
112
|
-
},
|
|
113
|
-
});
|
|
114
|
-
}).then(function _(features) {
|
|
115
|
-
// Create a FileSource from the parsed FeatureCollection.
|
|
116
|
-
var pyoSource = new itowns.FileSource({ features });
|
|
117
|
-
|
|
118
|
-
var pyoStyle = new itowns.Style({
|
|
88
|
+
// Declare the source for the data on Pyrenees Orientales area
|
|
89
|
+
const pyoSource = new itowns.FileSource({
|
|
90
|
+
url: 'https://raw.githubusercontent.com/gregoiredavid/france-geojson/master/departements/66-pyrenees-orientales/departement-66-pyrenees-orientales.geojson',
|
|
91
|
+
crs: 'EPSG:4326',
|
|
92
|
+
format: 'application/json',
|
|
93
|
+
});
|
|
94
|
+
// Create a ColorLayer for the Pyrenees Orientales area
|
|
95
|
+
const pyoLayer = new itowns.ColorLayer('pyrenees-orientales', {
|
|
96
|
+
name: 'pyrenees-orientales',
|
|
97
|
+
transparent: true,
|
|
98
|
+
source: pyoSource,
|
|
99
|
+
style: new itowns.Style({
|
|
119
100
|
fill: {
|
|
120
101
|
pattern: 'images/cross.png',
|
|
121
102
|
opacity: 0.8,
|
|
@@ -123,21 +104,16 @@
|
|
|
123
104
|
stroke: {
|
|
124
105
|
color:'IndianRed',
|
|
125
106
|
},
|
|
126
|
-
})
|
|
107
|
+
}),
|
|
108
|
+
});
|
|
109
|
+
// Add The Pyrennees Orientales ColorLayer to the view and grant it a tooltip
|
|
110
|
+
view.addLayer(pyoLayer).then(FeatureToolTip.addLayer);
|
|
127
111
|
|
|
128
|
-
// Create a ColorLayer to display the FeatureCollection.
|
|
129
|
-
var pyoLayer = new itowns.ColorLayer('pyrenees-orientales', {
|
|
130
|
-
name: 'pyrenees-orientales',
|
|
131
|
-
transparent: true,
|
|
132
|
-
source: pyoSource,
|
|
133
|
-
style: pyoStyle,
|
|
134
|
-
});
|
|
135
112
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
// Center the camera on the data extents
|
|
113
|
+
// Center the camera on the data extents
|
|
114
|
+
view.addEventListener(itowns.GLOBE_VIEW_EVENTS.GLOBE_INITIALIZED, function () {
|
|
139
115
|
const layersExtent = ariegeSource.extent.clone();
|
|
140
|
-
layersExtent.union(
|
|
116
|
+
layersExtent.union(pyoSource.extent);
|
|
141
117
|
view.controls.lookAtCoordinate(layersExtent, false);
|
|
142
118
|
});
|
|
143
119
|
|
|
@@ -57,45 +57,37 @@
|
|
|
57
57
|
itowns.Fetcher.json('./layers/JSONLayers/WORLD_DTM.json').then(addElevationLayerFromConfig);
|
|
58
58
|
itowns.Fetcher.json('./layers/JSONLayers/IGN_MNT_HIGHRES.json').then(addElevationLayerFromConfig);
|
|
59
59
|
|
|
60
|
-
// Parse and Convert by iTowns
|
|
61
|
-
itowns.Fetcher.xml('https://raw.githubusercontent.com/iTowns/iTowns2-sample-data/master/ULTRA2009.gpx')
|
|
62
|
-
.then(function _(gpx) {
|
|
63
|
-
var gpxStyle = new itowns.Style({
|
|
64
|
-
zoom: {
|
|
65
|
-
min: 9,
|
|
66
|
-
},
|
|
67
|
-
stroke: {
|
|
68
|
-
color: 'red',
|
|
69
|
-
},
|
|
70
|
-
point: {
|
|
71
|
-
color: 'white',
|
|
72
|
-
line: 'red',
|
|
73
|
-
},
|
|
74
|
-
text: {
|
|
75
|
-
field: '{name}',
|
|
76
|
-
transform: 'uppercase',
|
|
77
|
-
font: ['Arial', 'sans-serif'],
|
|
78
|
-
haloColor: 'white',
|
|
79
|
-
haloWidth: 1,
|
|
80
|
-
},
|
|
81
|
-
});
|
|
82
60
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
61
|
+
const gpxSource = new itowns.FileSource({
|
|
62
|
+
url: 'https://raw.githubusercontent.com/iTowns/iTowns2-sample-data/master/ULTRA2009.gpx',
|
|
63
|
+
crs: 'EPSG:4326',
|
|
64
|
+
format: 'application/gpx',
|
|
65
|
+
});
|
|
88
66
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
67
|
+
const gpxStyle = new itowns.Style({
|
|
68
|
+
zoom: { min: 9 },
|
|
69
|
+
stroke: { color: 'red' },
|
|
70
|
+
point: {
|
|
71
|
+
color: 'white',
|
|
72
|
+
line: 'red',
|
|
73
|
+
},
|
|
74
|
+
text: {
|
|
75
|
+
field: '{name}',
|
|
76
|
+
transform: 'uppercase',
|
|
77
|
+
font: ['Arial', 'sans-serif'],
|
|
78
|
+
haloColor: 'white',
|
|
79
|
+
haloWidth: 1,
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
const gpxLayer = new itowns.ColorLayer('Gpx', {
|
|
84
|
+
source: gpxSource,
|
|
85
|
+
style: gpxStyle,
|
|
86
|
+
addLabelLayer: true,
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
view.addLayer(gpxLayer);
|
|
96
90
|
|
|
97
|
-
return view.addLayer(gpxLayer);
|
|
98
|
-
});
|
|
99
91
|
|
|
100
92
|
debug.createTileDebugUI(menuGlobe.gui, view);
|
|
101
93
|
</script>
|
|
@@ -60,8 +60,7 @@
|
|
|
60
60
|
var kmlSource = new itowns.FileSource({
|
|
61
61
|
url: 'https://raw.githubusercontent.com/iTowns/iTowns2-sample-data/master/croquis.kml',
|
|
62
62
|
crs: 'EPSG:4326',
|
|
63
|
-
|
|
64
|
-
parser: itowns.KMLParser.parse,
|
|
63
|
+
format: 'application/kml',
|
|
65
64
|
});
|
|
66
65
|
|
|
67
66
|
var kmlStyle = new itowns.Style({
|
|
@@ -78,8 +77,6 @@
|
|
|
78
77
|
});
|
|
79
78
|
|
|
80
79
|
var kmlLayer = new itowns.ColorLayer('Kml', {
|
|
81
|
-
name: 'kml',
|
|
82
|
-
transparent: true,
|
|
83
80
|
source: kmlSource,
|
|
84
81
|
style: kmlStyle,
|
|
85
82
|
addLabelLayer: true,
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
// `viewerDiv` will contain iTowns' rendering area (`<canvas>`)
|
|
26
26
|
var viewerDiv = document.getElementById('viewerDiv');
|
|
27
27
|
|
|
28
|
-
//
|
|
28
|
+
// Instantiate iTowns GlobeView*
|
|
29
29
|
var view = new itowns.GlobeView(viewerDiv, placement);
|
|
30
30
|
var menuGlobe = new GuiTools('menuDiv', view);
|
|
31
31
|
|
|
@@ -41,47 +41,52 @@
|
|
|
41
41
|
view.addLayer(layer).then(menuGlobe.addLayerGUI.bind(menuGlobe));
|
|
42
42
|
});
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
// As there is no Shapefile fetcher directly bundled within iTowns, we need to specify a method to fetch data.
|
|
47
|
+
// We use here `multiple` fetcher, which can fetch multiple files within multiple formats.
|
|
48
|
+
itowns.Fetcher.multiple(
|
|
49
|
+
'https://raw.githubusercontent.com/iTowns/iTowns2-sample-data/master/shapefile/velib-disponibilite-en-temps-reel',
|
|
50
|
+
{
|
|
51
|
+
// fetch all files whose name match the `url` parameter value, and whose format is either `shp`,
|
|
52
|
+
// `dbf`, `shx` or `prj`.
|
|
53
|
+
arrayBuffer: ['shp', 'dbf', 'shx'],
|
|
54
|
+
text: ['prj'],
|
|
55
|
+
},
|
|
56
|
+
).then((fetched) => {
|
|
57
|
+
// Once our Shapefile data is fetched, we can parse it by running itowns built-in Shapefile parser.
|
|
58
|
+
return itowns.ShapefileParser.parse(fetched, {
|
|
59
|
+
// Options indicating how the features should be built from data.
|
|
51
60
|
out: {
|
|
61
|
+
// Specitfy the crs to convert the input coordinates to.
|
|
52
62
|
crs: view.tileLayer.extent.crs,
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
}).then(function _(features) {
|
|
56
|
-
var velibSource = new itowns.FileSource({ features });
|
|
57
|
-
|
|
58
|
-
var velibStyle = new itowns.Style({
|
|
59
|
-
zoom: { min: 10, max: 20 },
|
|
60
|
-
point: {
|
|
61
|
-
color: 'white',
|
|
62
|
-
line: 'green',
|
|
63
|
-
},
|
|
64
|
-
text: {
|
|
65
|
-
field: '{name}\n(id: {station_id})',
|
|
66
|
-
size: 14,
|
|
67
|
-
haloColor: 'white',
|
|
68
|
-
haloWidth: 1,
|
|
69
|
-
font: ['monospace'],
|
|
70
63
|
},
|
|
71
64
|
});
|
|
65
|
+
}).then((parsed) => {
|
|
66
|
+
// We can then instantiate a FileSource, passing the parsed data,
|
|
67
|
+
// and create a Layer bound to this source.
|
|
68
|
+
const velibSource = new itowns.FileSource({ features: parsed });
|
|
72
69
|
|
|
73
|
-
|
|
70
|
+
return view.addLayer(new itowns.ColorLayer('velib', {
|
|
74
71
|
source: velibSource,
|
|
75
|
-
style:
|
|
72
|
+
style: new itowns.Style({
|
|
73
|
+
zoom: { min: 10, max: 20 },
|
|
74
|
+
point: { color: 'white', line: 'green' },
|
|
75
|
+
text: {
|
|
76
|
+
field: '{name}\n(id: {station_id})',
|
|
77
|
+
size: 14,
|
|
78
|
+
haloColor: 'white',
|
|
79
|
+
haloWidth: 1,
|
|
80
|
+
font: ['monospace'],
|
|
81
|
+
}
|
|
82
|
+
}),
|
|
76
83
|
addLabelLayer: true,
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
return view.addLayer(velibLayer);
|
|
82
|
-
}).then(function _(layer) {
|
|
84
|
+
}));
|
|
85
|
+
}).then((layer => {
|
|
86
|
+
// Finally, we generate tooltip for when the mouse hovers the data displayed within our created layer.
|
|
83
87
|
FeatureToolTip.addLayer(layer, { filterAllProperties: false });
|
|
84
|
-
});
|
|
88
|
+
}));
|
|
89
|
+
|
|
85
90
|
</script>
|
|
86
91
|
</body>
|
|
87
92
|
</html>
|
|
@@ -163,13 +163,19 @@
|
|
|
163
163
|
view.addLayer(lyonTclBusLayer);
|
|
164
164
|
|
|
165
165
|
function colorBuildings(properties) {
|
|
166
|
-
if (properties.
|
|
167
|
-
return color.set(
|
|
166
|
+
if (properties.usage_1 === 'Résidentiel') {
|
|
167
|
+
return color.set(0xFDFDFF);
|
|
168
|
+
} else if (properties.usage_1 === 'Annexe') {
|
|
169
|
+
return color.set(0xC6C5B9);
|
|
170
|
+
} else if (properties.usage_1 === 'Commercial et services') {
|
|
171
|
+
return color.set(0x62929E);
|
|
172
|
+
} else if (properties.usage_1 === 'Religieux') {
|
|
173
|
+
return color.set(0x393D3F);
|
|
174
|
+
} else if (properties.usage_1 === 'Sportif') {
|
|
175
|
+
return color.set(0x546A7B);
|
|
168
176
|
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
}
|
|
172
|
-
return color.set(0xeeeeee);
|
|
177
|
+
|
|
178
|
+
return color.set(0x555555);
|
|
173
179
|
}
|
|
174
180
|
|
|
175
181
|
function extrudeBuildings(properties) {
|
|
@@ -177,7 +183,7 @@
|
|
|
177
183
|
}
|
|
178
184
|
|
|
179
185
|
function altitudeBuildings(properties) {
|
|
180
|
-
return properties.
|
|
186
|
+
return properties.altitude_minimale_sol;
|
|
181
187
|
}
|
|
182
188
|
|
|
183
189
|
meshes = [];
|
|
@@ -203,9 +209,9 @@
|
|
|
203
209
|
view.addFrameRequester(itowns.MAIN_LOOP_EVENTS.BEFORE_RENDER, scaler);
|
|
204
210
|
|
|
205
211
|
var wfsBuildingSource = new itowns.WFSSource({
|
|
206
|
-
url: 'https://wxs.ign.fr/
|
|
212
|
+
url: 'https://wxs.ign.fr/topographie/geoportail/wfs?',
|
|
207
213
|
version: '2.0.0',
|
|
208
|
-
typeName: '
|
|
214
|
+
typeName: 'BDTOPO_V3:batiment',
|
|
209
215
|
crs: 'EPSG:4326',
|
|
210
216
|
ipr: 'IGN',
|
|
211
217
|
format: 'application/json',
|
|
@@ -282,10 +288,12 @@
|
|
|
282
288
|
properties = intersects[0].object.feature.geometries[batchId].properties;
|
|
283
289
|
Object.keys(properties).map(function (objectKey) {
|
|
284
290
|
var value = properties[objectKey];
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
291
|
+
if (value) {
|
|
292
|
+
var key = objectKey.toString();
|
|
293
|
+
if (key[0] !== '_' && key !== 'geometry_name') {
|
|
294
|
+
info = value.toString();
|
|
295
|
+
htmlInfo.innerHTML +='<li><b>' + key + ': </b>' + info + '</li>';
|
|
296
|
+
}
|
|
289
297
|
}
|
|
290
298
|
});
|
|
291
299
|
return properties;
|
|
@@ -127,16 +127,23 @@
|
|
|
127
127
|
view.addLayer(lyonTclBusLayer);
|
|
128
128
|
|
|
129
129
|
function colorBuildings(properties) {
|
|
130
|
-
if (properties.
|
|
131
|
-
return color.set(
|
|
132
|
-
} else if (properties.
|
|
133
|
-
return color.set(
|
|
130
|
+
if (properties.usage_1 === 'Résidentiel') {
|
|
131
|
+
return color.set(0xFDFDFF);
|
|
132
|
+
} else if (properties.usage_1 === 'Annexe') {
|
|
133
|
+
return color.set(0xC6C5B9);
|
|
134
|
+
} else if (properties.usage_1 === 'Commercial et services') {
|
|
135
|
+
return color.set(0x62929E);
|
|
136
|
+
} else if (properties.usage_1 === 'Religieux') {
|
|
137
|
+
return color.set(0x393D3F);
|
|
138
|
+
} else if (properties.usage_1 === 'Sportif') {
|
|
139
|
+
return color.set(0x546A7B);
|
|
134
140
|
}
|
|
135
|
-
|
|
141
|
+
|
|
142
|
+
return color.set(0x555555);
|
|
136
143
|
}
|
|
137
144
|
|
|
138
145
|
function altitudeBuildings(properties) {
|
|
139
|
-
return properties.
|
|
146
|
+
return properties.altitude_minimale_sol;
|
|
140
147
|
}
|
|
141
148
|
|
|
142
149
|
function extrudeBuildings(properties) {
|
|
@@ -167,9 +174,9 @@
|
|
|
167
174
|
view.addFrameRequester(itowns.MAIN_LOOP_EVENTS.BEFORE_RENDER, scaler);
|
|
168
175
|
|
|
169
176
|
var wfsBuildingSource = new itowns.WFSSource({
|
|
170
|
-
url: 'https://wxs.ign.fr/
|
|
177
|
+
url: 'https://wxs.ign.fr/topographie/geoportail/wfs?',
|
|
171
178
|
version: '2.0.0',
|
|
172
|
-
typeName: '
|
|
179
|
+
typeName: 'BDTOPO_V3:batiment',
|
|
173
180
|
crs: 'EPSG:4326',
|
|
174
181
|
ipr: 'IGN',
|
|
175
182
|
format: 'application/json',
|
|
@@ -228,10 +235,12 @@
|
|
|
228
235
|
|
|
229
236
|
Object.keys(properties).map(function (objectKey) {
|
|
230
237
|
var value = properties[objectKey];
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
238
|
+
if (value) {
|
|
239
|
+
var key = objectKey.toString();
|
|
240
|
+
if (key[0] !== '_' && key !== 'geometry_name') {
|
|
241
|
+
info = value.toString();
|
|
242
|
+
htmlInfo.innerHTML +='<li><b>' + key + ': </b>' + info + '</li>';
|
|
243
|
+
}
|
|
235
244
|
}
|
|
236
245
|
});
|
|
237
246
|
}
|
|
@@ -60,9 +60,9 @@
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
var wfsBuildingSource = new itowns.WFSSource({
|
|
63
|
-
url: 'https://wxs.ign.fr/
|
|
63
|
+
url: 'https://wxs.ign.fr/topographie/geoportail/wfs?',
|
|
64
64
|
version: '2.0.0',
|
|
65
|
-
typeName: '
|
|
65
|
+
typeName: 'BDTOPO_V3:batiment',
|
|
66
66
|
crs: 'EPSG:4326',
|
|
67
67
|
extent: {
|
|
68
68
|
west: 4.568,
|
|
@@ -74,31 +74,31 @@
|
|
|
74
74
|
format: 'application/json',
|
|
75
75
|
});
|
|
76
76
|
|
|
77
|
+
function colorBuildings(properties) {
|
|
78
|
+
if (properties.usage_1 === 'Résidentiel') {
|
|
79
|
+
return '#FDFDFF';
|
|
80
|
+
} else if (properties.usage_1 === 'Annexe') {
|
|
81
|
+
return '#C6C5B9';
|
|
82
|
+
} else if (properties.usage_1 === 'Commercial et services') {
|
|
83
|
+
return '#62929E';
|
|
84
|
+
} else if (properties.usage_1 === 'Religieux') {
|
|
85
|
+
return '#393D3F';
|
|
86
|
+
} else if (properties.usage_1 === 'Sportif') {
|
|
87
|
+
return '#546A7B';
|
|
88
|
+
} else {
|
|
89
|
+
return '#555555';
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
77
93
|
var wfsBuildingLayer = new itowns.ColorLayer('wfsBuilding', {
|
|
78
94
|
transparent: true,
|
|
79
95
|
style: {
|
|
80
96
|
fill: {
|
|
81
|
-
color:
|
|
82
|
-
if (p.geojson.id.indexOf('bati_remarquable') === 0) {
|
|
83
|
-
return '#5555ff';
|
|
84
|
-
}
|
|
85
|
-
if (p.geojson.id.indexOf('bati_industriel') === 0) {
|
|
86
|
-
return '#ff5555';
|
|
87
|
-
}
|
|
88
|
-
return '#eeeeee';
|
|
89
|
-
},
|
|
97
|
+
color: colorBuildings,
|
|
90
98
|
opacity: 0.7
|
|
91
99
|
},
|
|
92
100
|
stroke: {
|
|
93
|
-
color:
|
|
94
|
-
if (p.geojson.id.indexOf('bati_remarquable') === 0) {
|
|
95
|
-
return '#8888ff';
|
|
96
|
-
}
|
|
97
|
-
if (p.geojson.id.indexOf('bati_industriel') === 0) {
|
|
98
|
-
return '#ff8888';
|
|
99
|
-
}
|
|
100
|
-
return '#ffffff';
|
|
101
|
-
},
|
|
101
|
+
color: colorBuildings,
|
|
102
102
|
width: 2.0,
|
|
103
103
|
},
|
|
104
104
|
},
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
|
|
81
81
|
function altitudeBuildings(properties) {
|
|
82
82
|
// I set altitude building 3 meters down, to be sure building is anchored in the ground
|
|
83
|
-
return properties.
|
|
83
|
+
return properties.altitude_minimale_sol - 3;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
function extrudeBuildings(properties) {
|
|
@@ -115,22 +115,21 @@
|
|
|
115
115
|
|
|
116
116
|
// when oriented image layer is ready..
|
|
117
117
|
view.addLayer(olayer, view.tileLayer).then(function addWfsLayer(orientedImageLayer) {
|
|
118
|
-
|
|
119
118
|
// prepare WFS source for the buildings
|
|
120
119
|
var wfsBuildingSource = new itowns.WFSSource({
|
|
121
|
-
url: 'https://wxs.ign.fr/
|
|
120
|
+
url: 'https://wxs.ign.fr/topographie/geoportail/wfs?',
|
|
122
121
|
version: '2.0.0',
|
|
123
|
-
typeName: '
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
122
|
+
typeName: 'BDTOPO_V3:batiment',
|
|
123
|
+
crs: 'EPSG:4326',
|
|
124
|
+
ipr: 'IGN',
|
|
125
|
+
format: 'application/json',
|
|
126
|
+
extent: {
|
|
127
|
+
west: 2.334,
|
|
128
|
+
east: 2.335,
|
|
129
|
+
south: 48.849,
|
|
130
|
+
north: 48.851,
|
|
131
|
+
},
|
|
132
|
+
});
|
|
134
133
|
|
|
135
134
|
// create geometry layer for the buildings
|
|
136
135
|
var wfsBuildingLayer = new itowns.FeatureGeometryLayer('Buildings', {
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
<html>
|
|
2
|
+
<head>
|
|
3
|
+
<title>Itowns - Minimap widget</title>
|
|
4
|
+
|
|
5
|
+
<meta charset="UTF-8">
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
7
|
+
|
|
8
|
+
<link rel="stylesheet" type="text/css" href="css/example.css">
|
|
9
|
+
<link rel="stylesheet" type="text/css" href="css/LoadingScreen.css">
|
|
10
|
+
|
|
11
|
+
<!-- Import stylesheet for itowns Widgets plugin -->
|
|
12
|
+
<link rel="stylesheet" type="text/css" href="css/widgets.css">
|
|
13
|
+
|
|
14
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.7.6/dat.gui.min.js"></script>
|
|
15
|
+
</head>
|
|
16
|
+
<body>
|
|
17
|
+
<!-- Add a description -->
|
|
18
|
+
<div id="description">
|
|
19
|
+
Double click on the minimap to travel to the cursor location.
|
|
20
|
+
</div>
|
|
21
|
+
|
|
22
|
+
<!-- Create a container for itowns viewer -->
|
|
23
|
+
<div id="viewerDiv"></div>
|
|
24
|
+
|
|
25
|
+
<!-- Import iTowns source code -->
|
|
26
|
+
<script src="../dist/itowns.js"></script>
|
|
27
|
+
<script src="../dist/debug.js"></script>
|
|
28
|
+
<!-- Import iTowns Widgets plugin -->
|
|
29
|
+
<script src="../dist/itowns_widgets.js"></script>
|
|
30
|
+
<!-- Import iTowns LoadingScreen and GuiTools plugins -->
|
|
31
|
+
<script src="js/GUI/LoadingScreen.js"></script>
|
|
32
|
+
<script src="js/GUI/GuiTools.js"></script>
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
<script type="text/javascript">
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
// ---------- CREATE A GlobeView FOR SUPPORTING DATA VISUALIZATION : ----------
|
|
40
|
+
|
|
41
|
+
// Define camera initial position
|
|
42
|
+
const placement = {
|
|
43
|
+
coord: new itowns.Coordinates('EPSG:4326', 2.351323, 48.856712),
|
|
44
|
+
range: 6000,
|
|
45
|
+
tilt: 50,
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// `viewerDiv` contains iTowns' rendering area (`<canvas>`)
|
|
49
|
+
const viewerDiv = document.getElementById('viewerDiv');
|
|
50
|
+
|
|
51
|
+
// Create a GlobeView
|
|
52
|
+
const view = new itowns.GlobeView(viewerDiv, placement);
|
|
53
|
+
|
|
54
|
+
// Setup loading screen and debug menu
|
|
55
|
+
setupLoadingScreen(viewerDiv, view);
|
|
56
|
+
const debugMenu = new GuiTools('menuDiv', view);
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
// ---------- DISPLAY CONTEXTUAL DATA : ----------
|
|
61
|
+
|
|
62
|
+
// Add one imagery layer to the scene. This layer's properties are defined in a json file, but it could be
|
|
63
|
+
// defined as a plain js object. See `Layer` documentation for more info.
|
|
64
|
+
itowns.Fetcher.json('layers/JSONLayers/Ortho.json').then((config) => {
|
|
65
|
+
config.source = new itowns.WMTSSource(config.source);
|
|
66
|
+
view.addLayer(
|
|
67
|
+
new itowns.ColorLayer(config.id, config),
|
|
68
|
+
).then(debugMenu.addLayerGUI.bind(debugMenu));
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
// Add two elevation layers, each with a different level of detail. Here again, each layer's properties are
|
|
72
|
+
// defined in a json file.
|
|
73
|
+
function addElevationLayerFromConfig(config) {
|
|
74
|
+
config.source = new itowns.WMTSSource(config.source);
|
|
75
|
+
view.addLayer(
|
|
76
|
+
new itowns.ElevationLayer(config.id, config),
|
|
77
|
+
).then(debugMenu.addLayerGUI.bind(debugMenu));
|
|
78
|
+
}
|
|
79
|
+
itowns.Fetcher.json('layers/JSONLayers/WORLD_DTM.json').then(addElevationLayerFromConfig);
|
|
80
|
+
itowns.Fetcher.json('layers/JSONLayers/IGN_MNT_HIGHRES.json').then(addElevationLayerFromConfig);
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
// ---------- ADD MINIMAP WIDGET : ----------
|
|
85
|
+
|
|
86
|
+
// Create a ColorLayer that shall be displayed on the minimap.
|
|
87
|
+
const minimapColorLayer = new itowns.ColorLayer('minimap', {
|
|
88
|
+
source: new itowns.VectorTilesSource({
|
|
89
|
+
style: 'https://wxs.ign.fr/essentiels/static/vectorTiles/styles/PLAN.IGN/standard.json',
|
|
90
|
+
// We don't display mountains and plot related data to ease visualisation
|
|
91
|
+
filter: (layer) => !layer['source-layer'].includes('oro_')
|
|
92
|
+
&& !layer['source-layer'].includes('parcellaire'),
|
|
93
|
+
}),
|
|
94
|
+
addLabelLayer: true,
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
// Create a minimap.
|
|
98
|
+
const minimap = new itowns_widgets.Minimap(view, minimapColorLayer, {
|
|
99
|
+
cursor: '+',
|
|
100
|
+
size: 200,
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
// ---------- ADD INTERACTION WITH MINIMAP : ----------
|
|
106
|
+
|
|
107
|
+
// When double-clicking the minimap, travel to the cursor location.
|
|
108
|
+
const cursorCoordinates = new itowns.Coordinates(minimap.view.referenceCrs);
|
|
109
|
+
minimap.domElement.addEventListener('dblclick', (event) => {
|
|
110
|
+
minimap.view.pickCoordinates(event, cursorCoordinates);
|
|
111
|
+
view.controls.lookAtCoordinate({ coord: cursorCoordinates });
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
// ---------- DEBUG TOOLS : ----------
|
|
117
|
+
|
|
118
|
+
debug.createTileDebugUI(debugMenu.gui, view);
|
|
119
|
+
|
|
120
|
+
</script>
|
|
121
|
+
</body>
|
|
122
|
+
</html>
|