@vcmap/core

VC Map Core @vcmap/core

Part of the VC Map Project

API Docs

The VC Map Core is a thin abstraction layer and wrapper around OpenLayers and Cesium. It provides a common data and feature management API and automatically synchronizes data and user actions between the 2D, oblique and 3D views. Map functions and tools can be developed against this core API to make them available in 2D, 3D and the oblique view rather than having to develop them redundantly and based on different technologies.

Features

Allows rendering content on three different maps. This allows to select the best technology for a specific usecase, but still work with the same API.

  • 2D Map using Openlayers
  • 3D Map using CesiumJs
  • Oblique Map using Openlayers

A main class to manage items (maps, layers, viewpoints, styles). The VcsApp has a API to add/get/list items in different Collections. For example the LayerCollection: const layer = vcsApp.layers.getByKey('myLayerName'); The VcsApp also provides an API to parse and serialize Modules. An Item can be added via parsing of a module or directly via the API.

Some layer are map specific and only work for example in 3D. Layers can be created via the API new CesiumTilesetLayer(options); or loaded into the VcsApp in a Module. The Core supports the following layer types.

  • WMS Layer
  • WMTS Layer
  • TMS Layer
  • SingleImageryLayer
  • Vector Tile Layer
  • OpenstreetMap Layer
  • WFS Layer
  • GeoJSON Layer
  • Vector Layer (allows adding Features via API) layer.addFeature(new Feature({ geometry: new Polygon({...}) }))

Layers which provide Features have a common API to hide/highlight/style/access Features.

The Core supports two style types. A DeclarativeStyleItem using the Cesium 3D Tiles Styling language and a VectorStyleItem which is based on Openlayers Styling. Both Style Items can be serialized to JSON and work for VectorLayer, GeoJSONLayer, CesiumTilesetLayer, VectorTileLayer. DeclarativeStyleItem can be used to style each Feature in a dataset based on attribute values or rules depending on attributes. VectorStyleItem are best to for static styling of a complete dataset.

The core provides a flexible and fully customizable configuration management. Items like maps, layers, viewpoints, styles can be managed in Modules. Modules can be serialized to a JSON file and loaded/unloaded by the VcsApp.

The Interactions API is an abstraction layer to handle map events. For example a click event on the Map. This allows for developing applications which work in 2D/3D or oblique.

Based on the Interactions API the Feature Editor provides functionality to create, select, and transform Features.

Vector Features can be shown in a VectorLayer or GeoJSONLayer. GeoJSON Feature are just 2D, and in a 2D Map the Feature will just be rendered. In 3D a Feature can be rendered differently depending on the VectorLayer settings or the properties of the Feature.

  • Render a Feature as a Solid via extrusion Parameter.
  • Render a Point Feature as a Gltf Model.
  • Render a Feature as a Classification Primitive to classifiy other content.

More options see VectorProperties

Categories is a concept to serialize and parse arbitrary JSON Objects from a Module.

The full capability of Openlayers and CesiumJs are available. In 3D, a map for example has an accessor to get the corresponding Cesium Scene.

With the ClassRegistry concept and API its possible to register your own Item Types to the Framework. For example with app.layerClassRegistry.registerClass('myLayer', MyLayerClass) its possible to implement a custom layer while following the Layer Interface. This allows to reuse the Module serialization/parsing Concept with custom Items.

  • clone Repo
  • npm install

Coding Conventions

  • You should export all variables, functions, class etc. from a module which are required to use the API.
  • Party of your module which should be part of the library must be added to the index.ts file manually
  • Make sure the names of exports have meaning outside of their module. E.g. a function names extend(destination: extent3D, source: extend3D):void would need to be rephrased to extend3DExtent.