Add GeoJSON features to Terra Draw store
You can add features programmatically by using draw.addFeatures:
Let's add a default point at Auckland University of Technology when a page is initially loaded.
Add the below code in the last of map.once('load') event.
draw?.addFeatures([
{
id: '39d86739-6012-40ae-bb8c-3cb0f0694b92',
type: 'Feature',
geometry: {
type: 'Point',
coordinates: [174.766430366, -36.85309055]
},
properties: {
mode: 'point'
}
}
]);
Note
mode property must exist in GeoJSON properties and corresponding mode must be added to Terra Draw in advance.
