freebase 获取建筑物和地理位置

发布于 2024-11-01 22:15:24 字数 528 浏览 4 评论 0原文

我需要获取距离指定点(lat,lng)100公里远的所有具有“教堂”功能的建筑物。我是这样做的:

[{
"id":            null,
"name":          null,
"type":          "/architecture/building",
"building_function" : [{"name" : 'church'}],
"/location/location/geolocation" : {"latitude" : 45.1603653, "longitude" : 10.7976976}
"/location/location/area" : 100
}]​

但我总是得到空的回应

code: "/api/status/ok"
result: []
status: "200 OK"
transaction_id: "cache;cache03.p01.sjc1:8101;2011-04-16T12:32:45Z;0035"

我错过了什么? 谢谢

I need to get all the buildings with "church" function that are far 100km from a specified point (lat, lng). I made in this way:

[{
"id":            null,
"name":          null,
"type":          "/architecture/building",
"building_function" : [{"name" : 'church'}],
"/location/location/geolocation" : {"latitude" : 45.1603653, "longitude" : 10.7976976}
"/location/location/area" : 100
}]​

but I alway get an empty response

code: "/api/status/ok"
result: []
status: "200 OK"
transaction_id: "cache;cache03.p01.sjc1:8101;2011-04-16T12:32:45Z;0035"

What am I missing?
Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

梦魇绽荼蘼 2024-11-08 22:15:24

面积不是距离,而且您可能不希望与值“100”完全匹配。您所要求的东西恰好位于该长/纬度并且具有该面积。

您是否正在寻找小于一定距离、大于一定距离或恰好是给定距离的教堂?您可能想查看 Geosearch API http://api.freebase.com/api/ service/geosearch?help (尽管它不是一个长期解决方案,因为它已被弃用)

An area isn't a distance and you probably don't want an exact match to the value "100" anyway. You've asked for things which are precisely at that long/lat and have exactly that area.

Are you looking for churches which are less than a certain distance, more than a certain distance, or exactly the given distance? You probably want to look at the Geosearch API http://api.freebase.com/api/service/geosearch?help (although it's not a long term solution since it's been deprecated)

苹果你个爱泡泡 2024-11-08 22:15:24

/location/location/area 属性用于查询覆盖一定面积的位置。因此,您的查询查找以 (45.1603653, 10.7976976) 为中心、面积为 100 公里的建筑物。自然没有匹配的结果。

搜索这些坐标 100 公里范围内的主题需要更多的工作。您需要使用仍处于 Alpha 测试阶段的地理搜索服务。以下查询应该为您提供所需的结果:

http://www.freebase.com/api/service/geosearch?location={%22type%22:%22Point%22,%22coordinates%22:[10.7976976,45.1603653]}&type=/architecture/building&within=100&indent=1

一旦您获得了建筑物列表,您就可以查询 MQL ​​Read API 来找出哪些是教堂,如下所示:

[{
  "id": null,
  "name": null,
  "type": "/architecture/building",
  "building_function" : [{"name" : 'church'}],
  "filter:id|=":[
    "/en/verona_arena",
    "/en/basilica_palladiana",
    "/en/teatro_olimpico",
    "/en/palazzo_del_te",
    "/en/villa_capra_la_rotonda",
    "/en/villa_badoer",
    "/en/san_petronio_basilica",
    "/en/palazzo_schifanoia",
    "/en/palazzo_chiericati",
    "/en/basilica_di_santandrea_di_mantova",
    "/en/basilica_of_san_domenico",
    "/en/castello_estense",
    "/en/palazzo_dei_diamanti",
    "/en/villa_verdi",
    "/en/cathedral_of_cremona",
    "/en/monte_berico",
    "/en/villa_pojana",
    "/en/san_sebastiano",
    "/en/cremona_baptistery",
    "/en/palazzo_della_pilotta"
  ]
}]​

目前只有 2 个匹配结果,因此您可能需要编辑其中一些主题以将它们标记为教堂。

The /location/location/area property is used to query locations which cover a certain amount of area. So your query looks for buildings centered at (45.1603653, 10.7976976) which cover an area of 100km. Naturally there are no results that match.

Searching for topics within 100km of a those coordinates takes a little more work. You'll need to use the Geosearch service which is still in alpha. The following query should give you the results that you're looking for:

http://www.freebase.com/api/service/geosearch?location={%22type%22:%22Point%22,%22coordinates%22:[10.7976976,45.1603653]}&type=/architecture/building&within=100&indent=1

Once you have that list of buildings, you can query the MQL Read API to find out which ones are churches like this:

[{
  "id": null,
  "name": null,
  "type": "/architecture/building",
  "building_function" : [{"name" : 'church'}],
  "filter:id|=":[
    "/en/verona_arena",
    "/en/basilica_palladiana",
    "/en/teatro_olimpico",
    "/en/palazzo_del_te",
    "/en/villa_capra_la_rotonda",
    "/en/villa_badoer",
    "/en/san_petronio_basilica",
    "/en/palazzo_schifanoia",
    "/en/palazzo_chiericati",
    "/en/basilica_di_santandrea_di_mantova",
    "/en/basilica_of_san_domenico",
    "/en/castello_estense",
    "/en/palazzo_dei_diamanti",
    "/en/villa_verdi",
    "/en/cathedral_of_cremona",
    "/en/monte_berico",
    "/en/villa_pojana",
    "/en/san_sebastiano",
    "/en/cremona_baptistery",
    "/en/palazzo_della_pilotta"
  ]
}]​

Right now its only matching 2 results so you'll probably need to edit some of those topics to mark them as churches.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文