以编程方式查找常见的欧洲街道名称
我正在为德国和法国用户设计一个网页表单。在此表单中,用户必须多次键入街道名称。
我想最大程度地减少对用户的烦恼,并提供基于常见法国和德国街道名称的自动完成功能。
知道哪里可以找到免版税列表吗?
I am in the middle of designing a web form for German and French users. Within this form, the users would have to type street names several times.
I want to minimize the annoyance to the user, and offer autocomplete feature based on common French and German street names.
Any idea where I can a royalty-free list?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
您的用户是否需要多次输入相同的街道名称?因为您可以通过编写预先填充字段的代码来轻松防止这种情况发生。
另一种选择可能是使用您的用户数据库作为资源。查询现有用户输入的所有可用街道名称,并使用它来生成建议。
当然,只有当您拥有相当数量的用户时,这才有效。
[编辑] 你可以看看 OpenStreetMap 及其 Planet.osm 笨蛋(或者查看此处,获取仅包含欧洲数据的转储。这基本上就是 OSM 数据库,其中包含所有地图信息,包括街道名称。全部采用 XML 格式,街道似乎存储为 Ways。有一些工具(即 Osmosis)可以提取数据并将其放入数据库中,或者您可以写一些东西来浏览数据并过滤掉数据库中的街道名称。
Would your users have to type the same street name multiple times? Because you could easily prevent this by coding something that prefilled the fields.
Another option could be to use your user database as a resource. Query it for all the available street names entered by your existing users and use that to generate suggestions.
Of course this would only work if you have a considerable number of users.
[EDIT] You could have a look at OpenStreetMap with their Planet.osm dumbs (or have a look here for a dump containing data for just Europe). That is basically the OSM database with all the map information they have, including street names. It's all in an XML format and streets seem to be stored as Ways. There are tools (i.e. Osmosis) to extract the data and put it into a database, or you could write something to plough through the data and filter out the street names for your database.
从 http://en.wikipedia.org/wiki/Category:Streets_in_Germany 开始,然后http://en.wikipedia.org/wiki/Category:Streets_in_France。您可能需要验证维基百科版权的保护程度是否超出了适合您需求的程度。
编辑(根据我自己的评论合并):当然,要回答问题的“以编程方式”部分:弄清楚如何蜘蛛和抓取那些维基百科类别页面。礼貌的做法是缓存它,而不是每次需要获取街道列表时都点击它;大约每月刷新一次就足够了,因为信息不太可能发生重大变化。
Start with http://en.wikipedia.org/wiki/Category:Streets_in_Germany and http://en.wikipedia.org/wiki/Category:Streets_in_France. You may want to verify the Wikipedia copyright isn't more protective than would be suitable for your needs.
Edit (merged from my own comment): Of course, to answer the "programmatically" part of your question: figure out how to spider and scrape those Wikipedia category pages. The polite thing to do would be to cache it, rather than hitting it every time you need to get the street list; refreshing once every month or so should be sufficient, since the information is unlikely to change significantly.
您可以首先通过 Google API 提取名称(只需找到例如巴黎的纬度/经度外部边界并转到中心) - 但由于 Google 限制 API 使用,因此可能需要很长时间才能完成。
我曾经就街道名称列表联系过布拉迪斯拉发市,他们将其以 XLS 形式发送给我。也许您可以尝试为您喜欢的城市这样做。
You could start by pulling names via Google API (just find e.g. lat/long outer bounds - of Paris and go to the center) - but since Google limits API use, it would probably take very long to do it.
I had once contacted City of Bratislava about the street names list and they sent it to me as XLS. Maybe you could try doing that for your preferred cities.
我喜欢 Tom van Enckevort 的建议,但我会更具体一点,只是查看 Planet.osm 链接内部,因为大多数链接都需要使用某种工具来处理支持的格式(pbf、osm xml 等)
。 ,看看下面的链接
http://download.gisgraphy.com/openstreetmap/
那里的文件都是 .txt 格式,如果您只想使用街道名称,只需提取第二个字段(名称)即可完成。
仅供参考,我在项目中对法语文件没有任何用处,但挖掘德语文件(标准化后)产生了略多于 380K 的唯一条目(大小约为 6 MB)
I like Tom van Enckevort's suggestion, but I would be a little more specific that just looking inside the Planet.osm links, because most of them require the usage of some tool to deal with the supported formats (pbf, osm xml etc)
In fact, take a look at the following link
http://download.gisgraphy.com/openstreetmap/
The files there are all in .txt format and if it's only the street names that you want to use, just extract the second field (name) and you are done.
As an fyi, I didn't have any use for the French files in my project, but mining the German files resulted (after normalization) in a little more than 380K unique entries (~6 MB in size)
@dusoft 可能会做一些事情 - 也许政府级别的人可以提供帮助?我不认为简单的街道名称列表不能受版权保护,也不能收取任何版税。如果是这样的话,也许您甚至可以从 TomTom 等设备上抓取一些地图数据?
@dusoft might be onto something - maybe someone at a government level can help? I don't think that a simple list of street names cannot be copyrighted, nor any royalties be charged. If that is the case, maybe you could even scrape some mapping data from something like a TomTom?
《德国邮报》提供了德国所有街道名称的列表:
http://www.deutschepost.de/dpag?xmlFile=link1015590_3877
他们不不提价格,但我认为它不是免费的。
The "Deutsche Post" offers a list with all street names in Germany:
http://www.deutschepost.de/dpag?xmlFile=link1015590_3877
They don't mention the price, but I reckon it's not for free.