filter only sublocalities in google maps api

后端 未结 2 1335
迷失自我
迷失自我 2021-01-27 03:58

I want to get nearby sublocalities in google maps api

var input = document.getElementById(\'searchTextField\');         
    var autocomplete = new google.maps.p         


        
2条回答
  •  长情又很酷
    2021-01-27 04:26

    I had a similar usecase too. I did not have a way to do it using google maps api. But, you can try getting geometry (lat, lng) from Autocomplete getPlaces() and use geonames.org API to get nearby sublocalities giving lat, lng and radius

    http://api.geonames.org/findNearbyPlaceNameJSON?lat=13.041703&lng=80.251943&radius=5&username=demo

提交回复
热议问题