Local copy of Google Maps javascript files

4,426 views
Skip to first unread message

dmcewan

unread,
Oct 20, 2010, 5:19:05 PM10/20/10
to google-map...@googlegroups.com
Hey, newbie here.  I was wondering if there was any way to not be dependent on the google servers to return the javascript that is used to manipulate the google maps?  Because there is an authentication key this doesn't seem likely, but I thought I would ask.  For example I would like to change the following line from
<script src="http://maps.google.com/maps/api/js?sensor=true" type="text/javascript"></script>

to

<script src="/script/local_google_maps.js?sensor=true" type="text/javascript"></script>

Thanks for any feedback,

David





Ben Appleton

unread,
Oct 20, 2010, 5:36:50 PM10/20/10
to google-map...@googlegroups.com

You could proxy that file (the "bootstrap") but the first thing it does is load more files from Google servers.

> --
> You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group.
> To post to this group, send email to google-map...@googlegroups.com.
> To unsubscribe from this group, send email to google-maps-js-a...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.
>

dmcewan

unread,
Oct 20, 2010, 5:41:36 PM10/20/10
to google-map...@googlegroups.com
That's not really the solution I was hoping for as I am hoping to remove the dependency on the google servers for javascript load entirely.

Thank for the reply though. 

Andrew Leach

unread,
Oct 20, 2010, 6:07:11 PM10/20/10
to google-map...@googlegroups.com
On 20 October 2010 22:41, dmcewan <dmc...@jolira.com> wrote:
> That's not really the solution I was hoping for as I am hoping to remove the
> dependency on the google servers for javascript load entirely.

You can't remove the dependency because you must use the documented
call to the API script in order to stay within the Terms (10.1, 10.13
and probably 10.14(f)). http://code.google.com/apis/maps/terms.html

Chris Broadfoot

unread,
Oct 20, 2010, 7:12:52 PM10/20/10
to google-map...@googlegroups.com
As said above, this is a violation of the terms & services.

But also, *why*? Unless you're using custom tiles, you're relying on us to provide you with tiles and other services anyway.

We have spent a lot of time tweaking performance to ensure that the JavaScript loads in a way that provides the best user experience possible. We also have an amazing CDN that will serve up the JS to your users extremely quickly.

Chris

Luke Mahé

unread,
Oct 20, 2010, 7:37:23 PM10/20/10
to google-map...@googlegroups.com
We don't mind if you cache the bootstrap code for no more than 30 minutes at a time (that is the public caching policy for that file), otherwise we do not guarantee that the API will work correctly. So in other words, your server will need to get a new copy every 30 minutes :)

If you plan to support multiple languages then you should get a copy for each language by specifying &language= in the request and then loading the correct javascript file that matches your users language.

As for caching anything else like the tiles, then that will be against the terms of use.

Thanks

-- Luke

dmcewan

unread,
Oct 20, 2010, 8:06:15 PM10/20/10
to google-map...@googlegroups.com
Hey, thanks for all the feedback; it sounds like this is a no go.

The reason why is just to be as little dependent on a third party server as possible.  Since a web page already has a connection to our server I've noticed a jump in time when it makes a separate connection to the google.com servers.

As I thought it is not really possible, and against the terms and conditions.  That all being said I guess I'll live with the current implementation. 

Thanks again,

David

Nianwei Liu

unread,
Oct 21, 2010, 10:39:52 AM10/21/10
to Google Maps JavaScript API v3

> But also, *why*? Unless you're using custom tiles, you're relying on us to
> provide you with tiles and other services anyway.

Chris/Ben/Luke,

In some IT environment, the way VPN is set up is to allow only
internal traffic, thus, the computer has no access to external network
once on VPN. That's our major wish-list (to allow offline hosting the
scripts) when we answer the survey for enterprise customers. We ended
up go with more expensive network solutions than typical VPN to allow
field works gain access to the internal site. We mostly use our own
tiles and geocoding engine. For us, we are paying for the Intranet
usage of the API, not much for the content and services.

I am not expect this to change, but just want to let the team know
that the need does exist for enterprise customers.

Ashish Joseph

unread,
Apr 2, 2018, 7:43:05 PM4/2/18
to Google Maps JavaScript API v3
I know am responding to a very old thread. But, this is also a matter of optimization. If you are developing a Progressive web app, all your resources are cached(js, css and images) in the browser. But, google maps js files needs to be loaded from google server. No mater what you do to improve the user experience. Its still not any where close as serving from browser cache. I believe we could let people to locally save the JS file and provide better experience for the user.

Thanks
Ashish
Chris

To unsubscribe from this group, send email to google-maps-js-api-v3+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages