通过GPS位置获取城市的WikiData标识符 [英] Get WikiData Identifier for city by GPS location

查看:170
本文介绍了通过GPS位置获取城市的WikiData标识符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在特定的gps位置获得城市/定居点。
表示给定范围内或最接近的最接近的一个。



我在维基媒体数据示例中找到了一些示例查询。



我尝试采用,但我只得到错误或超时



这是我当前的查询:

  SELECT * 
WHERE
{
?city wdt:P31 / wdt:P279 * wd:Q15642541。 //只有定居点
#按最近的$ b $搜索服务wikibase:大约{
?place wdt:P625?location。
bd:serviceParam wikibase:centerPoint(8.4024875340491 48.9993762209831)^^ geo:wktLiteral。
bd:serviceParam wikibase:半径1。
bd:serviceParam wikibase:distance?distance。
}
SERVICE wikibase:label {bd:serviceParam wikibase:languageen}
}
ORDER By?distance

查询在我排除结算条件时起作用。但是当我添加它时,查询需要太长的时间
我在做什么错了?什么是正确的语法?

解决方案

我找到了我的错误。这里是工作查询:

  SELECT DISTINCT * 
WHERE
{
?place wdt :P31 / wdt:P279 * wd:Q515。
#按最近的$ b $搜索服务wikibase:大约{
?place wdt:P625?location。
bd:serviceParam wikibase:centerPoint(8.4024875340491 48.9993762209831)^^ geo:wktLiteral。
bd:serviceParam wikibase:半径10。
bd:serviceParam wikibase:distance?distance。
}
SERVICE wikibase:label {bd:serviceParam wikibase:languageen}
}

按距离排序


I want to get the city /settlement at a specific gps location. meaning the closest one in a given range or at best the closest.

i found some example queries in the wikimedia data examples.

I try to adopt then but i get only errors or timeouts

here is my current query:

 SELECT *
    WHERE
    {
      ?city wdt:P31/wdt:P279* wd:Q15642541 . // only settlements
       # Search by Nearest
  SERVICE wikibase:around { 
    ?place wdt:P625 ?location . 
    bd:serviceParam wikibase:center "Point(8.4024875340491 48.9993762209831)"^^geo:wktLiteral .
    bd:serviceParam wikibase:radius "1" . 
    bd:serviceParam wikibase:distance ?distance .
  }
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    } 
ORDER By ?distance

The query works when i left out the settlement condition. Butwhen i add it the query takes too long What am I doing wrong? Whats the correct syntax?

解决方案

I Found my bug.

here is the working query:

 SELECT DISTINCT *
    WHERE
    {
      ?place wdt:P31/wdt:P279* wd:Q515 .
       # Search by Nearest
  SERVICE wikibase:around { 
    ?place wdt:P625 ?location . 
    bd:serviceParam wikibase:center "Point(8.4024875340491 48.9993762209831)"^^geo:wktLiteral .
    bd:serviceParam wikibase:radius "10" . 
    bd:serviceParam wikibase:distance ?distance .
  }
      SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
    } 

Order by  ?distance

这篇关于通过GPS位置获取城市的WikiData标识符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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