An enterprise client of ours is using the Google Maps Layer of OpenLayers we of course exceeded our permitted 2,500 queries per day quite quickly. The anticipated traffic of the website after we relaunch is expected to exceed this number so it was imperative that we sign up for Google Maps API for Business. This comes with a $10,000 a year price tag, but it was necessary for this client to ensure proper functionality of their key user flows.
We are using OpenLayers and noticed that it doesn't provide support for Google Maps for Business customers in that there is no administrative field to collect the client or private key parameters as dictated by https://developers.google.com/maps/documentation/business/webservices/auth. For any Javascript API call, only the client parameter is required, but any server side call (as done in OpenLayers Proximity for example) requires both.
I believe the OpenLayers module should support the client field such that it can be added to the query string:
<script src="http://maps.googleapis.com/maps/api/js?client=YOUR_CLIENT_ID&sensor=true_or_false&v=3.13"></script>
It is the inclusion of this parameter, as well as providing Google with a list of permitted URLs from which Geocoding is permissible that allows a client running Google Maps for Business Javascript API to have 100,000 queries a day instead of the 2,500 given for free.
I have rolled a patch against 7.x-2.0-beta1 as this is the version of the module we're currently using but I am happy to re-roll it against the most current version if you are accepting of the change.
I have also rolled a second patch against the 2.x-dev branch of the OpenLayers Proximity module that uses the second private key variable to ensure proper signing of all URLs. As OpenLayers is a dependency of that module, I have included that parameter in this patch as well.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | google-maps-for-business-param-support-2151043-3.patch | 1.88 KB | timfernihough |
| client-id-added-in-source.png | 51.44 KB | timfernihough |
Comments
Comment #1
timfernihough commentedHere is the patch file
Comment #2
timfernihough commentedComment #3
timfernihough commentedSorry, had a whitespace issue. Proper patch is here.
Comment #4
timfernihough commentedComment #5
pianomansam commentedWe've been rocking this patch since it came out. I think it's time this gets committed!
Comment #7
timfernihough commentedHi @pianomansam, I haven't been actively following responses in a long time. I'm glad to hear my patch was helpful to someone else! I'll look at getting this re-rolled against the active dev branch shortly and hopefully it can get committed!