简体   繁体   English

如何使用 Google 地点 API 获取城市的地理编码(坐标)和人口(公民人数)? 我应该使用哪些请求?

[英]How to get the geocode(coordinates) and population (count of civils) of the city with the Google places API? Which requests I should use?

I'm developing a studying project in java spring-boot.我正在 java spring-boot 开发一个学习项目。 I have used only places API (I have a key).我只用过地方 API(我有钥匙)。 I don't want to register at another Google API, I'm afraid about billing))我不想在另一个 Google API 注册,我怕计费))

For example, the following request:例如,以下请求:

https://maps.googleapis.com/maps/api/geocode/json?address=Moscow&key=APP_KEY

finished with code 200 OK, and JSON response完成代码 200 OK 和 JSON 响应

{
    "error_message": "This API project is not authorized to use this API.",
    "results": [],
    "status": "REQUEST_DENIED"
}

I resolve the problem by getting geocode.我通过获取地理编码解决了这个问题。 I just get enabled Geocoding API, and my key from Places Api was usable to Geocoding API.我刚刚启用了地理编码 API,而我来自 Places Api 的密钥可用于地理编码 API。

Now question only how to get population due to Google API.现在只问如何通过 Google API 获取人口。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM