Keine Bearbeitungszusammenfassung
Keine Bearbeitungszusammenfassung
 
Zeile 35: Zeile 35:
     var zoom = 13;
     var zoom = 13;


// 1) Fullscreen-CSS laden (egal wann vor Nutzung)
    addCss('https://unpkg.com/leaflet.fullscreen@2.4.0/Control.FullScreen.css');
  addCss('https://unpkg.com/leaflet.fullscreen@2.4.0/Control.FullScreen.css');


  // 2) Erst Fullscreen-JS laden, DANN Map erstellen
    addScript('https://unpkg.com/leaflet.fullscreen@2.4.0/Control.FullScreen.js')
  addScript('https://unpkg.com/leaflet.fullscreen@2.4.0/Control.FullScreen.js')
      .then(function () {
    .then(function () {
        var map = L.map(el, { fullscreenControl: true }).setView([lat, lon], zoom);


    var map = L.map(el).setView([lat, lon], zoom);
        var orthofoto = L.tileLayer(
          'https://mapsneu.wien.gv.at/basemap/bmaporthofoto30cm/normal/google3857/{z}/{y}/{x}.jpeg',
          { attribution: 'basemap.at' }
        );


    var orthofoto = L.tileLayer(
        var osm = L.tileLayer(
      'https://mapsneu.wien.gv.at/basemap/bmaporthofoto30cm/normal/google3857/{z}/{y}/{x}.jpeg',
          'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
      {
          { attribution: '© OpenStreetMap-Mitwirkende' }
        attribution: 'basemap.at'
        );
      }
    );


    var osm = L.tileLayer(
        orthofoto.addTo(map);
      'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
      {
        attribution: '© OpenStreetMap-Mitwirkende'
      }
    );


    orthofoto.addTo(map);
        L.marker([lat, lon]).addTo(map)
          .bindPopup('Test-Stecknadel')
          .openPopup();


    L.marker([lat, lon]).addTo(map)
        L.control.layers({
      .bindPopup('Test-Stecknadel')
          'Luftbild': orthofoto,
      .openPopup();
          'OSM': osm
 
        }, {}).addTo(map);
    L.control.layers(
       })
      {
      .catch(function () {
        'Luftbild': orthofoto,
        console.error('Leaflet-Fullscreen konnte nicht geladen werden.');
        'OSM': osm
      });
      },
       {}
    ).addTo(map);
   }
   }



Aktuelle Version vom 5. April 2026, 23:19 Uhr

mw.loader.using([], function () {
  function addCss(url) {
    if (document.querySelector('link[href="' + url + '"]')) {
      return;
    }
    var link = document.createElement('link');
    link.rel = 'stylesheet';
    link.href = url;
    document.head.appendChild(link);
  }

  function addScript(url) {
    return new Promise(function (resolve, reject) {
      if (document.querySelector('script[src="' + url + '"]')) {
        resolve();
        return;
      }
      var script = document.createElement('script');
      script.src = url;
      script.onload = resolve;
      script.onerror = reject;
      document.head.appendChild(script);
    });
  }

  function initMap() {
    var el = document.getElementById('mapdemo');
    if (!el || el.dataset.mapdemoReady) {
      return;
    }
    el.dataset.mapdemoReady = '1';

    var lat = 47.0707;
    var lon = 15.4395;
    var zoom = 13;

    addCss('https://unpkg.com/leaflet.fullscreen@2.4.0/Control.FullScreen.css');

    addScript('https://unpkg.com/leaflet.fullscreen@2.4.0/Control.FullScreen.js')
      .then(function () {
        var map = L.map(el, { fullscreenControl: true }).setView([lat, lon], zoom);

        var orthofoto = L.tileLayer(
          'https://mapsneu.wien.gv.at/basemap/bmaporthofoto30cm/normal/google3857/{z}/{y}/{x}.jpeg',
          { attribution: 'basemap.at' }
        );

        var osm = L.tileLayer(
          'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
          { attribution: '© OpenStreetMap-Mitwirkende' }
        );

        orthofoto.addTo(map);

        L.marker([lat, lon]).addTo(map)
          .bindPopup('Test-Stecknadel')
          .openPopup();

        L.control.layers({
          'Luftbild': orthofoto,
          'OSM': osm
        }, {}).addTo(map);
      })
      .catch(function () {
        console.error('Leaflet-Fullscreen konnte nicht geladen werden.');
      });
  }

  addCss('https://unpkg.com/leaflet@1.9.4/dist/leaflet.css');

  addScript('https://unpkg.com/leaflet@1.9.4/dist/leaflet.js')
    .then(initMap)
    .catch(function () {
      console.error('Leaflet konnte nicht geladen werden.');
    });
});