3. The adapter
Because OpenLayers is modular, the adapter receives the classes it needs via lib instead of importing them itself:
adapter: new TerraDrawOpenLayersAdapter({
lib: {
Circle, Feature, GeoJSON, Style, VectorLayer, VectorSource,
Stroke, Fill, Icon, getUserProjection, Projection, fromLonLat, toLonLat
},
map
})
Start drawing once the first frame is rendered:
map.once('rendercomplete', () => {
draw.start();
});