pgeocode icon indicating copy to clipboard operation
pgeocode copied to clipboard

Support for partial matching of zip codes

Open zonque opened this issue 6 months ago • 1 comments

Would it be an option to add support for partial zip code matching? When auto-completing a user input, it might be nice to already show available options even if only 3 out of 5 digits were entered, for instance.

zonque avatar Jun 05 '25 20:06 zonque

Internally it's a pandas dataframe. You can probably do something like,

 nomi = pgeocode.Nominatim(country)
mask = nomi._data['postal_code'].str.startswith(prefix)
res = nomi._data[mask]

if you wanted to do this.

I'm less sure about adding an API for this though as it's fairly a niche use case.

rth avatar Jun 05 '25 20:06 rth