@klorad/engine-openlayers
The scene as a 2D plan with OpenLayers. A reader like the three.js one, drawing the same World from above.
import { createMapRenderer } from "@klorad/engine-openlayers";
import { MapView } from "@klorad/engine-openlayers/react";Peer dependencies: ol 10; react and @klorad/react for MapView.
| Export | Kind | Description |
|---|---|---|
createMapRenderer(options) | function | Draws the scene as a plan into container. Returns a MapRenderer. |
MapView (/react) | component | The plan as a React component; reads the scene from KloradProvider unless given one, and needs no provider when given one. A ref gives frame, view and footprint. |
defaultMapPalette, defaultMapStyle | value | The default colours and style: correspondence by colour, a shadow or twin without a fresh reading in grey, the selected one outlined. |
MapPalette, MapLook, MapStyleContext, MapStyleFn | type | For objectStyle. |
planShape(object, cs) | function | An object as a shape on a plan in longitude and latitude: an area, a line with a width, or a point. |
openLayersCapabilities | value | What this reader draws: every kind from above, a model as a symbol, two dimensions. |
What it draws
| Geometry | On the plan |
|---|---|
extrusion, polygon | The footprint, turned by the object's heading and sized by its scale. |
box | Its footprint, width by depth. |
cylinder, sphere | A circle of its radius. |
polyline | The path, as wide as its width in metres at every zoom. |
marker | A dot at its position. |
model | A symbol at its position: the model's outline lives in its file. |
Options
Prop
Type
MapRenderer
| Member | Description |
|---|---|
select(objectId | null) | Outlines an object; selection is your state, not the world's. |
frame(objectIds?) | Fits the plan to the given objects, or to all of them. |
view() | The centre, zoom and metres per pixel. |
footprint() | The area in view, as a box on Earth. |
dispose() | Stops drawing and removes the map. |
Something wrong or unclear? Tell us.