setCenterMarkerCondition は一度に一条件のみ有効です。再設定すると上書きされます。clearCenterMarkerCondition でマーカーを非表示にできます。CenterMarkerCondition は icon ではなく、color / accentColor / width / length / position を指定します。import * as GIA from '@ntj/gaia';
const centerMarkerCondition = new GIA.value.CenterMarkerCondition({
color: GIA.value.Color.fromColorCodeSixHex('006400') ?? GIA.value.Color.black(),
width: 2,
length: 10,
position: 'target',
});
map.setCenterMarkerCondition(centerMarkerCondition);
// 地図移動完了時に中心座標を取得
map.addEventListener('moveend', () => {
const center = map.getCenter();
console.log('現在の中心:', center.lat, center.lng);
});
// 表示を外す
map.clearCenterMarkerCondition();
// 必要なタイミングで再表示
map.setCenterMarkerCondition(centerMarkerCondition);
十字マーカー(センターマーカー)の表示オプションを設定する — 詳細な使用例
地図の中心に常に表示される十字マーカー(センターマーカー)を設定します。 住所入力フォームと組み合わせた「ドラッグで位置を選択する」UIや、 中心座標をリアルタイムに取得するインタラクションに使います。