位置数据(尤其是法国)

发布于 2024-09-29 08:24:52 字数 256 浏览 1 评论 0原文

伙计们。我正在开发一个项目,需要严格的用户位置(国家,州(或部门或地区)和城市(邮政编码)。我的想法是我不想允许用户输入,因为人们(尤其是法国人) )倾向于忽略自动完成并写出带有一些变化的所有大写字母(例如 PARIS01、PARIS、PARIS 01、LYON(北)),因此它们的位置数据非常混乱。另一方面,我必须提供完整的城市列表。在所有国家/地区都能够强制他们选择一个城市并禁用手动输入。 不管怎样,你能帮我提供一些位置数据源(更好的是免费的还是便宜的),或者告诉我昂贵的数据库有什么优势?

guys. I am developing a project that requires a strict location of a user ( country, state (or department or region) and city (with postal code). The idea is that I do not want to allow user input, as people (especially french people) tend to ignore autocompletes and write all uppercase with some variations (e.g. PARIS01, PARIS, PARIS 01, LYON (Nord)), so their location data is pretty messed up. On the other hand, I have to provide a complete list of cities in all countries to be able to force them select a city and disable manual input.
Anyway, can you help me with some sources of location data ( better free or cheap) or tell me what are the advantages of expesive databases ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

不再见 2024-10-06 08:24:52

几年前,我正在开发一些大量使用邮政编码和地址的金融应用程序。我购买了波兰邮政发行的邮政编码数据库(一张CD)。我不确定法国是否存在这样的事情,但我相信邮政服务公司的网站可能是一个很好的起点。

Few years ago I was developing some financial application that used Zip codes and addresses heavily. I bought zip code data base issued by Polish Post (one CD). I am not sure if such thing exists for France, but I believe Postal services companies' web sites could be a good place to start.

云柯 2024-10-06 08:24:52

这很正常。法语中城市的大写很常见。

您有几种选择:

  • 链接到您的表单的脚本,在输入字段中的所有大写字母后立即转换为小写字母。

例如,我尝试在网站上注册,并将我的用户名全部设置为大写,但是当我完成输入后,脚本会立即转换我的输入。我在注册页面看到很多这样的脚本。

在这种情况下,脚本会在保存数据之前对其进行操作。

如何做到这一点?使用此属性:

> style="text-transform:uppercase"

此处有较长的说明。

  • 另一种可能性不太好,但您也可以通过脚本格式化数据。

在这种情况下,脚本在保存所有用户数据后一起操作它们。

  • 您可以提供格式帮助。

如果人们输入“PARIS01”,那是因为他们不知道如何告诉您他们住在巴黎第一区。您必须提供关于您期望的内容的明确说明(许多网站忘记这样做),并提供所需字段的数量。

例如,如果有人住在“Paris 01”,也可以写成“75 001”(或 75001),因此如果您仅接受邮政编码,而不接受城市名称,则所有数据将具有相同的格式,具有相同的信息。法国邮政编码始终是 2 个部门数字 + 3 个城市数字(包括区)

您可以使用列表轻松将邮政编码转换为城市名称。

例如,我经常使用询问我的邮政编码的网站,它们会自动将邮政编码转换为城市。例如,当我输入 69000 时,它们显示“Lyon”。

That's normal. Uppercase for cities is common in French.

You have several alternative:

  • A script linked to your form, that turn right after the input all the uppercase from a field, into lowercases.

For instance, I try to register on a site, and put my username all in uppercases, but then, a script convert my input as soon as I finished to type. I saw many scripts like this on registering pages.

In this case, the script manipulates the data before they are saved.

How to do this? Use this attribute:

> style="text-transform:uppercase"

The longer explanation is here.

  • The other possibility is less good, but you can also format the data by a script

In this case, the script manipulates all the users data together, after they were saved.

  • You can provide formatting help.

If people enters "PARIS01" it is because they don't know how to tell you that they live in Paris, in the first arrondissement. You have to provide clear instruction about what you expect (a lot of sites forget to do that), and to provide the number of field needed.

For instance, if someone lives in "Paris 01", it can also be written "75 001" (or 75001), so if you accept only post code, and not the name of the city, all the data will have the same format, with the same info. French post code are always 2 numbers for the department + 3 numbers for the city (including the arrondissement)

You can convert easily convert the post code to a city name using a list.

For instance, I use very often sites that ask me for my post code, and they convert automatically the post code to a city. For instance, when I type 69000, they show "Lyon".

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文