GoogleWebComponents / google-map

Google Maps web components

Home Page:https://elements.polymer-project.org/elements/google-map

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Google-Map-Directions needs to have property for Client ID

matgutschow opened this issue · comments

My client has a Google Maps account but since it is an enterprise, they have a ClientID rather than an API key. The Google-Map element has the ability to pass clientId. If I include the Google-Map-Directions element on the page I get an error saying 'No API key passed' or "You have included Google Apis multiple times on the page'.

I can resolve this issue if I add a ClientId property on the Google-Map-Directions element.

Also if including ClientId is possible the ability to pass 'Channel' similar to how the Google-Map element allows additional elements when constructing.

Thanks in advance!

If you use client-id or api-key you'll need to it on the other maps elements.

What does pass 'Channel' mean?

@ebidel Sorry if I wasn't specific enough, if there is a way to do this and I'm missing it please let me know. 'Channel' was added for clients using 'client-id' rather than the api key to track usage:
https://developers.google.com/maps/premium/reports/usage-reports

The client-id property isn't exposed on the google-map-directions element, but it is exposed on the google-map element:

<dom-module id="google-map-directions">
  <style>
    :host {
      display: none;
    }
  </style>
  <template>
    <google-maps-api
      api-key="[[apiKey]]"
      language="[[language]]"
      on-api-load="_mapApiLoaded"></google-maps-api>
  </template>
</dom-module>

Which results in this error, because I don't have an api-key, only client-id:
capture

However, if I add the client-id property on the google-map-directions element and pass it to the google-maps-api element it will work as expected and no errors occur.

Ah. Can you file bugs for adding the channel param and another for adding client-id to the directions element?