Which URL to use for Google Maps for China?

一世执手 提交于 2019-12-08 07:07:10

问题


I want to load the Google Maps JavaScript API, and I want it to be accessible from within the Great Firewall of China.

Google recommends http://maps.google.cn, but if I use this it might be slower for people in other parts of the world.

From what I've read, The Great Firewall of China doesn't block http:// addresses from Google, so I might be able to use http://maps.googleapis.com/ also.

Has anyone tried this out and can you offer advice on which one is better to use, in terms of reliability and speed?

N.B. I don't want to use Baidu Maps.


回答1:


Since you're restricted with using Maps in China, you'll really be restricted in HTTP. This is their answer from the FAQs page

Why can't I access Google Maps APIs from China?

The Google Maps APIs are served within China from the domain maps.google.cn. This domain does not support https. When making requests to the Google Maps APIs from China, please replace https://maps.googleapis.com with http://maps.google.cn.

For example:

https://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA would become:

http://maps.google.cn/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA

The Google Maps JavaScript API can be loaded with the following bootstrap:

<script src="http://maps.google.cn/maps/api/js?key=YOUR_API_KEY" type="text/javascript"> </script>

I cannot comment in terms of reliability and speed, but I guess it will still be the same since Google still handles it. @scaisedge's answer can give you his experience with the domain change.




回答2:


I tried an application that makes heavy use goggle maps v3 both : using the API standard and using those provided by China. I did not notice problems appreciable slowdown indeed in some cases, access to the site of China with the use of the API has detected more performative than the normal use of the API. If there are situations of slowdown think they are related to the normal load flow characteristic of the Internet.



来源:https://stackoverflow.com/questions/34515405/which-url-to-use-for-google-maps-for-china

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!