dayjournal memo

Total 975 articles!!

Amazon Location Service #003 - マーカー複数表示

Yasunori Kirimoto's avatar

画像



マーカーを複数表示するメモ。



画像



main.ts

import './style.css'
import 'maplibre-gl/dist/maplibre-gl.css';
import maplibregl from 'maplibre-gl';
import { createMap, drawPoints } from "maplibre-gl-js-amplify";
import { Amplify } from 'aws-amplify';
import awsconfig from './aws-exports';
Amplify.configure(awsconfig);

async function mapCreate() {
    const map = await createMap({
        container: 'map',
        center: [139.767, 35.681],
        zoom: 11,
    });
    map.addControl(
        new maplibregl.NavigationControl({
            visualizePitch: true,
        })
    );
    map.on('load', function () {
        // マーカー表示
        drawPoints(
            'pointsSource',
            [
                {
                    coordinates: [139.7646, 35.6827],
                },
                {
                    coordinates: [139.772, 35.6768],
                },
                {
                    coordinates: [139.7607, 35.6759],
                },
            ],
            map
        );
    });
}
mapCreate();



Amazon Location Serviceを手軽に始めるビルド環境公開しています。
amazon-location-service-starter



book

Q&A