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

feat(postal_cities): locality lookup table #218

Closed missinglink closed 6 years ago

missinglink commented 6 years ago

This PR adds support for 'Postal Cities'.

A lookup table is used to select the correct 'Postal City' (locality) for a place based off the postal code.

In the case where the PIP engine also finds a locality, the 'Postal Locality' is preferred and the 'PIP Locality' is added as an alias.

The initial import for the USA is restricted to the ZCTA codes available from the US Census Bureau, the postal codes were associated with their corresponding WOF IDs using a combination of spatial and textual matching techniques.

We strongly encourage issues and pull requests to augment, amend and improve the postcode tables based on local knowledge.

Postcode tables are CSV files with 4 columns:

  1. Postal Code
  2. Whosonfirst ID
  3. Whosonfirst Locality Name
  4. Whosonfirst Locality Abbreviation (where available)

The whosonfirst ID, name and abbreviation can be found using placeholder or the spelunker.

Tests added for https://github.com/pelias/pelias/issues/269 https://github.com/pelias/pelias/issues/184 https://github.com/pelias/pelias/issues/167 and @msmollin

note: I would like to add some more test cases before merging this.

nvkelso commented 6 years ago

In the case where the PIP engine also finds a locality, the 'Postal Locality' is preferred and the 'PIP Locality' is added as an alias.

I strongly suggest preferring the PIP locality name (from the locality's geom) and then backfilling with the postcode locality name instead. Often there are up to ~3 allowed locality names for a Zipcode per USPS guidelines and it's always better to return the "real" locality name in that case.

Related WOF issue is here: https://github.com/whosonfirst-data/whosonfirst-data/issues/202. I'm happy to add these names as properties on the WOF postcode polygons directly.