使用SPARQL和Dbpedia根据long和lat查询给定半径内的城市
Use SPARQL and Dbpedia to query for cities within a given radius based on long and lat
我一直在尝试使用 DBpedia 和 SPARQL 根据地理位置获取城市。
例如,http://dbpedia.org/page/Berlin
具有属性
geo:lat: 52.516666 (xsd:float)
geo:long: 13.383333 (xsd:float)
并且我想根据位置和给定半径查询城市。
例如,我想找到 lat: 51.5033640 和 long: -0.1276250
10 公里以内的城市
我知道这给了我城市 --
SELECT ?city WHERE { ?city rdf:type dbo:City }
-- 但我不知道如何使用过滤器来根据半径过滤掉。有人知道吗?
使用 Virtuoso GeoSpatial 函数 bif:st_intersects
和 bif:st_point
:
使用几何对象(伦敦坐标没有城市,更改为 dbo:Place
以查看伦敦周围是否还有其他对象):
SELECT * {
?city a dbo:City ;
geo:geometry ?geo
FILTER ( bif:st_intersects( ?geo, bif:st_point (-0.1276250, 51.5033640), 10))
}
或 lat/long:
SELECT * {
?city a dbo:City ;
geo:lat ?lat ;
geo:long ?long .
FILTER ( bif:st_intersects( bif:st_point (?long, ?lat), bif:st_point (-0.1276250, 51.5033640), 10))
}
我一直在尝试使用 DBpedia 和 SPARQL 根据地理位置获取城市。
例如,http://dbpedia.org/page/Berlin
具有属性
geo:lat: 52.516666 (xsd:float)
geo:long: 13.383333 (xsd:float)
并且我想根据位置和给定半径查询城市。 例如,我想找到 lat: 51.5033640 和 long: -0.1276250
10 公里以内的城市我知道这给了我城市 --
SELECT ?city WHERE { ?city rdf:type dbo:City }
-- 但我不知道如何使用过滤器来根据半径过滤掉。有人知道吗?
使用 Virtuoso GeoSpatial 函数 bif:st_intersects
和 bif:st_point
:
使用几何对象(伦敦坐标没有城市,更改为 dbo:Place
以查看伦敦周围是否还有其他对象):
SELECT * {
?city a dbo:City ;
geo:geometry ?geo
FILTER ( bif:st_intersects( ?geo, bif:st_point (-0.1276250, 51.5033640), 10))
}
或 lat/long:
SELECT * {
?city a dbo:City ;
geo:lat ?lat ;
geo:long ?long .
FILTER ( bif:st_intersects( bif:st_point (?long, ?lat), bif:st_point (-0.1276250, 51.5033640), 10))
}