维基百科反向查找地理标记 [英] Reverse wikipedia geotagging lookup

查看:232
本文介绍了维基百科反向查找地理标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

维基百科地理标记一个的很多 的rel=\"nofollow\">的文章的。 (看在页面的右上角。)

Wikipedia is geotagging a lot of its articles. (Look in the top right corner of the page.)

是否有查询一个地域的指定半径内的所有的地理标签页中的API持何立场?

Is there any API for querying all geotagged pages within a specified radius of a geographical position?

好了,所以基于失去了理论的回答我想这(对 DBpedia中查询浏览):

Okay, so based on lost-theory's answer I tried this (on DBpedia query explorer):

PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
SELECT ?subject ?label ?lat ?long WHERE {
    ?subject geo:lat ?lat.
    ?subject geo:long ?long.
    ?subject rdfs:label ?label.
    FILTER(xsd:float(?lat) - 57.03185 <= 0.05 && 57.03185 - xsd:float(?lat) <= 0.05
        && xsd:float(?long) - 9.94513 <= 0.05 && 9.94513 - xsd:float(?long) <= 0.05
        && lang(?label) = "en"
    ).
} LIMIT 20

这是非常接近我想要的,但它(本地)内返回结果平方左右的点,而不是一个圆圈。此外,我想如果排序基于从点的距离,其中的结果。 (如果可能的话)。

This is very close to what I want, except it returns results within a (local) square around the point and not a circle. Also I would like if the results where sorted based on the distance from the point. (If possible.)

我试图确定欧几里得距离为真实距离的近似值,但我有在SPARQL平方一些麻烦。 (问题这里打开。)当我得到一些有用的东西,我会更新的问题,但在此期间我将AP preciate的替代办法的任何建议。

I am trying to determine the euclidean distance as an approximation of the true distance, But I am having trouble on squaring a number in SPARQL. (Question opened here.) When I get something useful I will update the question, but in the meantime I will appreciate any suggestions on alternative approaches.

最后更新。我放弃了通过使用DBpedia中SPARQL。我写了一个简单的解析器读取维基百科的文章文字每晚数据库转储并解析为地理codeS的所有文章。它的工作原理相当不错,这让我可以存储有关,但是我想地理标记的文章的信息。

A final update. I gave up on using SPARQL through DBpedia. I have written a simple parser which fetches the Wikipedia article text nightly database dump and parses all articles for geocodes. It works rather nicely and it allows me to store information about geotagged articles however I wish.

这可能是解决方案,我会继续使用,如果我避开创建一个漂亮的界面给它我可能会考虑允许公共API访问和/或发布源解析器。

This is probably the solution I will continue using, and if I get around to create a nice interface to it I might consider allowing public API access and/or publishing the source to the parser.

推荐答案

由DBpedia的端点使用的炫技OpenLink公司服务器有多个查询功能。我发现 http://docs.openlinksw.com/virtuoso/rdfsparqlgeospat.html对于类似的问题是有用的。

The OpenLink Virtuoso server used by the dbpedia endpoint has several query features. I found the information on http://docs.openlinksw.com/virtuoso/rdfsparqlgeospat.html useful for a similar problem.

我结束了一个查询像这样的:

I ended up with a query such as this:

SELECT ?page ?lat ?long (bif:st_distance(?geo, bif:st_point(15.560278, 58.394167)))
WHERE{
    ?m foaf:page ?page.
    ?m geo:geometry ?geo.
    ?m geo:lat ?lat.
    ?m geo:long ?long.
    FILTER (bif:st_intersects (?geo, bif:st_point(15.560278, 58.394167), 30))
}
ORDER BY ASC 4 LIMIT 15

这个例子从原点位置检索30公里范围内的标记的位置。

This example retrieves the geotagged locations within 30 km from the origin position.

这篇关于维基百科反向查找地理标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆