GeoDB Cities

FREEMIUM
Verified
By Michael Mogley | Updated 16 дней назад | Data
Popularity

9.9 / 10

Latency

61ms

Service Level

100%

Health Check

100%

Back to All Discussions

How to get town list ?

Rapid account: Hotech
hotech
4 года назад

Country = Germany
Region = Berlin State
City = Berlin

How do I get a list of towns or similar places in Berlin ? Is there a query for this ?

Rapid account: Wirefreethought
wirefreethought Commented 4 года назад

Yes, unfortunately, beyond population, I have no way of knowing what distinguishes a town from a small city. I rely largely on GeoNames data and it does not distinguish cities from towns. It’s possible WikiData might, but so far this use-case does not appear to be popular enough to warrant the significant effort that would be involved in attempting to address it.

Rapid account: Hotech
hotech Commented 4 года назад

I know the solution population but some towns have more populations than some small cities 😃 . Unfortunately no constant value for population. It can change for each country . Anyway thank you for help.

Rapid account: Wirefreethought
wirefreethought Commented 4 года назад

Perhaps what you’re looking for is a way to limit cities not just by minPopulation by also by maxPopulation. That second param is currently not implemented. Let me know if you need it and I will work on adding it to the api.

Rapid account: Wirefreethought
wirefreethought Commented 4 года назад

There is no distinction between a city, town, or village, other than by population. You can limit the cities returned to have a certain minimum population (minPopulation param).

Rapid account: Hotech
hotech Commented 4 года назад

Is it possible to separate data from city query as city, town, village or something like that?

Rapid account: Wirefreethought
wirefreethought Commented 4 года назад

For Berlin (see previous response), use v1/geo/cities/Q64/nearbyDivisions?radius=50

Rapid account: Hotech
hotech Commented 4 года назад

types=ADM2 query parameter not exist for every region or city datas . So how can i get for just county datas in Berlin City ?

Rapid account: Wirefreethought
wirefreethought Commented 4 года назад

It’s a two-step process. First you must find Berlin the city. Then using that City ID, find the nearest cities to it using the find-cities-near-city endpoint. To find a city ID for Berlin:

GET /v1/geo/cities?namePrefix=berlin

Once you get the ID, save it for later reuse.

Now you can do: GET /v1/geo/cities/Q64/nearbyCities?radius=50 (to get cities and towns within 50 miles of Berlin, default distanceUnit=MI)

As far as your second question , you can filter country regions cities by the ADM2 type as follows:

GET /v1/geo/countries/{countryId}/regions/{regionCode}/cities?types=ADM2

Join in the discussion - add comment below:

Login / Signup to post new comments