Hi,
I'm having issue adding JSON style to the Google maps Common map. Not sure if I look over something or if I don't understand something, but here is the issue.
I have created a cloud map style with the corresponding map ID.
- I can't find a place to enter the custom map id so it takes over the styling.
- When adding the JSON map styles, I'm getting the following error
Google Maps JavaScript API: A Map's styles property cannot be set when a mapId is present. When a mapId is present, map styles are controlled via the cloud console. Please see documentation at https://developers.google.com/maps/documentation/javascript/styling#clou...
Question is. Is styling not supported in the 4.x branch or am I doing something completely wrong?
Comments
Comment #2
hemangi.gokhaleYes, indeed, this is an issue. Using 4.x
The only info we're getting is in the console: Google Maps JavaScript API: A Map's styles property cannot be set when a mapId is present. When a mapId is present, map styles are controlled via the cloud console. Please see documentation at https://developers.google.com/maps/documentation/javascript/styling#clou...
Comment #3
flyke commentedComment #4
flyke commentedI have created a patch that allows for overriding the mapId in the related issue. It does not (yet) have a UI setting for it, but I have included demo code there how you could alter the mapId via custom code (in a custom module, if the patch is applied).
I just want to note also that the json of maps style in the Google Cloud Console (thats V2) is different than the json of maps style that was used before, like in the geolocation commonmap settings (thats V1). I found this website that allows you to paste the JSON of old (V1) maps style which converts it to new (V2) maps style that you can use in Cloud Console.
Comment #5
christianadamski commentedMergeRequest with change from #3584097: Styling via Google Cloud Console: allow setting google map element mapId property and the option to set ID from Drupal
Comment #6
christianadamski commentedMerged https://git.drupalcode.org/project/geolocation/-/merge_requests/134