Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Google maps API access from China #229

Open
JulienOrain opened this issue May 12, 2015 · 7 comments
Open

Google maps API access from China #229

JulienOrain opened this issue May 12, 2015 · 7 comments

Comments

@JulienOrain
Copy link

Hey guys !
Thanks for the project !
I have some trouble to use your lib from China.

My access to maps.googleapis.com is forbidden.
The problem is clearly linked to the following page : https://developers.google.com/maps/faq#china_ws_access

Could you do something like a fallback on maps.google.cn when the access to maps.googleapis.com is not successful ?

(In order to test this, you can set the hosts file on your computer to not resolve the google apis URL by adding the following in your hosts file: 0.0.0.0 maps.googleapis.com)

Thanks in advance !
Julien

@Ctrl-X
Copy link

Ctrl-X commented Jun 15, 2015

I have the same need! Please help!

@gbougiakas
Copy link

Unfortunately, I don't think that's possible.

This project uses Google loader to load the Maps APIs from Google (https://developers.google.com/loader/) which does not official supports Maps (http://stackoverflow.com/questions/5296115/can-you-load-google-maps-api-v3-via-google-ajax-api-loader)

I think the only way to get Chinese maps is by using the new API

<script type="text/javascript" src="http://maps.google.cn/maps?file=api&v=2&key=abcdefg&sensor=true"> which is not used by this project (and I don't know if that can change). I don't even know how long google will support the loader API for their maps. It might stop alltogether at some point.

@branflake2267
Copy link
Owner

You'll have to load the api another way, instead of using the api. As long as the javascript you want gets injected you can use the wrapping api. Or patches are welcome.

@gbougiakas
Copy link

Hello,

Can you please elaborate? I tried injecting the new API code and stopped using the old one (commented it out) and it won't work.

Regards

@branflake2267
Copy link
Owner

Hm, not sure what's going on. Either the api has diverged to much or the javascript isn't available before the api is called. Usually it happens to be the javascript isn't attached to the dom yet, and the api is called and you get an undefined.

@gbougiakas
Copy link

The code in this library eventually calls this:

AjaxLoader.loadApi("maps", API_VERSION, onLoad, settings);

If I get this commented out, I get a blank pane instead of a map which is normal.

However, even if I inject my page with the latest official Google Maps API:

http://maps.google.com/maps/api/js?sensor=false

I can see the javascript loaded using my browser's inspector but I still get a blank pane instead of a map.

I reckon the new maps API uses different objects/JS names etc so the GWT lib won't pick them up.

I hope I am wrong but I think this is what the case is.

Thanks a lot for your time and for replying.

Regards,
George

@gbougiakas
Copy link

gbougiakas commented Oct 12, 2016

Nothing I tried worked. Maybe the JS objects from the old API are completely different than the ones from the new one. I am attaching a screenshot of what the old one and the new one loads.

old:
https://www.dropbox.com/s/18ob51sg4yjsoni/Old.PNG?dl=0

new
https://www.dropbox.com/s/ow4s1tdpls6phqt/New.PNG?dl=0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants