pelias / wof-admin-lookup

Who's on First Admin Lookup for the Pelias Geocoder
https://pelias.io
MIT License
9 stars 24 forks source link

fix(postalCities): Do not assign a parent that is already there #280

Closed orangejulius closed 4 years ago

orangejulius commented 4 years ago

Our postal cities code originally from https://github.com/pelias/wof-admin-lookup/pull/232 can cause multiple parent IDs to end up the same.

In practice, how this ends up working is with borough placetypes, where the postal cities code assigns a borough ID to the locality_id parent field.

This is problematic for two reasons:

  1. It causes the resulting locality_gid property returned by the Pelias API to be incorrect
  2. It creates incorrect labels in areas with boroughs, like NYC. An example is a label changing from 132 Dean Street, Brooklyn, New York, NY, USA to 132 Dean Street, Brooklyn, Brooklyn, NY, USA

This change ensures that there can't be any duplicate IDs created in this way, which should solve both the particular problem mentioned here, as well as others we might find in the future.