Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
@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.
FAQs
Framework-independent loader for terrain raster formats
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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.