Daursu/postcode-lookup

Zipcode lookup for German zipcodes, that have matching us zipcodes, doesnt work.

Opened this issue · 1 comments

Zipcodes in germany will return american addresses, since germany has same zipcodes and the logic that builds the query ends up in an geocode url that always returns the us address.

There should be a change to the logic that includes the country in the url for the actual geocode lookup, as the way its doing it now (using address and then concatening the country code) doesnt work if the address can be found in the us.

This url for example can retrieve a german postalcode:
CORRECT IN THIS CASE:
https://maps.googleapis.com/maps/api/geocode/json?components=country:DE%7Cpostal_code:96049&sensor=false&key=AIzaSyDjLOlUJpE2E3UL4vXZgGJONYbf5C6dRXs.

In contrary, if you just use the address=96120+DE thingy, it will just return us addresses.
WRONG:
https://maps.googleapis.com/maps/api/geocode/json?address=96120+DE&sensor=false&key=AIzaSyDjLOlUJpE2E3UL4vXZgGJONYbf5C6dRXs.

Let me know if you need more info, i would be happy to help if you need a PR for this, love the rest of this library.