Have opinions about JavaScript? We want to hear them. Take the 2018 JavaScript Ecosystem Survey »


1.1.3 • Public • Published


GeoDb - JavaScript client for wft-geodb-js-client The GeoDB API focuses on getting global city and region data. Easily obtain country, region, and city data for use in your apps!

  • Filter cities by name prefix, country, location, time-zone, and even minimum population.
  • Sort cities by name, country code, elevation, and population - or any combination of these.
  • Get all country regions.
  • Get all cities in a given region.
  • Display results in multiple languages.
  • RESTful API adheres to industry best-practices, including HATEOAS-style links to facilitate paging results.
  • Backed by cloud-based load-balanced infrastructure for resiliency and performance!
  • Data is periodically refreshed from GeoNames and WikiData.


  • Since the database is periodically updated, this may very rarely result in certain cities being marked deleted (e.g., duplicates removed). By default, endpoints returning city data will exclude cities marked deleted. However, in the unlikely event that this occurs while your app is paging through a set of affected results - and you care about the paged results suddenly changing underneath - specify includeDeleted=SINCE_YESTERDAY (or SINCE_LAST_WEEK if you're really paranoid!).

Useful Resources

This SDK is automatically generated by the Swagger Codegen project:

  • API version: 1.0.0
  • Package version: 1.1.3
  • Build package: io.swagger.codegen.languages.JavascriptClientCodegen


For Node.js


To publish the library as a npm, please follow the procedure in "Publishing npm packages".

Then install it via:

npm install wft-geodb-js-client --save
Local development

To use the library locally without publishing to a remote npm registry, first install the dependencies by changing into the directory containing package.json (and this README). Let's call this JAVASCRIPT_CLIENT_DIR. Then run:

npm install

Next, link it globally in npm with the following, also from JAVASCRIPT_CLIENT_DIR:

npm link

Finally, switch to the directory you want to use your wft-geodb-js-client from, and run:

npm link /path/to/<JAVASCRIPT_CLIENT_DIR>

You should now be able to require('wft-geodb-js-client') in javascript files from the directory you ran the last command above from.


If the library is hosted at a git repository, e.g. https://github.com/GIT_USER_ID/GIT_REPO_ID then install it via:

    npm install GIT_USER_ID/GIT_REPO_ID --save

For browser

The library also works in the browser environment via npm and browserify. After following the above steps with Node.js and installing browserify with npm install -g browserify, perform the following (assuming main.js is your entry file, that's to say your javascript file where you actually use this library):

browserify main.js > bundle.js

Then include bundle.js in the HTML pages.

Webpack Configuration

Using Webpack you may encounter the following error: "Module not found: Error: Cannot resolve module", most certainly you should disable AMD loader. Add/merge the following section to your webpack config:

module: {
  rules: [
      parser: {
        amd: false

Getting Started

Please follow the installation instruction and execute the following JS code:

var GeoDb = require('wft-geodb-js-client');
var defaultClient = GeoDb.ApiClient.instance;
// Configure API key authorization: UserSecurity
var UserSecurity = defaultClient.authentications['UserSecurity'];
UserSecurity.apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//UserSecurity.apiKeyPrefix['X-Mashape-Key'] = "Token"
var api = new GeoDb.GeoApi()
var cityId = "cityId_example"; // {String} The city id (either native 'id' or 'wikiDataId')
var opts = { 
  'minPopulation': 56, // {Number} Only cities having at least this population
  'radius': 56, // {Number} The location radius within which to find cities
  'distanceUnit': "MI", // {String} The unit of distance: MI | KM
  'asciiMode': false, // {Boolean} Display results using ASCII characters
  'languageCode': "languageCode_example", // {String} Display results in this language
  'limit': 10, // {Number} The maximum number of results to retrieve
  'offset': 0, // {Number} The zero-ary offset index into the results
  'sort': "sort_example", // {String} How to sort the results. Format: ±SORT_FIELD,±SORT_FIELD where SORT_FIELD = countryCode | elevation | name | population
  'includeDeleted': "NONE", // {String} Whether to include any cities marked deleted: ALL | SINCE_YESTERDAY | SINCE_LAST_WEEK | NONE
  'hateoasMode': true // {Boolean} Include HATEOAS-style links in results
api.findCitiesNearCityUsingGET(cityId, opts).then(function(data) {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {

Documentation for API Endpoints

All URIs are relative to https://wft-geo-db.p.mashape.com

Class Method HTTP request Description
GeoDb.GeoApi findCitiesNearCityUsingGET GET /v1/geo/cities/{cityId}/nearbyCities Find cities near city
GeoDb.GeoApi findCitiesNearLocationUsingGET GET /v1/geo/locations/{locationId}/nearbyCities Find cities near location
GeoDb.GeoApi findCitiesUsingGET GET /v1/geo/cities Find cities
GeoDb.GeoApi findRegionCitiesUsingGET GET /v1/geo/countries/{countryId}/regions/{regionCode}/cities Find country region cities
GeoDb.GeoApi getCityDateTimeUsingGET GET /v1/geo/cities/{cityId}/dateTime Get city date-time
GeoDb.GeoApi getCityDistanceUsingGET GET /v1/geo/cities/{cityId}/distance Get city distance
GeoDb.GeoApi getCityTimeUsingGET GET /v1/geo/cities/{cityId}/time Get city time
GeoDb.GeoApi getCityUsingGET GET /v1/geo/cities/{cityId} Get city details
GeoDb.GeoApi getCountriesUsingGET GET /v1/geo/countries Find countries
GeoDb.GeoApi getCountryUsingGET GET /v1/geo/countries/{countryId} Get country details
GeoDb.GeoApi getRegionUsingGET GET /v1/geo/countries/{countryId}/regions/{regionCode} Get region details
GeoDb.GeoApi getRegionsUsingGET GET /v1/geo/countries/{countryId}/regions Find country regions
GeoDb.LocaleApi getCurrenciesUsingGET GET /v1/locale/currencies Find currencies
GeoDb.LocaleApi getLanguagesUsingGET GET /v1/locale/languages Get languages
GeoDb.LocaleApi getLocalesUsingGET GET /v1/locale/locales Get locales
GeoDb.LocaleApi getTimeZoneDateTimeUsingGET GET /v1/locale/timezones/{zoneId}/dateTime Get time-zone date-time
GeoDb.LocaleApi getTimeZoneTimeUsingGET GET /v1/locale/timezones/{zoneId}/time Get time-zone time
GeoDb.LocaleApi getTimezonesUsingGET GET /v1/locale/timezones Get time-zones

Documentation for Models

Documentation for Authorization


  • Type: API key
  • API key parameter name: X-Mashape-Key
  • Location: HTTP header




npm i wft-geodb-js-client

Downloadsweekly downloads





Creative Commons Attribution 3.0

last publish


  • avatar
Report a vulnerability