High-precision calculation support and experimental terrain rendering capabilities, including deprecated 64-bit precision extensions and preview terrain features.
Legacy extension that adds 64-bit precision to geospatial layers. This extension is deprecated in favor of modern projection systems and high-precision viewport handling.
/**
* Adds the legacy 64-bit precision to geospatial layers
* @deprecated Use modern high-precision viewport and projection systems instead
*/
class Fp64Extension extends LayerExtension {
static extensionName: 'Fp64Extension';
constructor();
getShaders(): any;
draw(params: any, extension: this): void;
}64-bit precision projection shader module that works with the Fp64Extension and other high-precision rendering scenarios.
/**
* 64-bit precision projection shader module
* Provides high-precision coordinate transformations
*/
const project64: ShaderModule<Project64ModuleProps>;
interface Project64ModuleProps {
/** The viewport for coordinate transformations */
viewport: Viewport;
}
/**
* Returns calculated 64-bit precision uniforms for the shader module
* @param opts - Module properties or empty object
* @returns Record of uniform values for high-precision rendering
*/
function getUniforms(opts?: Project64ModuleProps | {}): Record<string, any>;
interface ShaderModule<TProps> {
name: string;
dependencies: ShaderModule<any>[];
vs: string; // Vertex shader code
getUniforms: (opts?: TProps | {}) => Record<string, any>;
uniformTypes: Record<string, string>;
}Experimental extension for terrain-aware rendering, providing capabilities for draping layers on terrain surfaces and offset rendering.
/**
* Experimental terrain extension for 3D terrain rendering
* Allows layers to be draped on terrain surfaces or offset from terrain
* @experimental This API may change in future versions
*/
class _TerrainExtension extends LayerExtension {
static extensionName: 'TerrainExtension';
static defaultProps: TerrainExtensionDefaultProps;
constructor();
getShaders(): any;
initializeState(): void;
updateState(params: UpdateParameters): void;
onNeedsRedraw(): void;
}
interface TerrainExtensionProps {
/**
* Terrain drawing mode:
* - 'offset': Objects are offset from the terrain surface
* - 'drape': Objects are draped/projected onto the terrain surface
* If undefined, mode is automatically detected based on layer type
*/
terrainDrawMode?: 'offset' | 'drape';
}
interface TerrainExtensionDefaultProps {
terrainDrawMode: undefined;
}
interface TerrainModuleProps {
// Properties for terrain shader module (implementation details vary)
}Usage Examples:
import { ScatterplotLayer, PathLayer } from "@deck.gl/layers";
import { Fp64Extension, _TerrainExtension, project64 } from "@deck.gl/extensions";
// Legacy 64-bit precision (deprecated - use modern approaches instead)
const legacyPrecisionLayer = new ScatterplotLayer({
id: "legacy-precision",
data: precisionData,
extensions: [new Fp64Extension()], // Deprecated
getPosition: d => d.coordinates,
getRadius: 100
});
// Using project64 shader module directly (advanced usage)
const customShaderLayer = new CustomLayer({
id: "custom-precision",
data: customData,
modules: [project64], // Include 64-bit precision shader module
moduleProps: {
project64: {
viewport: deck.viewManager.getViewport()
}
}
});
// Experimental terrain draping
const drapedLayer = new PathLayer({
id: "draped-paths",
data: pathData,
extensions: [new _TerrainExtension()], // Experimental
getPath: d => d.coordinates,
terrainDrawMode: 'drape', // Drape paths on terrain surface
getWidth: 5
});
// Terrain offset rendering
const offsetLayer = new ScatterplotLayer({
id: "terrain-offset",
data: pointData,
extensions: [new _TerrainExtension()],
getPosition: d => d.coordinates,
terrainDrawMode: 'offset', // Offset points from terrain
getRadius: 50
});
// Auto-detected terrain mode
const autoTerrainLayer = new ScatterplotLayer({
id: "auto-terrain",
data: pointData,
extensions: [new _TerrainExtension()],
getPosition: d => d.coordinates,
// terrainDrawMode undefined - automatically detected
getRadius: 25
});The Fp64Extension is deprecated. Modern alternatives include:
// Instead of Fp64Extension (deprecated)
const legacyLayer = new ScatterplotLayer({
extensions: [new Fp64Extension()], // Don't use this
// ...
});
// Use modern high-precision viewport
const modernLayer = new ScatterplotLayer({
// No extension needed - precision handled by viewport
coordinateSystem: COORDINATE_SYSTEM.LNGLAT_DEPRECATED, // If needed
// Or use newer coordinate systems with built-in precision
// ...
});
// Or use explicit projection with high precision
const projectedLayer = new ScatterplotLayer({
coordinateSystem: COORDINATE_SYSTEM.WEB_MERCATOR,
coordinateOrigin: [centerLng, centerLat], // High precision origin
// ...
});// Modern approach for high-precision coordinates
const highPrecisionLayer = new ScatterplotLayer({
data: precisionData,
// Use coordinate origin for sub-pixel precision
coordinateOrigin: [-122.45, 37.78],
coordinateSystem: COORDINATE_SYSTEM.METER_OFFSETS,
getPosition: d => [
(d.lng - (-122.45)) * 111000, // Convert to meter offsets
(d.lat - 37.78) * 111000
]
});// Terrain extension requires terrain provider in deck instance
const deckInstance = new Deck({
// ... other config
terrain: {
provider: 'mapbox', // or other terrain provider
accessToken: 'your-token',
elevationData: 'mapbox://mapbox.terrain-rgb'
},
layers: [terrainLayer]
});
const terrainLayer = new PathLayer({
extensions: [new _TerrainExtension()],
terrainDrawMode: 'drape'
});// Terrain with custom elevation handling
const advancedTerrainLayer = new ScatterplotLayer({
extensions: [new _TerrainExtension()],
terrainDrawMode: 'offset',
// Additional terrain-related props may be available
// Check latest documentation for experimental features
});