{"version":3,"file":"myrmidon-cadmus-refs-geonames-lookup.mjs","sources":["../../../../projects/myrmidon/cadmus-refs-geonames-lookup/src/lib/services/geonames.service.ts","../../../../projects/myrmidon/cadmus-refs-geonames-lookup/src/lib/services/geonames-ref-lookup.service.ts","../../../../projects/myrmidon/cadmus-refs-geonames-lookup/src/public-api.ts","../../../../projects/myrmidon/cadmus-refs-geonames-lookup/src/myrmidon-cadmus-refs-geonames-lookup.ts"],"sourcesContent":["import { HttpClient } from '@angular/common/http';\r\nimport { Injectable } from '@angular/core';\r\nimport { Observable, catchError, retry } from 'rxjs';\r\n\r\nimport { ErrorService } from '@myrmidon/ngx-tools';\r\n\r\n/**\r\n * A GeoNames request.\r\n */\r\nexport interface GeoNamesRequest {\r\n  url?: string;\r\n  userName: string;\r\n}\r\n\r\n/**\r\n * GeoNames search types.\r\n */\r\nexport enum GeoNamesSearchType {\r\n  query = 0,\r\n  name,\r\n  nameEquals,\r\n  nameStartsWith,\r\n}\r\n\r\n/**\r\n * A GeoNames bounding box.\r\n */\r\nexport interface GeoNamesBBox {\r\n  north: number;\r\n  south: number;\r\n  east: number;\r\n  west: number;\r\n}\r\n\r\n/**\r\n * A GeoNames search request.\r\n * See https://www.geonames.org/export/geonames-search.html.\r\n */\r\nexport interface GeoNamesSearchRequest extends GeoNamesRequest {\r\n  /**\r\n   * The type of search. This maps to parameter q, name, name_equals,\r\n   * or name_startsWith.\r\n   */\r\n  searchType: GeoNamesSearchType;\r\n  /**\r\n   * The text to search for, which is the value of the parameter specified\r\n   * by searchType.\r\n   */\r\n  text: string;\r\n  /**\r\n   * The maximum number of rows to return. Default is 100.\r\n   */\r\n  maxRows?: number;\r\n  /**\r\n   * The start row. Default is 0.\r\n   */\r\n  startRow?: number;\r\n  /**\r\n   * The countries to search in. If not specified, all countries are searched.\r\n   * ISO 3166-1 alpha-2 codes. This maps to the parameter country, which can\r\n   * be repeated.\r\n   */\r\n  countries?: string[];\r\n  /**\r\n   * The country bias. ISO 3166-1 alpha-2 code. Records from the country bias\r\n   * are listed first in the search result. Default is no bias.\r\n   */\r\n  countryBias?: string;\r\n  /**\r\n   * The continent code.\r\n   */\r\n  continentCode?: 'AF' | 'AS' | 'EU' | 'NA' | 'OC' | 'SA' | 'AN';\r\n  /**\r\n   * The administrative division code 1.\r\n   */\r\n  adminCode1?: string;\r\n  /**\r\n   * The administrative division code 2.\r\n   */\r\n  adminCode2?: string;\r\n  /**\r\n   * The administrative division code 3.\r\n   */\r\n  adminCode3?: string;\r\n  /**\r\n   * The administrative division code 4.\r\n   */\r\n  adminCode4?: string;\r\n  /**\r\n   * The administrative division code 5.\r\n   */\r\n  adminCode5?: string;\r\n  /**\r\n   * The feature class codes in a string. Each feature class is encoded\r\n   * by a single character. Default is all feature classes. Allowed characters\r\n   * are:\r\n   * - A (administrative divisions: country, state, region...)\r\n   * - H (hydrographic features: oceans, rivers, lakes...),\r\n   * - L (landscapes: parks, areas...)\r\n   * - P (populated places: city, village...)\r\n   * - R (roads: road, railroad...)\r\n   * - S (spots: building, farm...)\r\n   * - T (terrains: mountain, hill, rock...)\r\n   * - U (undersea)\r\n   * - V (vegetation: forest, heath...)\r\n   * This maps to the parameter featureClass, which can be repeated.\r\n   */\r\n  featureClasses?: string;\r\n  /**\r\n   * The feature codes. The default is all feature codes.\r\n   * See https://www.geonames.org/export/codes.html.\r\n   * This maps to the parameter featureCode, which can be repeated.\r\n   */\r\n  featureCodes?: string[];\r\n  /**\r\n   * The cities, used to categorize the populated places into three groups\r\n   * according to size/relevance.\r\n   */\r\n  cities?: 'cities1000' | 'cities5000' | 'cities15000';\r\n  /**\r\n   * Language of returned 'name' element (the pseudo language code 'local'\r\n   * will return it in local language). Default value is 'local', else\r\n   * use ISO-639 2-letter language code.\r\n   */\r\n  lang?: string;\r\n  /**\r\n   * The language to limit the search to. This will only consider names\r\n   * in the specified language, and is used in combination with the name\r\n   * parameter.\r\n   */\r\n  searchLang?: string;\r\n  /**\r\n   * The requested format type for the result. Default is XML.\r\n   */\r\n  type?: 'xml' | 'json' | 'rdf';\r\n  /**\r\n   * Verbosity of the result.\r\n   */\r\n  style?: 'SHORT' | 'MEDIUM' | 'LONG' | 'FULL';\r\n  /**\r\n   * At least one of the search term needs to be part of the place name.\r\n   * Example: A normal search for Berlin will return all places within\r\n   * the state of Berlin. If we only want to find places with 'Berlin'\r\n   * in the name we set the parameter isNameRequired to 'true'. The difference\r\n   * to the name_equals parameter is that this will allow searches for\r\n   * 'Berlin, Germany' as only one search term needs to be part of the name.\r\n   */\r\n  isNameRequired?: boolean;\r\n  /**\r\n   * Search toponyms tagged with the specified tag. GeoNames is using a\r\n   * simple tagging system. Every user can tag places. In contrast to the\r\n   * feature codes and feature classes which are one-dimensional (a place\r\n   * name can only have one feature code) several tags can be used for each\r\n   * place name. If you want to search for tags of a particular user,\r\n   * append <c>@username</c> to the tag.\r\n   */\r\n  tag?: string;\r\n  /**\r\n   * The operator to use when combining multiple search terms.\r\n   */\r\n  operator?: 'AND' | 'OR';\r\n  /**\r\n   * The charset to use for the result. Default is UTF-8.\r\n   */\r\n  charset?: string;\r\n  /**\r\n   * The fuzziness of the search terms, ranging from 0 to 1. Only for\r\n   * the name attribute.\r\n   */\r\n  fuzzy?: number;\r\n  /**\r\n   * The bounding box to search in.\r\n   */\r\n  bbox?: GeoNamesBBox;\r\n  /**\r\n   * In combination with the name_startsWith, if set to 'relevance' then\r\n   * the result is sorted by relevance.\r\n   */\r\n  orderBy?: 'relevance' | 'population' | 'elevation';\r\n  /**\r\n   * Include Bbox info, regardless of style setting. Normally only\r\n   * included with style=FULL.\r\n   */\r\n  inclBbox?: boolean;\r\n}\r\n\r\n/**\r\n * A GeoNames toponym.\r\n */\r\nexport interface GeoNamesToponym {\r\n  geonameId: number;\r\n  lat: number;\r\n  lng: number;\r\n  name: string;\r\n  toponymName: string;\r\n  alternateNames?: string[];\r\n  numberOfChildren?: number;\r\n  fcl?: string;\r\n  fclName?: string;\r\n  fcode?: string;\r\n  fcodeName?: string;\r\n  continentCode?: string;\r\n  countryId?: string;\r\n  countryCode?: string;\r\n  countryName?: string;\r\n  adminCode1?: string;\r\n  adminName1?: string;\r\n  adminCode2?: string;\r\n  adminName2?: string;\r\n  adminCode3?: string;\r\n  adminName3?: string;\r\n  adminCode4?: string;\r\n  adminName4?: string;\r\n  adminCode5?: string;\r\n  adminName5?: string;\r\n  timezone?: string;\r\n  population?: number;\r\n  elevation?: number;\r\n}\r\n\r\n/**\r\n * The result of a GeoNames search.\r\n */\r\nexport interface GeoNamesSearchResult {\r\n  totalResultsCount: number;\r\n  geonames: GeoNamesToponym[];\r\n}\r\n\r\nconst GEONAMES_URL = 'https://secure.geonames.org/';\r\n\r\n/**\r\n * A service to search GeoNames.\r\n */\r\n@Injectable({\r\n  providedIn: 'root',\r\n})\r\nexport class GeoNamesService {\r\n  constructor(private _http: HttpClient, private _error: ErrorService) {}\r\n\r\n  /**\r\n   * Get a single toponym by its GeoNames ID.\r\n   * @param geonameId The GeoNames ID.\r\n   * @param userName The GeoNames user name.\r\n   * @returns The toponym, or undefined if not found.\r\n   */\r\n  public get(\r\n    geonameId: number,\r\n    userName: string\r\n  ): Observable<GeoNamesToponym> {\r\n    return this._http\r\n      .get<GeoNamesToponym>(GEONAMES_URL + 'getJSON', {\r\n        params: {\r\n          geonameId: geonameId.toString(),\r\n          username: userName,\r\n          type: 'json',\r\n        },\r\n      })\r\n      .pipe(retry(3), catchError(this._error.handleError));\r\n  }\r\n\r\n  /**\r\n   * Search GeoNames for toponyms.\r\n   * @param request The search request.\r\n   * @returns The search result.\r\n   */\r\n  public search(\r\n    request: GeoNamesSearchRequest\r\n  ): Observable<GeoNamesSearchResult> {\r\n    // adapt request to query parameters\r\n    const r: any = Object.assign({}, request);\r\n    delete r.searchType;\r\n    delete r.text;\r\n    delete r.url;\r\n    if (request.bbox) {\r\n      r.north = request.bbox.north;\r\n      r.south = request.bbox.south;\r\n      r.east = request.bbox.east;\r\n      r.west = request.bbox.west;\r\n    }\r\n\r\n    switch (request.searchType) {\r\n      case GeoNamesSearchType.query:\r\n        r.q = request.text;\r\n        break;\r\n      case GeoNamesSearchType.name:\r\n        r.name = request.text;\r\n        break;\r\n      case GeoNamesSearchType.nameEquals:\r\n        r.name_equals = request.text;\r\n        break;\r\n      case GeoNamesSearchType.nameStartsWith:\r\n        r.name_startsWith = request.text;\r\n        break;\r\n    }\r\n\r\n    // remove undefined values\r\n    const filteredParams = Object.fromEntries(\r\n      Object.entries(r)\r\n        .filter(([key, value]) => value !== undefined)\r\n        .map(([key, value]) => [key, String(value)])\r\n    );\r\n\r\n    console.log(`${request.url || GEONAMES_URL}search: `, filteredParams);\r\n\r\n    return this._http\r\n      .get<GeoNamesSearchResult>((request.url || GEONAMES_URL) + 'search', {\r\n        params: { ...filteredParams },\r\n      })\r\n      .pipe(retry(3), catchError(this._error.handleError));\r\n  }\r\n}\r\n","import { Inject, Injectable, InjectionToken } from '@angular/core';\r\nimport {\r\n  RefLookupFilter,\r\n  RefLookupService,\r\n} from '@myrmidon/cadmus-refs-lookup';\r\n\r\nimport { Observable, of } from 'rxjs';\r\nimport { map } from 'rxjs/operators';\r\n\r\nimport {\r\n  GeoNamesSearchRequest,\r\n  GeoNamesService,\r\n  GeoNamesToponym,\r\n} from './geonames.service';\r\n\r\n/**\r\n * The token to provide the GeoNames user name.\r\n */\r\nexport const GEONAMES_USERNAME_TOKEN = new InjectionToken('GEONAMES_USERNAME');\r\n\r\n/**\r\n * Base options for a GeoNames search request.\r\n */\r\nconst BASE_OPTIONS: GeoNamesSearchRequest = {\r\n  searchType: 0,\r\n  text: '',\r\n  userName: '',\r\n  type: 'json',\r\n};\r\n\r\n/**\r\n * GeoNames reference lookup service.\r\n * You should provide the GEONAMES_USERNAME_TOKEN token with your\r\n * GeoNames user name.\r\n */\r\n@Injectable({\r\n  providedIn: 'root',\r\n})\r\nexport class GeoNamesRefLookupService implements RefLookupService {\r\n  public readonly id = 'geonames';\r\n\r\n  constructor(\r\n    @Inject(GEONAMES_USERNAME_TOKEN) private _userName: string,\r\n    private _geonames: GeoNamesService\r\n  ) {}\r\n\r\n  /**\r\n   * Lookup toponyms.\r\n   * @param filter The filter.\r\n   * @param options The search options.\r\n   * @returns Observable of toponyms.\r\n   */\r\n  public lookup(\r\n    filter: RefLookupFilter,\r\n    options?: GeoNamesSearchRequest\r\n  ): Observable<GeoNamesToponym[]> {\r\n    if (!filter.text) {\r\n      return of([]);\r\n    }\r\n    if (!options) {\r\n      options = BASE_OPTIONS;\r\n    }\r\n\r\n    // override userName if not set\r\n    if (!options.userName) {\r\n      options.userName = this._userName;\r\n    }\r\n\r\n    // override max rows and text\r\n    if (options) {\r\n      options.maxRows = filter.limit;\r\n    } else {\r\n      options = BASE_OPTIONS;\r\n    }\r\n    options.text = filter.text;\r\n\r\n    console.info('GeoNames lookup: ', options);\r\n    return this._geonames.search(options).pipe(\r\n      map((r) => {\r\n        return r.geonames;\r\n      })\r\n    );\r\n  }\r\n\r\n  /**\r\n   * Get the name to display for the specified toponym.\r\n   * @param item The toponym.\r\n   * @returns The name to display for the specified toponym.\r\n   */\r\n  public getById(id: string): Observable<GeoNamesToponym | undefined> {\r\n    const geonameId = parseInt(id, 10);\r\n    if (isNaN(geonameId)) {\r\n      return of(undefined);\r\n    }\r\n    return this._geonames.get(geonameId, this._userName);\r\n  }\r\n\r\n  public getName(item: GeoNamesToponym): string {\r\n    if (!item) {\r\n      return '';\r\n    }\r\n    const sb: string[] = [];\r\n    sb.push(item.name);\r\n\r\n    // admin names\r\n    if (item.adminName1) {\r\n      sb.push(', ');\r\n      sb.push(item.adminName1);\r\n    }\r\n    if (item.adminName2) {\r\n      sb.push(', ');\r\n      sb.push(item.adminName2);\r\n    }\r\n    if (item.adminName3) {\r\n      sb.push(', ');\r\n      sb.push(item.adminName3);\r\n    }\r\n    if (item.adminName4) {\r\n      sb.push(', ');\r\n      sb.push(item.adminName4);\r\n    }\r\n    if (item.adminName5) {\r\n      sb.push(', ');\r\n      sb.push(item.adminName5);\r\n    }\r\n\r\n    // country\r\n    if (item.countryName) {\r\n      sb.push(' (');\r\n      sb.push(item.countryName);\r\n      sb.push(')');\r\n    }\r\n\r\n    return sb.join('');\r\n  }\r\n}\r\n","/*\r\n * Public API Surface of cadmus-refs-geonames-lookup\r\n */\r\n\r\nexport * from './lib/services/geonames.service';\r\nexport * from './lib/services/geonames-ref-lookup.service';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i1.GeoNamesService"],"mappings":";;;;;;;AAcA;;AAEG;IACS;AAAZ,CAAA,UAAY,kBAAkB,EAAA;AAC5B,IAAA,kBAAA,CAAA,kBAAA,CAAA,OAAA,CAAA,GAAA,CAAA,CAAA,GAAA,OAAS;AACT,IAAA,kBAAA,CAAA,kBAAA,CAAA,MAAA,CAAA,GAAA,CAAA,CAAA,GAAA,MAAI;AACJ,IAAA,kBAAA,CAAA,kBAAA,CAAA,YAAA,CAAA,GAAA,CAAA,CAAA,GAAA,YAAU;AACV,IAAA,kBAAA,CAAA,kBAAA,CAAA,gBAAA,CAAA,GAAA,CAAA,CAAA,GAAA,gBAAc;AAChB,CAAC,EALW,kBAAkB,KAAlB,kBAAkB,GAAA,EAAA,CAAA,CAAA;AAmN9B,MAAM,YAAY,GAAG,8BAA8B;AAEnD;;AAEG;MAIU,eAAe,CAAA;AACN,IAAA,KAAA;AAA2B,IAAA,MAAA;IAA/C,WAAA,CAAoB,KAAiB,EAAU,MAAoB,EAAA;QAA/C,IAAA,CAAA,KAAK,GAAL,KAAK;QAAsB,IAAA,CAAA,MAAM,GAAN,MAAM;IAAiB;AAEtE;;;;;AAKG;IACI,GAAG,CACR,SAAiB,EACjB,QAAgB,EAAA;QAEhB,OAAO,IAAI,CAAC;AACT,aAAA,GAAG,CAAkB,YAAY,GAAG,SAAS,EAAE;AAC9C,YAAA,MAAM,EAAE;AACN,gBAAA,SAAS,EAAE,SAAS,CAAC,QAAQ,EAAE;AAC/B,gBAAA,QAAQ,EAAE,QAAQ;A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