UNPKG

itowns

Version:

A JS/WebGL framework for 3D geospatial data visualization

72 lines (61 loc) 3.08 kB
<html> <head> <title>Itowns - TIFF Parser with tiled images</title> <meta charset="UTF-8"> <link rel="stylesheet" type="text/css" href="css/example.css"> <link rel="stylesheet" type="text/css" href="css/LoadingScreen.css"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <script src="https://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.7.6/dat.gui.min.js"></script> </head> <body> <div id="viewerDiv"></div> <script src="js/GUI/GuiTools.js"></script> <script src="https://cdn.jsdelivr.net/npm/utif@3.1.0/UTIF.js"></script> <script src="../dist/itowns.js"></script> <script src="../dist/debug.js"></script> <script src="js/GUI/LoadingScreen.js"></script> <script src="js/plugins/TIFFParser.js"></script> <script type="text/javascript"> // # Simple Globe viewer // Define initial camera position var placement = { coord: new itowns.Coordinates('EPSG:4326', 1.411667, 43.6074422), range: 25000000, } // `viewerDiv` will contain iTowns' rendering area (`<canvas>`) var viewerDiv = document.getElementById('viewerDiv'); // Instanciate iTowns GlobeView* var view = new itowns.GlobeView(viewerDiv, placement); var menuGlobe = new GuiTools('menuDiv', view); setupLoadingScreen(viewerDiv, view); // Add one imagery layer to the scene, read from TIFFs. var tiffSource = new itowns.TMSSource({ url: 'https://raw.githubusercontent.com/iTowns/iTowns2-sample-data/master/geoid/localcolors/tiff/${z}/localcolors_${x}_${y}.tif', tileMatrixSet: 'WGS84G', crs: 'EPSG:4326', parser: TIFFParser.parse, fetcher: itowns.Fetcher.arrayBuffer, zoom: { min: 0, max: 4 }, }); tiffSource.isInverted = true; var tiffLayer = new itowns.ColorLayer('tiff', { source: tiffSource, }); view.addLayer(tiffLayer).then(menuGlobe.addLayerGUI.bind(menuGlobe)); function addElevationLayerFromConfig(config) { config.source = new itowns.TMSSource(config.source); var layer = new itowns.ElevationLayer(config.id, config); view.addLayer(layer).then(function _(layer) { layer.scale = 10000; view.tileLayer.attachedLayers[0].visible = false; menuGlobe.addLayerGUI(layer); menuGlobe.elevationGui.open(); menuGlobe.elevationGui.__folders.GEOIDMNT.open(); }); } itowns.Fetcher.json('./layers/JSONLayers/GeoidMNT.json').then(addElevationLayerFromConfig); const d = new debug.Debug(view, menuGlobe.gui); debug.createTileDebugUI(menuGlobe.gui, view, view.tileLayer, d); </script> </body> </html>