Charmatzis / react-leaflet-google

GoogleMaps layer as React component for Leaflet | This repo is obsolete. Plz, use https://github.com/TA-Geoforce/react-leaflet-google
https://github.com/TA-Geoforce/react-leaflet-google
MIT License
29 stars 60 forks source link

Add ability to specify Client ID #4

Closed rajadain closed 7 years ago

rajadain commented 8 years ago

Hi!

This PR adds the ability for premium plan users to use their client id, instead of the API Key which is used by regular users. This adds support for a boolean flag that states whether the specified key is a regular key or a client id. The flag should default to false and is not required, thus existing implementations should not break and this should be backward compatible.

Example usage:

<GoogleLayer
    googlekey={googleKey} asclientid
    type={googleMapType}
    mapOptions={{ styles: googleMapStyles }}
/>

See here for details: https://developers.google.com/maps/documentation/javascript/get-api-key

Thanks.

rajadain commented 8 years ago

If you'd like me to change the casing of the new option let me know. I think I'd prefer asClientId but decided to follow the existing convention of the googlekey.

Charmatzis commented 8 years ago

Nice one!!!! But how can we test it, if it works?

rajadain commented 8 years ago

Good question. I know it is working because I'm using it for an internal project, but that doesn't help me prove it to those who don't have access to it. I wonder if we can find an open source project that uses a Client ID to test with ...

Charmatzis commented 8 years ago

That's right. Since I find a little bit time I try to merge the request with a test and give a big update. THX, again. PS. If you want to change anything else I am open to any changes!!!

rajadain commented 8 years ago

I would also add that the change is simply following the documentation in google-maps.

rajadain commented 7 years ago

We may also want to upgrade the Google Maps API version to 3.25 here. Or make it configurable. The currently hard-coded one has been retired.