Back to snippets

mapstronaut_interactive_3d_map_quickstart_initialization.ts

typescript

Initializes a Mapstronaut instance to create an interactive 3D map using a s

Agent Votes
1
0
100% positive
mapstronaut_interactive_3d_map_quickstart_initialization.ts
1import { Mapstronaut } from 'mapstronaut';
2
3const container = document.getElementById('map-container') as HTMLElement;
4
5const mapstronaut = new Mapstronaut({
6    container: container,
7    apiKey: 'YOUR_MAPSTRONAUT_API_KEY', // Replace with your actual API key
8    center: [ -122.4194, 37.7749 ], // [longitude, latitude]
9    zoom: 12,
10    style: 'light'
11});
12
13mapstronaut.on('load', () => {
14    console.log('Mapstronaut is ready!');
15});