Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
@loaders.gl/terrain
Advanced tools
@loaders.gl/terrain is a module within the loaders.gl suite that provides tools for loading and parsing terrain data. It supports various terrain formats and can be used to integrate terrain data into web applications, particularly those involving 3D visualization and geographic information systems (GIS).
Loading Terrain Data
This feature allows you to load terrain data from a specified URL using the TerrainLoader. The loaded data can then be used for further processing or visualization.
const {TerrainLoader} = require('@loaders.gl/terrain');
const {load} = require('@loaders.gl/core');
async function loadTerrain(url) {
const terrainData = await load(url, TerrainLoader);
console.log(terrainData);
}
loadTerrain('https://example.com/terrain-data.terrain');
Parsing Terrain Data
This feature allows you to parse terrain data from an ArrayBuffer. This is useful when you have raw terrain data that needs to be converted into a usable format.
const {TerrainLoader} = require('@loaders.gl/terrain');
const {parse} = require('@loaders.gl/core');
async function parseTerrain(arrayBuffer) {
const terrainData = await parse(arrayBuffer, TerrainLoader);
console.log(terrainData);
}
// Assuming arrayBuffer is obtained from a file or network request
parseTerrain(arrayBuffer);
Integrating with 3D Visualization Libraries
This feature demonstrates how to integrate loaded terrain data with a 3D visualization library like Cesium. The example shows how to add a terrain model to a Cesium viewer.
const {TerrainLoader} = require('@loaders.gl/terrain');
const {load} = require('@loaders.gl/core');
const {Viewer, Entity} = require('cesium');
async function addTerrainToCesium(viewer, url) {
const terrainData = await load(url, TerrainLoader);
viewer.entities.add(new Entity({
position: Cesium.Cartesian3.fromDegrees(terrainData.longitude, terrainData.latitude),
model: {
uri: terrainData.modelUrl
}
}));
}
const viewer = new Viewer('cesiumContainer');
addTerrainToCesium(viewer, 'https://example.com/terrain-data.terrain');
three-geo is a library for integrating geographic data with Three.js. It allows you to load and visualize terrain data in a 3D environment. Compared to @loaders.gl/terrain, three-geo is more tightly integrated with Three.js and provides higher-level abstractions for working with geographic data.
Cesium is a comprehensive library for 3D geospatial visualization. It supports loading and visualizing terrain data, among many other features. While @loaders.gl/terrain focuses on loading and parsing terrain data, Cesium provides a full-fledged platform for 3D GIS applications.
Turf is a geospatial analysis library for JavaScript. It provides various tools for processing and analyzing geographic data, including terrain data. While @loaders.gl/terrain is specialized in loading and parsing terrain data, Turf offers a broader range of geospatial analysis functionalities.
loaders.gl is a collection of framework-independent 3D and geospatial parsers and encoders.
This module reconstructs mesh surfaces from height map images, e.g. Mapzen Terrain Tiles, which encodes elevation into R,G,B values.
For documentation please visit the website.
@loaders.gl/terrain
uses MARTINI for mesh reconstruction.
ISC License
Copyright (c) 2019, Mapbox
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
v4.3.0-alpha.1
FAQs
Framework-independent loader for terrain raster formats
The npm package @loaders.gl/terrain receives a total of 141,913 weekly downloads. As such, @loaders.gl/terrain popularity was classified as popular.
We found that @loaders.gl/terrain demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 8 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.