簡體   English   中英

如何根據Freebase中的位置過濾?

[英]how to filter according location in freebase?

我一直在嘗試根據位置過濾建議,但未成功。 我想顯示國家/地區的所有地點,城市,城鎮,村庄:印度

我應該對以下代碼進行哪些更改?

<script type="text/javascript">
$("#myinput")
  .suggest({
    "key": "my key",
  filter: '(any type:/location/location )'

  })
 .bind("fb-select", function(e, data) {
   alert(data.name + ", " + data.id + " (" + data['n:type'].name + ")");
});
      </script>

使用搜索過濾器執行此操作的方法是使用像這樣的part_of 謂詞

<script type="text/javascript">
$("#myinput")
  .suggest({
    "key": "my key",
  filter: '(all type:/location/location part_of:/m/03rk0)'

  })
 .bind("fb-select", function(e, data) {
   alert(data.name + ", " + data.id + " (" + data['n:type'].name + ")");
});
</script>

所述part_of Metaschema謂詞是傳遞的,這意味着它Freebase主題是匹配part_of印度(/米/ 03rk0)或part_of其是位置part_of印度等

Shawn的方法適用於正確設置了包含屬性的主題,但我不確定覆蓋范圍是否良好。 我懷疑簡單的地理數據(經/緯度)覆蓋范圍會更好。 如果您只想過濾與印度重心的距離,則可以執行以下操作:

filter=(all type:/location/location (within radius:500km+lon:82.7948 lat:21.7866))

https://www.googleapis.com/freebase/v1/search?indent=true&filter=%28all+type%3A/location/location+%28within+radius%3A500km+lon%3A82.7948+lat%3A21.7866%29 %29&輸出=%28geocode%29

請注意,這是非常粗略的文檔,我不確定這是否是全新的文檔以及文檔尚未完成或不推薦使用而即將消失。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM