Menu

GeoDB Cities API

Getting Cities & Suburbs For a metropolitan area

1. First, find the metropolitan city from the list of cities with populations greater than some number defining a metropolis for your case (500,000 in the example below):

curl --get --include 'https://wft-geo-db.p.mashape.com/v1/geo/cities?minPopulation=500000offset=0&limit=10' \
    -H 'X-Mashape-Key: YOUR_API_KEY' \
    -H 'X-Mashape-Host: wft-geo-db.p.mashape.com'

2. Now find all cities within some regional radius of some city from the previous results:

curl --get --include 'https://wft-geo-db.p.mashape.com/v1/geo/cities/{cityId}/nearbyCities?radius={radius}&distanceUnit={distanceUnit}&minPopulation={minPopulation}&sort={sort}=offset=0&limit=500' \
    -H 'X-Mashape-Key: YOUR_API_KEY' \
    -H 'X-Mashape-Host: wft-geo-db.p.mashape.com'

Where:

minPopulationOnly cities having at least this population
radiusThe location radius in which to find cities
distanceUnitMI (miles) or KM (kilometers)
sortOptionally, how to sort the results. Format: ±SORT_FIELD,±SORT_FIELD where SORT_FIELD = countryCode | elevation | name | population