Menu

GeoDB Cities API - Find Cities For Your Criteria | Wirefree Thought

How To Get City Tourist Attractions

Getting a city's GPS location, population, and elevation is all well and good, but what about when you're building:

  • A history app that shows a timeline of significant events?
  • A travel app that needs to show famous landmarks and tourist attractions?
  • Just a fun app that shows all the famous people born in a given city?

All of this and more is possible by integrating with WikiData, the machine-consumable version of Wikipedia.

GeoDB now offers WikiData integration by tying all countries and regions, as well as most cities, to a unique WikiData entity id.

Want to delve in? See our latest tutorial walking you through how to find the tourist attractions in New York City.

Display Results In Multiple Languages!

Besides English, you can now display cities, regions, and countries in one of the following languages:

  • French
  • German
  • Italian
  • Russian
  • Spanish

For details, please go to the API Reference sections which have been updated to describe the new languageCode param.

The translations are based on WikiData and dependent on the completeness of the data there. (If you see something missing or wrong, please correct it in WikiData. The PRO instance will receive the correction during its daily refresh cycle.)

Let us know what you think!

Other Enhancements

  • WikiData Integration (more on this later)
  • For languages based on Latin characters, you can now display results back without accent marks. See the new asciiMode param described in the API docs.
  • Getting a country's details now also returns its flag image link.

Bug Fixes

  • The namePrefix filter now ignores diacritical marks for languages using Latin characters.
  • The mapping of cities to regions has been corrected.

Sort Cities, Get The User's Current City, And More

All API operations returning city collection results now provide an optional sort parameter taking multiple sort directives. What this means is you can now do something like get all cities sorted by country code, then by name. Or get all cities near a location, sorted by largest cities first.

And speaking of location, the following new operation is now available:

curl --get --include 'https://wft-geo-db.p.mashape.com/v1/geo/locations/{locationId}/nearbyCities?radius={radius}&distanceUnit={KM | MI)' \
    -H 'X-Mashape-Key: YOUR_API_KEY' \
    -H 'X-Mashape-Host: wft-geo-db.p.mashape.com'

Among other things, this now allows you an easy way to get the user's current city.

Bug Fixes

  • The HATEOAS links for paged results have been corrected to include any specific query parameters from the original request.
  • The parameters related to location filtering have been renamed to be shorter. If you've been relying on these parameters, please make a note to update your code for the changed names. (Note: Any future such changes will be scoped by a new version of the API, insulating code relying on the previous version.) These changes are:
    • nearLocation → location
    • nearLocationRadius → radius
    • nearLocationRadiusUnit → distanceUnit

Let Freedom Ring!

Over the holidays, we went through a spiritual transformation and got in touch with our giving side. Drum roll...GeoDB now provides a FREE instance with the following generous usage limits:

Up to 5 requests/sec per unique IP.

For more details, go here to compare with the Pro levels.

Santa's Got More: Distance Between Cities, Location Enhancements

You can now find the distance between any two cities.

curl --get --include 'https://wft-geo-db.p.mashape.com/v1/geo/cities/{fromCityId}?toCityId={toCityId}&distanceUnit={KM | MI)' \
    -H 'X-Mashape-Key: YOUR_API_KEY' \
    -H 'X-Mashape-Host: wft-geo-db.p.mashape.com'

In addition...

Find-Cities API Enhancements

  • When finding cities using location criteria, GeoDB will now include each city's distance from the requested location, sorting results by distance.
  • All city results now include latitude/longitude, saving you a trip to the Get-City-Details API.

View older posts »