T
T
tenaro2016-11-28 12:46:02
JavaScript
tenaro, 2016-11-28 12:46:02

How to get nearest cities using google maps api?

The task is to get all cities within a radius of 50km from a given point using google maps js api
1) search for places nearby, nearbySearch - when specifying types: ['locality', 'administrative_area_level_3'] - returns only 2 cities for each request, but you need to get ALL cities within the radius. I didn't find anything about it in the doc.
if you do not specify the type and parse the answer yourself - a maximum of 60 places come up, which may not include all cities.
2) bulk search, radarSearch - you cannot specify a city type, 200 places come up, which again may not include cities, and for each place you need to send a request with its place_id to determine whether it is a city or not - this is too expensive
3) I made a lot of marks, placed them along the boundaries of the map viewport and at some distance, I check each by geocoding whether it is in the city or not - again a problem - Google does not allow geocoding more than 5 points, only with breaks of 2 seconds, this does not fit,
tell me what else is possible try

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Eremin, 2016-12-08
@Sergei_Erjemin

Quote from Wikipedia:
You can simply collect all the necessary attributes for all cities of the Russian Federation and find the nearest one without any API of any maps.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question