freebase 获取建筑物和地理位置
我需要获取距离指定点(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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
面积不是距离,而且您可能不希望与值“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)
/location/location/area 属性用于查询覆盖一定面积的位置。因此,您的查询查找以 (45.1603653, 10.7976976) 为中心、面积为 100 公里的建筑物。自然没有匹配的结果。
搜索这些坐标 100 公里范围内的主题需要更多的工作。您需要使用仍处于 Alpha 测试阶段的地理搜索服务。以下查询应该为您提供所需的结果:
一旦您获得了建筑物列表,您就可以查询 MQL Read API 来找出哪些是教堂,如下所示:
目前只有 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:
Once you have that list of buildings, you can query the MQL Read API to find out which ones are churches like this:
Right now its only matching 2 results so you'll probably need to edit some of those topics to mark them as churches.