Getting Places For A Metropolitan Area
Below we find all places with 100 miles of any large place (with populations of at least 500000).
GraphQL
curl --request POST \ --url https://geodb-cities-graphql.p.rapidapi.com/ \ --header 'content-type: application/json' \ --header 'x-rapidapi-host: geodb-cities-graphql.p.rapidapi.com' \ --header 'x-rapidapi-key: YOUR_API_KEY' \ --data '{"query":"QUERY"}'
Where QUERY:
{ populatedPlaces(minPopulation:500000, sort:"name", first:10) { totalCount pageInfo{ startCursor endCursor hasNextPage } edges { node { id name nearbyPopulatedPlaces(radius:100, distanceUnit:MI, first:10) { totalCount pageInfo{ startCursor endCursor hasNextPage } edges { node { id name distance } } } } } } }
REST
1. First, find the metropolitan area.
curl --get --include 'https://wft-geo-db.p.rapidapi.com/v1/geo/places?minPopulation=500000offset=0&limit=10' \ -H 'x-rapidapi-key: YOUR_API_KEY' \ -H 'x-rapidapi-host: wft-geo-db.p.rapidapi.com'
2. Now find all places within some regional radius of some place from the previous results:
curl --get --include 'https://wft-geo-db.p.rapidapi.com/v1/geo/places/{PLACE_ID}/nearbyPlaces?radius=100&distanceUnit=MI&offset=0&limit=10' \ -H 'x-rapidapi-key: YOUR_API_KEY' \ -H 'x-rapidapi-host: wft-geo-db.p.rapidapi.com'