Skip to content

Latest commit

 

History

History
64 lines (49 loc) · 3.28 KB

APIReference.md

File metadata and controls

64 lines (49 loc) · 3.28 KB

API Reference

import { TerrainDataSource } from '@here/harp-terrain-datasource'

new TerrainDataSource(TerrainDataSourceOptions)
TerrainDataSourceOptions
  • concurrentDecoderScriptUrl: string
    URL from which to fetch decoder worker script. See Getting Started Guide on how to setup worker.
  • concurrentDecoderServiceName: string
    Arbitrary string to identify the decoder.
  • fetchTile: (tileKey: TileKey) → Promise<ArrayBuffer>
    Fetches a tile using provided tileKey.
  • tilingScheme: TilingScheme
    Tiling scheme used by the data source. See predefined tiling schemes by harp.gl.
  • getTileMaterial?: (tile: Tile, decodedTile: DecodedTile) → Promise<THREE.Material>
    Constructs material of a tile. Can be used also to fetch texture using the tile key.
    Default: ElevationMaterial
  • decoderOptions?: PNGDecoderOptions
  • getDisplayZoomLevel?: (level: number) → number
    Generates custom zoom level for the data source depending on map's zoom.
  • getCustomObjects?:(terrainTile: TerrainTile) → Promise | void
    Allows you to add custom objects on top of the terrain.
PNGDecoderOptions
  • widthSegments?: number
    Amount of width segments of Plane Buffer Geometry which will be created for each tile.
    Default: 63
  • heightSegments?: number
    Default: 63

Elevation Material

Terrain Datasource comes with three.js material for elevation based styling. You can specify different colors for different altitudes.

import { ElevationMaterial } from '@here/harp-terrain-datasource/src/terrain-tile'

new ElevationMaterial(ElevationMaterialOptions)
ElevationMaterialOptions
  • colorStreps: [ColorStep]
    Defines how colors specific altitudes of your terrain.
  • texture?: THREE.Texture
  • textureIntensity?: number
    Defines how to mix texture color (if present) and elevation based color. Ratio in the [0, 1] range, 1 means only texture color, 0 — only elevation based color.
  • lightVector?: THREE.Vector3
    Direction of the light, used to shade the terrain. Default: new THREE.Vector3(1.0, 0.0, 0.5)
ColorStep
  • altitude: number
    Altitude where to apply color.
  • color: THREE.Vector3
    Color of the specified altitude. Defined as a vector with RGB components.

See also TypeScript typings in ../src/index.d.ts