pelias / geonames

Import pipeline for geonames in to Pelias
https://pelias.io
MIT License
45 stars 37 forks source link

how to import iata into elasticsearch #367

Closed biaggi closed 5 years ago

biaggi commented 5 years ago

Im trying to get the iata from airports in any way from pelias, I've been reading the geocode importer and I've checked the content in elastic search, but haven't seen where is stored the alternative names or if are being stored.

How it works:

As far as I've understood, the document stored for any location follows the pelias-schema

  var doc = {
    name: this.name,
    phrase: this.phrase,
    parent: this.parent,
    address_parts: this.address_parts,
    center_point: this.center_point,
    category: this.category,
    source: this.source,
    layer: this.layer,
    source_id: this.source_id,
    bounding_box: this.bounding_box,
    popularity: this.popularity,
    population: this.population,
    addendum: {},
    polygon: this.shape
  };

What seems to be correct if we compare it with an elastic search document:

{
  "_index": "pelias",
  "_type": "venue",
  "_id": "6299345",
  "_score": 1,
  "_source": {
    "center_point": {
      "lon": -3.56948,
      "lat": 40.49181
    },
    "parent": {
      "continent": [
        "Europe"
      ],
      "continent_id": [
        "102191581"
      ],
      "continent_a": [
        null
      ],
      "country": [
        "Spain"
      ],
      "country_id": [
        "85633129"
      ],
      "country_a": [
        "ESP"
      ],
      "region": [
        "Madrid"
      ],
      "region_id": [
        "85682783"
      ],
      "region_a": [
        "MD"
      ]
    },
    "name": {
      "default": "Adolfo Suárez Madrid–Barajas Airport"
    },
    "source": "geonames",
    "source_id": "6299345",
    "category": [
      "transport:air:airport",
      "transport:air",
      "transport"
    ],
    "layer": "venue"
  }
}

This document should correspond to the following allCountries.txt line:

6299345 Adolfo Suárez Madrid–Barajas Airport    Adolfo Suarez Madrid-Barajas Airport    Adolfo Suarez Madrid-Barajas Airport,Adolfo Suárez Madrid–Barajas Airport,Aehraport Madryd-Barakhas,Aehroport Madrid-Barakhas,Aerodrom Madrid-Barakhas,Aeroport de Madrid-Barajas,Aeroport international de Madrid-Barajas,Aeroporto de Madrid-Barajas,Aeroporto di Madrid-Barajas,Aeroportus Matriti-Barajas,Aeropuerto Adolfo Suarez Madrid-Barajas,Aeropuerto Adolfo Suárez Madrid-Barajas,Aeropuerto de Madrid-Barajas,Aéroport international de Madrid-Barajas,Bandar Udara Internasional Barajas Madrid,Barajas lufthavn,Flughafen Madrid,Flughafen Madrid-Barajas,Flughafen Madrid-Barajas Adolfo Suarez,Flughafen Madrid-Barajas Adolfo Suárez,Flughaveno Madrido-Baraho,Flughaveno Madrido-Baraĥo,LEMD,Lapangan Terbang Barajas,Letishhe Madrid - Barakhas,Letisko Madrid-Barajas,Letiste Madrid-Barajas,Letiště Madrid-Barajas,Luchthaven Madrid-Barajas,MAD,Madrid Barajas Uluslararasi Havalimani,Madrid Barajas Uluslararası Havalimanı,Madrid-Barajas Lufthavn,Madrid-Barajas flygplats,Madrid-Barajasi repueloter Ez a lap egy ellenorzoett valtozataEllenorzoett lapreszletek megjelenitese/elrejtese,Madrid-Barajasi repülőtér Ez a lap egy ellenőrzött változataEllenőrzött laprészletek megjelenítése/elrejtése,Madrid-Barajasin lentoasema,Madridi Barajase lennujaam,Madrid–Barajas Airport,Madril-Barajas aireportua,Port lotniczy Madryt-Barajas,San bay quoc te Madrid Barajas,Sân bay quốc tế Madrid Barajas,Zracna luka Madrid-Barajas,Zračna luka Madrid-Barajas,barahasa antararastriya vimanatala,frwdgah madryd-barakhas,ma de li-ba la ha si ji chang,madeulideu balahaseu gugjegonghang,madorido・barahasu guo ji kong gang,matrit-parahas vimana nilaiyam,mtar mdryd barakhas aldwly,mtar mdryd-barakhas,nml htʻwph mdryd-brʼhs,tha xakasyan nanachati madrid ba rakha s,Аеродром Мадрид-Барахас,Аэрапорт Мадрыд-Барахас,Аэропорт Мадрид-Барахас,Летище Мадрид - Барахас,נמל התעופה מדריד-בראחס,فرودگاه مادرید-باراخاس,مطار مدريد باراخاس الدولي,مطار مدريد-باراخاس,बराहास आंतरराष्ट्रीय विमानतळ,மத்ரித்-பராஹாஸ் விமான நிலையம்,ท่าอากาศยานนานาชาติมาดริดบาราคัส,マドリード・バラハス国際空港,马德里-巴拉哈斯机场,마드리드 바라하스 국제공항    40.49181    -3.56948    S   AIRP    ES      29  M28079  21  0   609 609 Europe/Madrid   2018-07-31

At this point I notice that I have a problem, because I need to search by the alternative name code iata and the elastic search document does not contain such information and in the allCountries.txt is not structured in a way in which is associated the code with the value.

How do I expect it to work

I expect to be able to search by category in a region or geographical boundary and get the iata code value in the result

https://www.geonames.org/6299345/adolfo-suarez-madrid-barajas-airport.html

Any way to achieve this? any suggestion on at least how to search by category or how to import the alternative_names from geocode?

Thank you in advance

missinglink commented 5 years ago

IATA support was recently added to openstreetmap.

If you'd like to add support for geonames too, there are two modifications which need to be made:

  1. Assign the IATA code as an 'alias' for the name so it can be found during search: https://github.com/pelias/openstreetmap/blob/08b84052775f70956ce3dd490f0fa7c7d61ce567/stream/tag_mapper.js#L75-L76

  2. Add the IATA code to the addendum so that it's available in the response json: https://github.com/pelias/openstreetmap/pull/487

Here is an example of a response containing IATA and ICAO data from OpenStreetMap: https://pelias.github.io/compare/#/v1/place%3Fids=openstreetmap:venue:way/158042008

missinglink commented 5 years ago

Searching by categories is a BETA feature, it's supported in the API but not well documented: https://pelias.github.io/compare/#/v1/search%3Fcategories=transport:air:aerodrome&text=TXL

biaggi commented 5 years ago

Thank you for your help, as far as I see my server is not returning the iata in that search, I think that's cos the osm import script failed a couple of times due to lack of space in the hard drive so I have to check the database and the process itself