-
-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Zipcode and Canton is not a One-to-One relationship #46
Comments
Yeah, this library is not perfect. :)
Zipcode search was an aftertought for this package and has been added in #6 many years ago. As you mention, the code currently assumes that a zipcode has a one-to-one relationship with a canton. What we could do, is rewrite the package so that certain methods return an array/collection of Cantons/Zipcodes. The consumer of the package then still have to figure out, which canton to choose. That's not something the package can solve based on a single data point (zipcode). |
I totally agree. To determine the canton, we'd need at least the zipcode and the city name. But is there any city identifier other than the name ? Or at least a reference liste ? |
As you mentioned in #33, the link in the README/issue points to a 404 now. I haven't figured out yet, where the Swiss Post now publishes these values. I found this asset on opendata.swiss, but didn't have the time yet to review the data. |
Fixed in #47 and released in https://github.com/stefanzweifel/php-swiss-cantons/releases/tag/5.0.0. |
Hi,
I'm using this library since a few months, thank you for your work !
But unfortunately, some cases don't work when guessing the canton from the zipcode.
In fact, in Switzerland, a zipcode (NPA) does not contain the information of a specific canton. It's based on geographical and physical information, like train endpoint. For some zipcode, you can have different cities, which are in different cantons.
Example: 1290 is assigned to Chavanne-les-bois in the canton of Vaud, and Versoix in the canton of Geneva.
It's the same issue with zipcode and cities: a city can have several zipcode...
Example: Kefikon has a zipcode for its part in Thurgovie canton et a zipcode for its part in Zurich canton..
Conclusion
Is it possible to have a system covering all cases ? If not, it would be necessary to add this information as a warning in the library documentation.
The text was updated successfully, but these errors were encountered: