使用GeoIndex引用

时间:2016-04-08 10:57:03

标签: json indexing python-2.x geo geopoints

我是GeoIndex的新手。目前我有~1600个地理标记图像,我正在使用GeoIndex查找我的点(或我当前位置)的某个半径范围内的所有图像,一切正常,它返回与查询匹配的点。但是,由于每个图像都有唯一的URL,我需要能够维护Geo坐标和URL之间的链接。

例如:

def find_distance(index,myLocation,arraySearch,radius):

    myUrlArray = []
    for coords in arraySearch:
        index.add_point(GeoPoint(coords[0],coords[1]))

    for point,distance in index.get_nearest_points(myLocation,radius,'km'):
        print point

myLocation作为参数传入,名为arraySearch的数组包含以下格式从JSON文件读取的数据:

arraySearch = [(latitudecoordinate,longitudecoordinate,url)]

运行上面的函数时,我得到以下输出:

Point(54.573307, -5.998721)
Point(54.600225, -5.920579)
Point(54.598671, -5.918605)
Point(54.598671, -5.918605)
Point(54.598671, -5.918605)
Point(54.598671, -5.918605)
Point(54.598671, -5.918605)
Point(54.598671, -5.918605)
Point(54.601469, -5.921652)
Point(54.601493, -5.920901)

理想情况下我想:

(Point(x,y),URL)

提前感谢!

编辑以修正代码中的缩进错误

1 个答案:

答案 0 :(得分:1)

然后,您只需将该网址包含在object structure中的<div class="container" style="overflow: hidden;"> <div class="row"> <div class="col-lg-12"> <div class="modal-header"> <h3 class="modal-title">Please Confirm</h3> </div> <div class="modal-body"> Some Text Here </div> <div class="modal-footer"> <button class="btn btn-warning css3linear" type="button" ng-click="ok()" autofocus>OK</button> <button class="btn btn-warning css3linear" type="button" ng-click="cancel()">Cancel</button> </div> </div> </div> 广告位中:

ref

由于def find_distance(index,myLocation,arraySearch,radius): myUrlArray = [] for value in arraySearch: index.add_point(GeoPoint(value[0],value[1], ref=value[2])) for point,distance in index.get_nearest_points(myLocation,radius,'km'): print point, point.ref 对象未在Point方法中包含此属性,因此您需要将其添加到上述__repr__语句中。