أمثلة على التصميم باستخدام السحابة الإلكترونية القديمة

هذا مثال أساسي على تحميل خريطة ذات تصميم مخصّص باستخدام رقم تعريف الخريطة. في هذه الحالة، تشير JavaScript في "خرائط Google" إلى معرّف الخريطة 8e0a97af9386fef عند تحميل الخريطة، وتطبيق أسلوب الخريطة المرتبط بمعرّف الخريطة هذا تلقائيًا.

TypeScriptJavaScript
function initMap(): void {
  new google.maps.Map(
    document.getElementById("map") as HTMLElement,
    {
      mapId: "8e0a97af9386fef",
      center: { lat: 48.85, lng: 2.35 },
      zoom: 12,
    } as google.maps.MapOptions
  );
}

declare global {
  interface Window {
    initMap: () => void;
  }
}
window.initMap = initMap;
function initMap() {
  new google.maps.Map(document.getElementById("map"), {
    mapId: "8e0a97af9386fef",
    center: { lat: 48.85, lng: 2.35 },
    zoom: 12,
  });
}

window.initMap = initMap;
عرض مثال

تجربة عيّنة