Verified Commit 606fbb12 authored by Sparkf's avatar Sparkf 🏙️
Browse files

update dependencies: maplibre-gl-js to 4.0.0

parent 930864c2
Loading
Loading
Loading
Loading
+103 −94
Original line number Diff line number Diff line
@@ -515,29 +515,39 @@ export default {
      });

      //add station

      this.map.loadImage(
          'https://bus.sustcra.com/station_icon.png',
          (error, image) => {
            if (error) throw error;
            this.map.addImage('bus-station', image);


            //image of buildings
            this.map.loadImage(
                'https://bus.sustcra.com/bldg_icon.png',
                (error, image) => {
                  this.map.addImage('bldg-icon', image)
      function loadLegendImage(url) {
        return fetch(url)
            .then(response => response.blob())
            .then(blob => {
              return new Promise((resolve, reject) => {
                const image = new Image();
                const url = URL.createObjectURL(blob);

                image.onload = () => {
                  URL.revokeObjectURL(url); // Clean up the URL object
                  resolve(image);
                };
                image.onerror = () => {
                  URL.revokeObjectURL(url);
                  reject(new Error('Could not load image'));
                };
                image.src = url;
              });

            //image of gates
            this.map.loadImage(
                'https://bus.sustcra.com/gate_icon.png',
                (error, image) => {
                  this.map.addImage('gate-icon', image)
            });
      }

      Promise.all([
        loadLegendImage('https://bus.sustcra.com/station_icon.png'),
        loadLegendImage('https://bus.sustcra.com/bldg_icon.png'),
        loadLegendImage('https://bus.sustcra.com/gate_icon.png')
      ]).then(images => {
        // All images have been loaded successfully
        this.map.addImage('bus-station', images[0]);
        this.map.addImage('bldg-icon', images[1]);
        this.map.addImage('gate-icon', images[2]);

        // Now add sources and layers
        // Add sources and layers after loading images
        this.map.addSource('stations', {
          'type': 'geojson',
          'data': this.stations_geojson
@@ -561,10 +571,6 @@ export default {
            'icon-size': 0.075,
            'icon-image': 'bus-station',
            'text-field': ['get', 'name'],
                // 'text-font': [
                //   'Open Sans Semibold',
                //   'Arial Unicode MS Bold'
                // ],
            'text-size': 10,
            'text-offset': [0, 1.25],
            'text-anchor': 'top'
@@ -572,10 +578,6 @@ export default {
          "paint": {
            "text-color": this.map_text_colour
          },
              // 'paint': {
              //   'circle-radius': 6,
              //   'circle-color': '#B42222'
              // },
          'filter': ['==', '$type', 'Point']
        });

@@ -616,9 +618,16 @@ export default {
        });


      }).catch(error => {
        // Handle any errors that occurred during image loading
        console.error('Error loading images:', error);
      });






    });


+2 −2
Original line number Diff line number Diff line
@@ -28,7 +28,7 @@
    "axios": "^1.6.0",
    "download": "^8.0.0",
    "echarts": "^5.4.0",
    "maplibre-gl": "3.6.2",
    "maplibre-gl": "4.0.0",
    "vue": "^3.4.15"
  }
}
+17 −10
Original line number Diff line number Diff line
@@ -18,8 +18,8 @@ dependencies:
    specifier: ^5.4.0
    version: 5.4.3
  maplibre-gl:
    specifier: 3.6.2
    version: 3.6.2
    specifier: 4.0.0
    version: 4.0.0
  vue:
    specifier: ^3.4.15
    version: 3.4.16
@@ -1746,13 +1746,13 @@ packages:
    engines: {node: '>=6.0.0'}
    dev: false

  /@maplibre/maplibre-gl-style-spec@19.3.3:
    resolution: {integrity: sha512-cOZZOVhDSulgK0meTsTkmNXb1ahVvmTmWmfx9gRBwc6hq98wS9JP35ESIoNq3xqEan+UN+gn8187Z6E4NKhLsw==}
  /@maplibre/maplibre-gl-style-spec@20.1.1:
    resolution: {integrity: sha512-z85ARNPCBI2Cs5cPOS3DSbraTN+ue8zrcYVoSWBuNrD/mA+2SKAJ+hIzI22uN7gac6jBMnCdpPKRxS/V0KSZVQ==}
    hasBin: true
    dependencies:
      '@mapbox/jsonlint-lines-primitives': 2.0.2
      '@mapbox/unitbezier': 0.0.1
      json-stringify-pretty-compact: 3.0.0
      json-stringify-pretty-compact: 4.0.0
      minimist: 1.2.8
      rw: 1.3.3
      sort-object: 3.0.3
@@ -3082,6 +3082,12 @@ packages:
      '@types/node': 20.11.16
    dev: true

  /@types/geojson-vt@3.2.5:
    resolution: {integrity: sha512-qDO7wqtprzlpe8FfQ//ClPV9xiuoh2nkIgiouIptON9w5jvD/fA4szvP9GBlDVdJ5dldAl0kX/sy3URbWwLx0g==}
    dependencies:
      '@types/geojson': 7946.0.14
    dev: false

  /@types/geojson@7946.0.14:
    resolution: {integrity: sha512-WCfD5Ht3ZesJUsONdhvm84dmzWOiOzOAqOncN0++w0lBw1o8OuDNJF2McvvCef/yBqb/HYRahp1BYtODFQ8bRg==}
    dev: false
@@ -5425,8 +5431,8 @@ packages:
    resolution: {integrity: sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==}
    dev: true

  /json-stringify-pretty-compact@3.0.0:
    resolution: {integrity: sha512-Rc2suX5meI0S3bfdZuA7JMFBGkJ875ApfVyq2WHELjBiiG22My/l7/8zPpH/CfFVQHuVLd8NLR0nv6vi0BYYKA==}
  /json-stringify-pretty-compact@4.0.0:
    resolution: {integrity: sha512-3CNZ2DnrpByG9Nqj6Xo8vqbjT4F6N+tb4Gb28ESAZjYZ5yqvmc56J+/kuIwkaAMOyblTQhUW7PxMkUb8Q36N3Q==}
    dev: false

  /json5@2.2.3:
@@ -5552,8 +5558,8 @@ packages:
      semver: 5.7.2
    dev: false

  /maplibre-gl@3.6.2:
    resolution: {integrity: sha512-krg2KFIdOpLPngONDhP6ixCoWl5kbdMINP0moMSJFVX7wX1Clm2M9hlNKXS8vBGlVWwR5R3ZfI6IPrYz7c+aCQ==}
  /maplibre-gl@4.0.0:
    resolution: {integrity: sha512-bzVQ2pdOWITwbE+JHKSiAB/viVBBx4Aa1puydc1xizOWGbvRHD9pXpy3dsaW2ZlbmZKbv9r9sHpcvM9fTLGsKA==}
    engines: {node: '>=16.14.0', npm: '>=8.1.0'}
    dependencies:
      '@mapbox/geojson-rewind': 0.5.2
@@ -5563,8 +5569,9 @@ packages:
      '@mapbox/unitbezier': 0.0.1
      '@mapbox/vector-tile': 1.3.1
      '@mapbox/whoots-js': 3.1.0
      '@maplibre/maplibre-gl-style-spec': 19.3.3
      '@maplibre/maplibre-gl-style-spec': 20.1.1
      '@types/geojson': 7946.0.14
      '@types/geojson-vt': 3.2.5
      '@types/mapbox__point-geometry': 0.1.4
      '@types/mapbox__vector-tile': 1.3.4
      '@types/pbf': 3.0.5