fawmi / vue-google-maps

Reactive Vue 3 components for Google maps
https://vue-map.netlify.app
MIT License
196 stars 100 forks source link

Using MapID for styling #104

Open danimalweb opened 2 years ago

danimalweb commented 2 years ago

is it possible to add an extra prop to pass in the MapID which is used to access styles?

https://developers.google.com/maps/documentation/get-map-id

Sorry if I missed this somewhere, I looked through the code and could not find a reference for it.

eric-schmidt commented 2 years ago

@danimalweb I haven't tried this myself, but just happened to notice it when perusing open PRs: https://github.com/fawmi/vue-google-maps/pull/76/commits/4c30b0168423ded7da64ffb1ead8201da0616a6f, which seems to document just what you are looking for. If that works, definitely add a review to https://github.com/fawmi/vue-google-maps/pull/76 😎

fawmi commented 2 years ago

@danimalweb It is possible to define mapId for cloud based styling. Please have a look at the following example. https://stackblitz.com/edit/vue-google-maps-marker-ylrxrd?file=src%2Fcomponents%2FComponentWithMap.vue

Look at the doc (which was added today, thanks to a PR) here: https://vue-map.netlify.app/components/map.html#cloud-based-styling-with-map-id

danimalweb commented 2 years ago

@fawmi & @eric-schmidt This worked! Many thanks. If you have the attribute map-type-id="terrain" on GMapMap The mapId value in the options object will not work. Might be worth adding that as a note in the docs.