Menu

GeoDB Cities API

More Data, More Functionality

GeoDB now pulls in many new small cities and towns, for a total of over 525,000 populated places. As part of this update, you may now see cities with zero population. This usually just means the population data is currently not available from GeoNames/Wikipedia (but it could also mean you're seeing a ghost town).

In addition, you now have an easy way to find a city's containing adninistrative region (for example, its county or other local administrative division).

For example, to get the containing county for Los Angeles:

GET https://wft-geo-db.p.rapidapi.com/v1/geo/cities/Q60/locatedIn

Please see the docs on this new endpoint for further details.

GraphQL Is Here!

GeoDB now supports GraphQL queries. GraphQL is a relatively new technology, originally developed by Facebook as an efficient way of querying the complex relationships inherent in their social domain model.

GraphQL's primary advantage over REST is the ability to get back exactly what you want - and only what you want - in a single request.

For example, this query gets back the US flag image URI, its region names, and the names and populations of the cities in each region, with the regional cities sorted by larger population first:

{
  country(id:"US") {
    name
    flagImageUri
    regions(first:3) {
      totalCount
      pageInfo {
        startCursor
        endCursor
        hasNextPage
      }
      edges {
        node {
          wikiDataId
          name
          populatedPlaces(types:["CITY"], sort:"-population", first:3) {
            totalCount
            pageInfo {
              startCursor
              endCursor
              hasNextPage
            }
            edges {
              node {
                id
                wikiDataId
                name
                population
              }
            }
          }
        }
      }
    }
  }
}

The REST version of this would require one request to get the country details, one to get the regions, one for each region to get its cities (3), then one for each city to get its population details (9) - for a total of 14 requests! The REST version will also give you back a lot of fields you don't care about.

Please have a look at the updated portal docs illustrating the difference between REST and GraphQL calls and give the new API a spin.

To see what's possible with the new GeoDB GraphQL API, check out the full schema docs.

Feedback is welcome!

 

Host It Yourself!

GeoDB can now easily be hosted in your own environment as a Docker container. This may make sense if you have any or all of the following requirements:

  • Maximum performance
    • A dedicated instance that's not shared with other users
    • Colocation with other services to maximize response throughput and minimize latencies
    • No Rapid API proxy layer
    • No request-throttling limits
    • Up to 5 load-balanced instances
  • No max-paging-limit restrictions
  • Unlimited requests
  • Full control over the instance

All new self-hosting plans start with a free two-week trial. See pricing for details.

Major Data Update

We have been working hard over the past few months and are proud to announce the following updates:

  • Data has almost doubled to currently over 266,000 cities and towns.
  • Data is now over 95% correlated with Wikidata.
  • All invalid region mappings have been addressed.
  • The database logic has been completely rewritten to improve response times and throughput.

In addition, GeoDB now hosts its own dedicated Wikidata instance that syncs regularly with the mothership. This will allow us to expand city details with new interesting Wikidata factoids in the future.

 

Last but definitely not least, everyone please stay safe and healthy. May these grim fearful days soon be a distant memory for us all.

 

Administrative Divisions Are Here

In addition to regular cities and towns, GeoDB now supports 2nd-level administrative divisions, with currently over 17,000 in the database. These typically represent counties and districts, depending on the country.

Because the difference between what is considered a city or a district can sometimes be a matter of semantics in certain countries, GeoDB returns both types by default from any of the existing cities endpoints. To delineate between the two, all cities endpoints now expose a new optional types param which can be used to specify one or the other type (CITY or ADM2) to return.

In addition, the following new endpoint operations are now available to explicitly support returning administrative divisions only (this is a convenience as all of the same data may be returned from existing cities endpoints using types=[ADM2] as a constraint):

Please have a look at the updated docs for full details. Enjoy!

View older posts »