google-mapsgoogle-geocoding-apigreat-firewall-of-china

Does google map in china api not support key?


I've tried to get city information for china users

http://maps.google.cn/maps/api/geocode/json?latlng=39.934574,116.342378&key=MyAPI

It wasn't worked

http://maps.google.cn/maps/api/geocode/json?latlng=39.934574,116.342378

I removed key and try again

works fine

MyAPI key don't need anymore in china? If so Why google request to set API key in other country? And why not request in china?

How I set my API Key to get city information in china

just remove my key?


Solution

  • The first request with an API key didn't work, because a Server API key requires https protocol. Unfortunately, maps.google.cn domain does not support https [1].

    [1] https://developers.google.com/maps/faq#china_ws_access

    Web Service request without an API key apparently supports http protocol, so you can get results.

    The difference between request with API key and request without an API key consists in how Google calculates your usage.

    When you apply API key your usage is calculated against the developer console project. When you don't apply API key your usage is calculated against IP address. You have 2500 daily requests, but if you share the same IP address with somebody else, you will be unable to use all 2500 daily requests. That's why an API key is recommended.

    In your case requests without an API key might be a workaround, but you cannot be sure that your daily usage will reach 2500.