Nonstop Progressive Marxism

    wft-geodb-js-client

    1.4.8 • Public • Published

    wft-geodb-js-client

    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.

    Notes:

    • 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.4.8
    • Build package: io.swagger.codegen.languages.JavascriptClientCodegen

    Installation

    For Node.js

    npm

    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.

    git

    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-rapidapi-key'] = "Token"
    
    var api = new GeoDb.GeoApi()
    
    var opts = { 
      'location': "location_example", // {String} Only places near this location. Latitude/longitude in ISO-6709 format: ±DD.DDDD±DDD.DDDD
      'radius': 56, // {Number} The location radius within which to find places
      'distanceUnit': "MI" // {String} The unit of distance: MI | KM
      'countryIds': "countryIds_example", // {String} Only places in these countries (comma-delimited country codes or WikiData ids)
      'excludedCountryIds': "excludedCountryIds_example", // {String} Only places NOT in these countries (comma-delimited country codes or WikiData ids)
      'minPopulation': 56, // {Number} Only places having at least this population
      'maxPopulation': 56, // {Number} Only places having no more than this population
      'namePrefix': "namePrefix_example", // {String} Only entities whose names start with this prefix. If languageCode is set, the prefix will be matched on the name as it appears in that language. 
      'timeZoneIds': "timeZoneIds_example", // {String} Only places in these time-zones (comma-delimited)
      'asciiMode': false, // {Boolean} Display results using ASCII characters
      'hateoasMode': true, // {Boolean} Include HATEOAS-style links in results
      '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 place results.  'Format: ±SORT_FIELD,±SORT_FIELD'  where SORT_FIELD = countryCode | elevation | name | population 
      'includeDeleted': "NONE" // {String} Whether to include any divisions marked deleted: ALL | SINCE_YESTERDAY | SINCE_LAST_WEEK | NONE
    };
    api.findAdminDivisionsUsingGET(opts).then(function(data) {
      console.log('API called successfully. Returned data: ' + data);
    }, function(error) {
      console.error(error);
    });
    

    Documentation for API Endpoints

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

    Class Method HTTP request Description
    GeoDb.GeoApi findAdminDivisionsUsingGET GET /v1/geo/adminDivisions Find administrative divisions
    GeoDb.GeoApi findCitiesNearAdminDivisionUsingGET GET /v1/geo/adminDivisions/{divisionId}/nearbyCities Find cities near division
    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 findDivisionsNearAdminDivisionUsingGET GET /v1/geo/adminDivisions/{divisionId}/nearbyDivisions Find divisions near division
    GeoDb.GeoApi findDivisionsNearLocationUsingGET GET /v1/geo/locations/{locationId}/nearbyDivisions Find divisions near location
    GeoDb.GeoApi findRegionCitiesUsingGET GET /v1/geo/countries/{countryId}/regions/{regionCode}/cities Find country region cities
    GeoDb.GeoApi findRegionDivisionsUsingGET GET /v1/geo/countries/{countryId}/regions/{regionCode}/adminDivisions Find country region administrative divisions
    GeoDb.GeoApi getAdminDivisionUsingGET GET /v1/geo/adminDivisions/{divisionId} Get administrative division details
    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 getCityLocatedInUsingGET GET /v1/geo/cities/{cityId}/locatedIn Get this city's containing populated place (e.g., its county or other administrative division)
    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

    UserSecurity

    • Type: API key
    • API key parameter name: x-rapidapi-key
    • Location: HTTP header

    Keywords

    none

    Install

    npm i wft-geodb-js-client

    DownloadsWeekly Downloads

    7

    Version

    1.4.8

    License

    Creative Commons Attribution 3.0

    Unpacked Size

    618 kB

    Total Files

    115

    Last publish

    Collaborators

    • mmogley