In the local SvelteKit template
Open src/routes/+page.svelte, add the imports below the existing ones, and put the Terra Draw setup at the end of the onMount() function, after the map initialization:
onMount(() => {
const draw = new TerraDraw({
adapter: new TerraDrawMapLibreGLAdapter({ map }),
modes: [new TerraDrawRectangleMode()],
});
map.once('load', () => {
draw.start();
draw.setMode("rectangle");
});
});