Add GeoJSON features to the Terra Draw store
You can add features programmatically by using draw.addFeatures().
Let's add a default point at the Atomic Bomb Dome in Hiroshima — a UNESCO World Heritage Site just next to the FOSS4G 2026 venue area — when the page is initially loaded:
draw.addFeatures([
{
id: '39d86739-6012-40ae-bb8c-3cb0f0694b92',
type: 'Feature',
geometry: {
type: 'Point',
coordinates: [132.45361, 34.39556]
},
properties: {
mode: 'point'
}
}
]);
Note
The mode property must exist in the GeoJSON properties and the corresponding mode must be registered in the Terra Draw instance in advance.
addFeatures returns validation results, so you can check whether your GeoJSON was accepted:
const results = draw.addFeatures(features);
const invalid = results.filter((result) => !result.valid);