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

missing required property "version" #114

Closed
ibmsoft opened this issue Sep 11, 2020 · 2 comments
Closed

missing required property "version" #114

ibmsoft opened this issue Sep 11, 2020 · 2 comments

Comments

@ibmsoft
Copy link

ibmsoft commented Sep 11, 2020

image

<template>
  <MglMap :accessToken="accessToken" version="12" :mapStyle="mapStyle" />
</template>

<script>
import "mapbox-gl/dist/mapbox-gl.css";
import Mapbox from "mapbox-gl";
import { MglMap } from "v-mapbox";

export default {
  components: {
    MglMap,
  },
  data() {
    return {
      accessToken:
        "xxx", // your access token. Needed if you using Mapbox maps
      mapStyle: {}, // your map style
    };
  },

  created() {
    // We need to set mapbox-gl library here in order to use it in template
    this.mapbox = Mapbox;
  },
};
</script>
@Kyle123
Copy link
Contributor

Kyle123 commented Sep 11, 2020

You're passing an empty object to the mapStyle property - this should be a String or an object that conforms to the Mapbox Style Specification. The errors you are getting aren't errors for the map version, they're validation errors of the style object you've passed, the object should be in the format:

{
    "version": 8,
    "name": "Mapbox Streets",
    "sprite": "mapbox://sprites/mapbox/streets-v8",
    "glyphs": "mapbox://fonts/mapbox/{fontstack}/{range}.pbf",
    "sources": {...},
    "layers": [...]
}

Documentation

I suspect that you probably want to use the string format

@ibmsoft
Copy link
Author

ibmsoft commented Sep 11, 2020

thanks,

@ibmsoft ibmsoft closed this as completed Sep 11, 2020
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

2 participants