itowns 2.35.0 → 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/CONTRIBUTORS.md +1 -0
- package/changelog.md +146 -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/3dtiles_basic.html +2 -2
- 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/js/plugins/CSVnVRTParser.js +0 -1
- package/examples/layers/JSONLayers/Administrative.json +1 -1
- package/examples/layers/JSONLayers/Cada.json +1 -1
- package/examples/layers/JSONLayers/EtatMajor.json +1 -1
- package/examples/layers/JSONLayers/IGN_MNT.json +1 -1
- package/examples/layers/JSONLayers/IGN_MNT_HIGHRES.json +1 -1
- package/examples/layers/JSONLayers/WORLD_DTM.json +1 -1
- package/examples/misc_custom_label.html +0 -2
- package/examples/plugins_vrt.html +0 -1
- 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 -48
- 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 -35
- package/examples/source_stream_wfs_25d.html +29 -29
- package/examples/source_stream_wfs_3d.html +21 -12
- package/examples/source_stream_wfs_raster.html +20 -20
- package/examples/view_25d_map.html +28 -0
- package/examples/view_immersive.html +13 -14
- package/examples/view_multi_25d.html +1 -1
- package/examples/widgets_minimap.html +122 -0
- package/examples/widgets_navigation.html +119 -0
- package/lib/Controls/FirstPersonControls.js +10 -1
- package/lib/Controls/GlobeControls.js +26 -11
- package/lib/Controls/PlanarControls.js +1 -1
- package/lib/Converter/Feature2Mesh.js +1 -0
- package/lib/Converter/Feature2Texture.js +2 -2
- package/lib/Converter/convertToTile.js +6 -2
- package/lib/Core/3DTiles/C3DTBoundingVolume.js +4 -1
- package/lib/Core/Deprecated/Undeprecator.js +1 -1
- package/lib/Core/Feature.js +42 -42
- package/lib/Core/Geographic/Coordinates.js +56 -0
- package/lib/Core/Geographic/Crs.js +15 -0
- package/lib/Core/Geographic/Extent.js +100 -12
- package/lib/Core/Geographic/GeoidGrid.js +143 -0
- package/lib/Core/MainLoop.js +1 -1
- package/lib/Core/Math/Ellipsoid.js +27 -9
- package/lib/Core/Prefab/Globe/BuilderEllipsoidTile.js +1 -1
- package/lib/Core/Prefab/Globe/SkyShader.js +3 -1
- package/lib/Core/Prefab/Planar/PlanarLayer.js +3 -1
- package/lib/Core/Prefab/PlanarView.js +1 -1
- package/lib/Core/Style.js +2 -1
- package/lib/Core/TileGeometry.js +3 -1
- package/lib/Core/TileMesh.js +11 -16
- package/lib/Core/View.js +43 -5
- package/lib/Layer/ElevationLayer.js +15 -18
- package/lib/Layer/FeatureGeometryLayer.js +3 -1
- package/lib/Layer/GeoidLayer.js +131 -0
- package/lib/Layer/InfoLayer.js +1 -1
- package/lib/Layer/LabelLayer.js +7 -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/ShapefileParser.js +0 -1
- package/lib/Parser/VectorTileParser.js +1 -1
- package/lib/Parser/XbilParser.js +1 -1
- package/lib/Process/3dTilesProcessing.js +10 -10
- package/lib/Process/FeatureProcessing.js +3 -1
- package/lib/Process/LayeredMaterialNodeProcessing.js +7 -4
- package/lib/Process/ObjectRemovalHelper.js +5 -2
- package/lib/Provider/URLBuilder.js +1 -1
- package/lib/Renderer/Label2DRenderer.js +14 -11
- package/lib/Renderer/LayeredMaterial.js +4 -3
- package/lib/Renderer/OBB.js +20 -27
- package/lib/Renderer/PointsMaterial.js +5 -6
- package/lib/Renderer/RasterTile.js +23 -5
- package/lib/Renderer/Shader/ShaderChunk.js +3 -3
- 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/FileSource.js +2 -7
- package/lib/Source/PotreeSource.js +3 -1
- package/lib/Source/Source.js +15 -10
- package/lib/Source/VectorTilesSource.js +19 -0
- package/lib/Source/WMTSSource.js +3 -1
- package/lib/ThreeExtended/loaders/GLTFLoader.js +239 -98
- package/lib/Utils/CameraUtils.js +12 -2
- package/lib/Utils/DEMUtils.js +3 -3
- package/lib/Utils/FeaturesUtils.js +8 -4
- package/package.json +25 -25
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
<html>
|
|
2
|
+
<head>
|
|
3
|
+
<title>Itowns - Source - fetcher and parser</title>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<link rel="stylesheet" type="text/css" href="css/example.css">
|
|
6
|
+
<link rel="stylesheet" type="text/css" href="css/LoadingScreen.css">
|
|
7
|
+
|
|
8
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
9
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.7.6/dat.gui.min.js"></script>
|
|
10
|
+
</head>
|
|
11
|
+
<body>
|
|
12
|
+
<div id="viewerDiv" class="viewer"></div>
|
|
13
|
+
<script src="js/GUI/GuiTools.js"></script>
|
|
14
|
+
<script src="../dist/itowns.js"></script>
|
|
15
|
+
<script src="../dist/debug.js"></script>
|
|
16
|
+
<script src="js/GUI/LoadingScreen.js"></script>
|
|
17
|
+
<script src="js/plugins/FeatureToolTip.js"></script>
|
|
18
|
+
<script type="text/javascript">
|
|
19
|
+
/* global itowns, setupLoadingScreen, GuiTools, ToolTip */
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
// ---------- CREATE A GlobeView : ----------
|
|
24
|
+
|
|
25
|
+
// Define camera initial position
|
|
26
|
+
const placement = {
|
|
27
|
+
coord: new itowns.Coordinates('EPSG:4326', 3.05, 48.95),
|
|
28
|
+
range: 70000,
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
// `viewerDiv` will contain iTowns' rendering area (`<canvas>`)
|
|
32
|
+
const viewerDiv = document.getElementById('viewerDiv');
|
|
33
|
+
|
|
34
|
+
// Instantiate iTowns GlobeView
|
|
35
|
+
const view = new itowns.GlobeView(viewerDiv, placement);
|
|
36
|
+
|
|
37
|
+
// Setup loading screen and debug menu
|
|
38
|
+
setupLoadingScreen(viewerDiv, view);
|
|
39
|
+
const debugMenu = new GuiTools('menuDiv', view);
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
// ---------- DISPLAY CONTEXTUAL DATA : ----------
|
|
44
|
+
|
|
45
|
+
// Add one imagery layer to the scene
|
|
46
|
+
// This layer is defined in a json file but it could be defined as a plain js
|
|
47
|
+
// object. See Layer* for more info.
|
|
48
|
+
itowns.Fetcher.json('./layers/JSONLayers/Ortho.json').then(function _(config) {
|
|
49
|
+
config.source = new itowns.WMTSSource(config.source);
|
|
50
|
+
var layer = new itowns.ColorLayer('Ortho', config);
|
|
51
|
+
view.addLayer(layer).then(debugMenu.addLayerGUI.bind(debugMenu));
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
// ---------- DEFINE DATA SOURCE SPECIFYING FETCHER AND PARSER METHODS : ----------
|
|
57
|
+
|
|
58
|
+
const sourceFromFetcherAndParser = new itowns.FileSource({
|
|
59
|
+
url: 'https://raw.githubusercontent.com/iTowns/iTowns2-sample-data/master/lyon-hydro.geojson',
|
|
60
|
+
crs: 'EPSG:4326',
|
|
61
|
+
// Specify fetcher and parser methods. Should you implement some custom ones, they would need to be called here.
|
|
62
|
+
fetcher: itowns.Fetcher.json,
|
|
63
|
+
parser: itowns.GeoJsonParser.parse,
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
view.addLayer(new itowns.ColorLayer('Hydro', {
|
|
67
|
+
source: sourceFromFetcherAndParser,
|
|
68
|
+
style: new itowns.Style({
|
|
69
|
+
fill: { color: 'cyan', opacity: 0.5 },
|
|
70
|
+
stroke: { color: 'blue',},
|
|
71
|
+
}),
|
|
72
|
+
})).then(debugMenu.addLayerGUI.bind(debugMenu));
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
// ---------- REORDER ColorLayers AND MOVE CAMERA : ----------
|
|
77
|
+
|
|
78
|
+
view.addEventListener(itowns.GLOBE_VIEW_EVENTS.GLOBE_INITIALIZED, function () {
|
|
79
|
+
// Organize the order with which layers are superposing.
|
|
80
|
+
itowns.ColorLayersOrdering.moveLayerToIndex(view, 'Ortho', 0);
|
|
81
|
+
// Move the camera to visualize all data.
|
|
82
|
+
view.controls.lookAtCoordinate(sourceFromFetcherAndParser.extent, false);
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
</script>
|
|
86
|
+
</body>
|
|
87
|
+
</html>
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
<html>
|
|
2
|
+
<head>
|
|
3
|
+
<title>Itowns - FileSource - Handle parsing step</title>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<link rel="stylesheet" type="text/css" href="css/example.css">
|
|
6
|
+
<link rel="stylesheet" type="text/css" href="css/LoadingScreen.css">
|
|
7
|
+
|
|
8
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
9
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.7.6/dat.gui.min.js"></script>
|
|
10
|
+
</head>
|
|
11
|
+
<body>
|
|
12
|
+
<div id="viewerDiv" class="viewer"></div>
|
|
13
|
+
<script src="js/GUI/GuiTools.js"></script>
|
|
14
|
+
<script src="../dist/itowns.js"></script>
|
|
15
|
+
<script src="../dist/debug.js"></script>
|
|
16
|
+
<script src="js/GUI/LoadingScreen.js"></script>
|
|
17
|
+
<script src="js/plugins/FeatureToolTip.js"></script>
|
|
18
|
+
<script type="text/javascript">
|
|
19
|
+
/* global itowns, setupLoadingScreen, GuiTools, ToolTip */
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
// ---------- CREATE A GlobeView : ----------
|
|
24
|
+
|
|
25
|
+
// Define camera initial position
|
|
26
|
+
const placement = {
|
|
27
|
+
coord: new itowns.Coordinates('EPSG:4326', 3.05, 48.95),
|
|
28
|
+
range: 70000,
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
// `viewerDiv` will contain iTowns' rendering area (`<canvas>`)
|
|
32
|
+
const viewerDiv = document.getElementById('viewerDiv');
|
|
33
|
+
|
|
34
|
+
// Instantiate iTowns GlobeView
|
|
35
|
+
const view = new itowns.GlobeView(viewerDiv, placement);
|
|
36
|
+
|
|
37
|
+
// Setup loading screen and debug menu
|
|
38
|
+
setupLoadingScreen(viewerDiv, view);
|
|
39
|
+
const debugMenu = new GuiTools('menuDiv', view);
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
// ---------- DISPLAY CONTEXTUAL DATA : ----------
|
|
44
|
+
|
|
45
|
+
// Add one imagery layer to the scene
|
|
46
|
+
// This layer is defined in a json file but it could be defined as a plain js
|
|
47
|
+
// object. See Layer* for more info.
|
|
48
|
+
itowns.Fetcher.json('./layers/JSONLayers/Ortho.json').then(function _(config) {
|
|
49
|
+
config.source = new itowns.WMTSSource(config.source);
|
|
50
|
+
var layer = new itowns.ColorLayer('Ortho', config);
|
|
51
|
+
view.addLayer(layer).then(debugMenu.addLayerGUI.bind(debugMenu));
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
// ---------- DEFINE DATA SOURCE FROM PARSED DATA : ----------
|
|
57
|
+
|
|
58
|
+
// Handle fetching step.
|
|
59
|
+
// Should you implement a custom fetcher, it would need to be called here.
|
|
60
|
+
itowns.Fetcher.json(
|
|
61
|
+
'https://raw.githubusercontent.com/iTowns/iTowns2-sample-data/master/lyon-trains.geojson',
|
|
62
|
+
).then((fetched) => {
|
|
63
|
+
// Handle parsing step.
|
|
64
|
+
// We parse the fetched data into a FeatureCollection.
|
|
65
|
+
// See http://www.itowns-project.org/itowns/docs/#api/Base/FeatureCollection.
|
|
66
|
+
// Should you implement a custom parser, it would need to be called here.
|
|
67
|
+
return itowns.GeoJsonParser.parse(fetched, {
|
|
68
|
+
// Information on the fetched data.
|
|
69
|
+
// See http://www.itowns-project.org/itowns/docs/#api/Source/ParsingOptions.
|
|
70
|
+
in: {
|
|
71
|
+
crs: 'EPSG:4326',
|
|
72
|
+
},
|
|
73
|
+
// Information on the FeatureCollection that should be created from the fetched data. Here, we pass a
|
|
74
|
+
// FeatureBuildingOptions (http://www.itowns-project.org/itowns/docs/#api/Base/FeatureBuildingOptions).
|
|
75
|
+
out: {
|
|
76
|
+
crs: view.tileLayer.extent.crs,
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
}).then((parsed) => {
|
|
80
|
+
// Finally, define a FileSource from the parsed data
|
|
81
|
+
const sourceFromParsedData = new itowns.FileSource({ features: parsed });
|
|
82
|
+
|
|
83
|
+
view.addLayer(new itowns.ColorLayer('Trains', {
|
|
84
|
+
source: sourceFromParsedData,
|
|
85
|
+
style: new itowns.Style({
|
|
86
|
+
stroke: { color: 'black', width: 2 },
|
|
87
|
+
}),
|
|
88
|
+
})).then(debugMenu.addLayerGUI.bind(debugMenu));
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
// ---------- REORDER ColorLayers AND MOVE CAMERA : ----------
|
|
94
|
+
|
|
95
|
+
view.addEventListener(itowns.GLOBE_VIEW_EVENTS.GLOBE_INITIALIZED, function () {
|
|
96
|
+
// Organize the order with which layers are superposing.
|
|
97
|
+
itowns.ColorLayersOrdering.moveLayerToIndex(view, 'Ortho', 0);
|
|
98
|
+
// Move the camera to visualize all data.
|
|
99
|
+
view.controls.lookAtCoordinate(view.getLayerById('Trains').source.extent, false);
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
</script>
|
|
103
|
+
</body>
|
|
104
|
+
</html>
|
|
@@ -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,40 +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
|
-
buildExtent: true,
|
|
113
|
-
mergeFeatures: true,
|
|
114
|
-
structure: '2d',
|
|
115
|
-
},
|
|
116
|
-
});
|
|
117
|
-
}).then(function _(features) {
|
|
118
|
-
// Create a FileSource from the parsed FeatureCollection.
|
|
119
|
-
var pyoSource = new itowns.FileSource({ features });
|
|
120
|
-
|
|
121
|
-
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({
|
|
122
100
|
fill: {
|
|
123
101
|
pattern: 'images/cross.png',
|
|
124
102
|
opacity: 0.8,
|
|
@@ -126,21 +104,16 @@
|
|
|
126
104
|
stroke: {
|
|
127
105
|
color:'IndianRed',
|
|
128
106
|
},
|
|
129
|
-
})
|
|
107
|
+
}),
|
|
108
|
+
});
|
|
109
|
+
// Add The Pyrennees Orientales ColorLayer to the view and grant it a tooltip
|
|
110
|
+
view.addLayer(pyoLayer).then(FeatureToolTip.addLayer);
|
|
130
111
|
|
|
131
|
-
// Create a ColorLayer to display the FeatureCollection.
|
|
132
|
-
var pyoLayer = new itowns.ColorLayer('pyrenees-orientales', {
|
|
133
|
-
name: 'pyrenees-orientales',
|
|
134
|
-
transparent: true,
|
|
135
|
-
source: pyoSource,
|
|
136
|
-
style: pyoStyle,
|
|
137
|
-
});
|
|
138
112
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
// 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 () {
|
|
142
115
|
const layersExtent = ariegeSource.extent.clone();
|
|
143
|
-
layersExtent.union(
|
|
116
|
+
layersExtent.union(pyoSource.extent);
|
|
144
117
|
view.controls.lookAtCoordinate(layersExtent, false);
|
|
145
118
|
});
|
|
146
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,48 +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
|
-
buildExtent: true,
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
}).then(function _(features) {
|
|
57
|
-
var velibSource = new itowns.FileSource({ features });
|
|
58
|
-
|
|
59
|
-
var velibStyle = new itowns.Style({
|
|
60
|
-
zoom: { min: 10, max: 20 },
|
|
61
|
-
point: {
|
|
62
|
-
color: 'white',
|
|
63
|
-
line: 'green',
|
|
64
|
-
},
|
|
65
|
-
text: {
|
|
66
|
-
field: '{name}\n(id: {station_id})',
|
|
67
|
-
size: 14,
|
|
68
|
-
haloColor: 'white',
|
|
69
|
-
haloWidth: 1,
|
|
70
|
-
font: ['monospace'],
|
|
71
63
|
},
|
|
72
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 });
|
|
73
69
|
|
|
74
|
-
|
|
70
|
+
return view.addLayer(new itowns.ColorLayer('velib', {
|
|
75
71
|
source: velibSource,
|
|
76
|
-
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
|
+
}),
|
|
77
83
|
addLabelLayer: true,
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
return view.addLayer(velibLayer);
|
|
83
|
-
}).then(function _(layer) {
|
|
84
|
+
}));
|
|
85
|
+
}).then((layer => {
|
|
86
|
+
// Finally, we generate tooltip for when the mouse hovers the data displayed within our created layer.
|
|
84
87
|
FeatureToolTip.addLayer(layer, { filterAllProperties: false });
|
|
85
|
-
});
|
|
88
|
+
}));
|
|
89
|
+
|
|
86
90
|
</script>
|
|
87
91
|
</body>
|
|
88
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',
|
|
@@ -242,40 +248,32 @@
|
|
|
242
248
|
view.addLayer(wfsBuildingLayer);
|
|
243
249
|
|
|
244
250
|
var wfsCartoSource = new itowns.WFSSource({
|
|
245
|
-
url: 'https://wxs.ign.fr/
|
|
251
|
+
url: 'https://wxs.ign.fr/cartovecto/geoportail/wfs?',
|
|
246
252
|
version: '2.0.0',
|
|
247
|
-
typeName: 'BDCARTO_BDD_WLD_WGS84G:
|
|
248
|
-
crs: 'EPSG:
|
|
253
|
+
typeName: 'BDCARTO_BDD_WLD_WGS84G:zone_habitat_mairie',
|
|
254
|
+
crs: 'EPSG:3946',
|
|
249
255
|
ipr: 'IGN',
|
|
250
256
|
format: 'application/json',
|
|
251
|
-
extent: {
|
|
252
|
-
west: 4.568,
|
|
253
|
-
east: 5.18,
|
|
254
|
-
south: 45.437,
|
|
255
|
-
north: 46.03,
|
|
256
|
-
},
|
|
257
257
|
});
|
|
258
258
|
|
|
259
259
|
var wfsCartoStyle = new itowns.Style({
|
|
260
260
|
zoom: { min: 0, max: 20 },
|
|
261
261
|
text: {
|
|
262
262
|
field: '{toponyme}',
|
|
263
|
+
color: 'white',
|
|
263
264
|
transform: 'uppercase',
|
|
264
|
-
size:
|
|
265
|
-
haloColor: '
|
|
266
|
-
haloWidth:
|
|
265
|
+
size: 15,
|
|
266
|
+
haloColor: 'rgba(20,20,20, 0.8)',
|
|
267
|
+
haloWidth: 3,
|
|
267
268
|
},
|
|
268
269
|
});
|
|
269
270
|
|
|
270
271
|
var wfsCartoLayer = new itowns.LabelLayer('wfsCarto', {
|
|
271
|
-
crs: 'EPSG:3946',
|
|
272
272
|
source: wfsCartoSource,
|
|
273
273
|
style: wfsCartoStyle,
|
|
274
274
|
});
|
|
275
275
|
|
|
276
|
-
|
|
277
|
-
// Search for "zone_habitat" in this page https://wxs.ign.fr/3ht7xcw6f7nciopo16etuqp2/geoportail/wfs?SERVICE=WFS&REQUEST=GetCapabilities
|
|
278
|
-
// view.addLayer(wfsCartoLayer);
|
|
276
|
+
view.addLayer(wfsCartoLayer);
|
|
279
277
|
|
|
280
278
|
function picking(event) {
|
|
281
279
|
var htmlInfo = document.getElementById('info');
|
|
@@ -290,10 +288,12 @@
|
|
|
290
288
|
properties = intersects[0].object.feature.geometries[batchId].properties;
|
|
291
289
|
Object.keys(properties).map(function (objectKey) {
|
|
292
290
|
var value = properties[objectKey];
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
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
|
+
}
|
|
297
297
|
}
|
|
298
298
|
});
|
|
299
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
|
}
|