Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

URL scheme "mapbox" is not supported #1899

Open
nirpan opened this issue Feb 5, 2024 · 0 comments
Open

URL scheme "mapbox" is not supported #1899

nirpan opened this issue Feb 5, 2024 · 0 comments

Comments

@nirpan
Copy link

nirpan commented Feb 5, 2024

I have been having this issue since the last version and was hoping the latest release would fix it but unfortunately this issue still persists.

I have the following component to render the map in Vue 3:

<script setup>
import 'mapbox-gl/dist/mapbox-gl.css'
import { VMap } from "v-mapbox";
import {reactive} from "vue";

const state = reactive({
  map: {
    container: "map-container",
    accessToken: "[access token]",
    style: "mapbox://styles/mapbox/streets-v11?optimize=true",
    // style: "https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json", 
    center: [-74.5, 40],
    zoom: 5,
  },
});
</script>

<template>
  <div
      id="map-container"
      class="map-container position-relative"
      style="height: 500px"
  >
    <v-map options="{...state.map}"  />
  </div>
</template>

This throws the following error:
CleanShot 2024-02-05 at 12 50 48@2x

The reason for this seems to be in maplibre-gl-js 2.x, the mapbox:// url scheme has been dropped and if I use the commented out style option, the map loads as expected. Is there any chance of this getting fixed?

I have also tried the https://api.mapbox.com/styles/v1/ URL but the fragments still load with the mapbox url scheme. This is my pacakge.json.

{
  "name": "v-mapbox",
  "version": "0.0.0",
  "private": true,
  "type": "module",
  "scripts": {
    "dev": "vite",
    "build": "vite build",
    "preview": "vite preview",
    "test:unit": "vitest"
  },
  "dependencies": {
    "mapbox-gl": "^3.1.2",
    "v-mapbox": "^5.0.0",
    "vue": "^3.4.15"
  },
  "devDependencies": {
    "@vitejs/plugin-vue": "^5.0.3",
    "@vue/test-utils": "^2.4.4",
    "jsdom": "^24.0.0",
    "vite": "^5.0.11",
    "vitest": "^1.2.2"
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant