Google Maps places API to only return cities?

后端 未结 2 1455
星月不相逢
星月不相逢 2021-02-07 15:36

I am trying to use Google\'s map API to only return cities from their json request:

 https://maps.googleapis.com/maps/api/place/autocomplete/json?input=green%20l         


        
2条回答
  •  被撕碎了的回忆
    2021-02-07 16:06

    This is an old question, but the accepted answer is not correct for the specific question.

    The correct argument for the types parameter to return only cities is (cities). So the complete URL would be:

    https://maps.googleapis.com/maps/api/place/autocomplete/json?input=green%20lanes&types=(cities)&key= API_KEY_HERE

    You can see more information here. Also, I omitted the sensor parameter since it's not needed anymore.

提交回复
热议问题