Unverified Commit 0f082114 authored by Sparkf's avatar Sparkf 🏙️
Browse files

use protomap for realtime map, update maplibre-gl-js

parent 31ce565f
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -14,13 +14,14 @@
import maplibre from 'maplibre-gl';
import axios from "axios";
import * as turf from '@turf/turf';
import { Protocol } from "pmtiles";


export default {
  name: "MyMap",

  data: () => ({
    map_style_url: "https://bus.sustcra.com/static/osm-style/osm-bright.json",
    map_style_url: "https://bus.sustcra.com/static/protomaps/pmtiles-style/pmtiles-light.json",
    map_text_colour: "#000000",
    bus_location_data_api: [],
    bus_location_data_display: [],
@@ -326,13 +327,17 @@ export default {
      geojson_line_2: this.geojson_line_2
    }

    //init pmtiles protocol
    let pmtiles_protocol = new Protocol();
    maplibre.addProtocol("pmtiles",pmtiles_protocol.tile);

    //determine day or night
    const userPrefersDark = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
    const userPrefersLight = window.matchMedia && window.matchMedia('(prefers-color-scheme: light)').matches;
    if (await userPrefersDark) {
      console.log("dark mode enabled.")
      this.map_text_colour = "#FFFFFF"
      this.map_style_url = "https://bus.sustcra.com/static/osm-style/osm-blue.json";
      this.map_style_url = "https://bus.sustcra.com/static/protomaps/pmtiles-style/pmtiles-dark.json";
    }

    this.map = new maplibre.Map({
+2 −1
Original line number Diff line number Diff line
@@ -28,7 +28,8 @@
    "axios": "^1.7.9",
    "download": "^8.0.0",
    "echarts": "^5.6.0",
    "maplibre-gl": "^4.7.1",
    "maplibre-gl": "^5.0.1",
    "pmtiles": "^4.2.1",
    "vue": "^3.5.13"
  }
}
+20 −10
Original line number Diff line number Diff line
@@ -21,8 +21,11 @@ importers:
        specifier: ^5.6.0
        version: 5.6.0
      maplibre-gl:
        specifier: ^4.7.1
        version: 4.7.1
        specifier: ^5.0.1
        version: 5.0.1
      pmtiles:
        specifier: ^4.2.1
        version: 4.2.1
      vue:
        specifier: ^3.5.13
        version: 3.5.13
@@ -1025,8 +1028,8 @@ packages:
    resolution: {integrity: sha512-Es6WcD0nO5l+2BOQS4uLfNPYQaNDfbot3X1XUoloz+x0mPDS3eeORZJl06HXjwBG1fOGwCRnzK88LMdxKRrd6Q==}
    engines: {node: '>=6.0.0'}

  '@maplibre/maplibre-gl-style-spec@20.4.0':
    resolution: {integrity: sha512-AzBy3095fTFPjDjmWpR2w6HVRAZJ6hQZUCwk5Plz6EyfnfuQW1odeW5i2Ai47Y6TBA2hQnC+azscjBSALpaWgw==}
  '@maplibre/maplibre-gl-style-spec@23.1.0':
    resolution: {integrity: sha512-R6/ihEuC5KRexmKIYkWqUv84Gm+/QwsOUgHyt1yy2XqCdGdLvlBWVWIIeTZWN4NGdwmY6xDzdSGU2R9oBLNg2w==}
    hasBin: true

  '@mdit-vue/plugin-component@2.1.3':
@@ -2981,8 +2984,8 @@ packages:
    resolution: {integrity: sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA==}
    engines: {node: '>=6'}

  maplibre-gl@4.7.1:
    resolution: {integrity: sha512-lgL7XpIwsgICiL82ITplfS7IGwrB1OJIw/pCvprDp2dhmSSEBgmPzYRvwYYYvJGJD7fxUv1Tvpih4nZ6VrLuaA==}
  maplibre-gl@5.0.1:
    resolution: {integrity: sha512-kNvod1Tq0BcZvn43UAciA3DrzaEGmowqMoI6nh3kUo9rf+7m89mFJI9dELxkWzJ/N9Pgnkp7xF1jzTP08PGpCw==}
    engines: {node: '>=16.14.0', npm: '>=8.1.0'}

  marchingsquares@1.3.3:
@@ -3212,6 +3215,9 @@ packages:
    resolution: {integrity: sha512-MnUuEycAemtSaeFSjXKW/aroV7akBbY+Sv+RkyqFjgAe73F+MR0TBWKBRDkmfWq/HiFmdavfZ1G7h4SPZXaCSg==}
    engines: {node: '>=0.10.0'}

  pmtiles@4.2.1:
    resolution: {integrity: sha512-Z73aph49f7KpU7JPb+zDWr+62wPv9jF3p+tvvL26/XeECnzUHnQ0nGopXGPYnq+OQXqyaXZPrsNdKxSD+2HlLA==}

  point-in-polygon-hao@1.2.4:
    resolution: {integrity: sha512-x2pcvXeqhRHlNRdhLs/tgFapAbSSe86wa/eqmj1G6pWftbEs5aVRJhRGM6FYSUERKu0PjekJzMq0gsI2XyiclQ==}

@@ -5134,13 +5140,13 @@ snapshots:

  '@mapbox/whoots-js@3.1.0': {}

  '@maplibre/maplibre-gl-style-spec@20.4.0':
  '@maplibre/maplibre-gl-style-spec@23.1.0':
    dependencies:
      '@mapbox/jsonlint-lines-primitives': 2.0.2
      '@mapbox/unitbezier': 0.0.1
      json-stringify-pretty-compact: 4.0.0
      minimist: 1.2.8
      quickselect: 2.0.0
      quickselect: 3.0.0
      rw: 1.3.3
      tinyqueue: 3.0.0

@@ -8202,7 +8208,7 @@ snapshots:
      pify: 4.0.1
      semver: 5.7.2

  maplibre-gl@4.7.1:
  maplibre-gl@5.0.1:
    dependencies:
      '@mapbox/geojson-rewind': 0.5.2
      '@mapbox/jsonlint-lines-primitives': 2.0.2
@@ -8211,7 +8217,7 @@ snapshots:
      '@mapbox/unitbezier': 0.0.1
      '@mapbox/vector-tile': 1.3.1
      '@mapbox/whoots-js': 3.1.0
      '@maplibre/maplibre-gl-style-spec': 20.4.0
      '@maplibre/maplibre-gl-style-spec': 23.1.0
      '@types/geojson': 7946.0.15
      '@types/geojson-vt': 3.2.5
      '@types/mapbox__point-geometry': 0.1.4
@@ -8422,6 +8428,10 @@ snapshots:

  pinkie@2.0.4: {}

  pmtiles@4.2.1:
    dependencies:
      fflate: 0.8.2

  point-in-polygon-hao@1.2.4:
    dependencies:
      robust-predicates: 3.0.2