0.0.3 • Published 9 years ago

wxs3map v0.0.3

Weekly downloads
4
License
MIT
Repository
github
Last release
9 years ago

Wxs3Map

NOTE: This is a fork of wxs.threejs, for the original version please refer to the original reposityory.

Wxs3Map is a lightweight JavaScript library build on top of the great three.js library.

The main purpose is to facilitate showing small 3d-blocks of the world, using the OGC services WCS for elevation data and WMS/WMTS for textures (maps or sattelite/aerial photos).

Usage

The recommended way to use wxs.threejs2 is by some tool like Webpack or browserify:

npm install wxs3map --save

And then

import Wxs3Map from 'wxs3map';

If you want to include this as a "traditional" js package, add the build/Wxs3Map.min.js to your project, as well as build/trackball.js.

and the libraries:

  • three.js
  • underscore
  • proj4js

Configuration

A new 3d-scene is created using the following syntax

var threeDMap = window.Wxs3Map.default(options);

Here options is an object of the following structure:

OptionTypeDefaultDescription
divStringnullId of div to place scene in
bboxStringnullBounding box of area to show
bboxCrsStringEPSG:4326Crs of bbox
wireframeBooleanfalseShow wireframe (for debugging)
zMultNumber1Factor to adjust z-values (height) by
crsStringEPSG:32633Internal coordinate system of scene
textureTextureOptionsConfigure texture, see below
terrainTerrainOptionsConfigure terrain, see below
profilesProfileOptions[]Configure texture, see below

TextureOptions

OptionTypeDefaultDescription
typeStringwmsType of texture (wms or image)
wmsUrlStringhttp://openwms.statkart.no/skwms1/wms.topo2Url to wms server
wmsLayersStringtopo2_WMSWms layers to use
wmsFormatStringimage/pngWms format
imgUrlStringnullPath to image used for texture if type = image

TerrainOptions

OptionTypeDefaultDescription
pixelsPerVertexInteger8Resolution of the height model in the image
wcsResolutionInteger10Resolution of grid cell in meters
coverageStringland_utm33_10mWcs coverage to use
formatStringgeotiffWCS format (geotiff or xyz)
showBoxBooleantrueShow a box around the terrain slice
boxColorHex color0xddddddColor of the box around the terrain slice

ProfileOptions

Development

  1. npm install
  2. npm run dev-server
  3. Navigate the browser to http://localhost:8080/demos/