国外网站设计理念2022年全国文明城市
web/
2025/9/27 15:40:24/
文章来源:
国外网站设计理念,2022年全国文明城市,建设工程规划许可证在哪个网站查询,设计网站公司收费数据集#xff1a;处理geolife数据-CSDN博客 这边的stations#xff0c;找到每个station 最近的其他10个station 1 读取数据
假设已经读完了#xff0c;就是locations
2 保留有用的列
locations.drop([center,user_id],axis1,inplaceTrue)
locations 3 加载几何形状
使用…数据集处理geolife数据-CSDN博客 这边的stations找到每个station 最近的其他10个station 1 读取数据
假设已经读完了就是locations
2 保留有用的列
locations.drop([center,user_id],axis1,inplaceTrue)
locations 3 加载几何形状
使用 shapely 的 wkt 模块来直接从 Well-Known TextWKT格式的字符串中加载几何形状这样就无需手动解析字符串了
shapely.wkt.loads 函数可以将 WKT 格式的字符串转换为 shapely 的几何对象V
locations[extent] locations[extent].apply(wkt.loads)
4 保存为geodataframe
locationsgpd.GeoDataFrame(locations,geometryextent)
locations locations[centroid] locations.geometry.centroid
locations 5 创建kd树
5.1 提取centriod坐标
import numpy as np
coordinates np.array(list(locations[centroid].apply(lambda x: (x.x, x.y))))
coordinates 5.2 创建kd树
kdtree KDTree(coordinates)
6 查询最近的11个包括自己的邻居
distances, indices kdtree.query(coordinates, k11)
indicesarray([[ 0, 518, 603, ..., 526, 345, 559],[ 1, 12, 7, ..., 204, 56, 5],[ 2, 124, 245, ..., 133, 96, 93],...,[904, 852, 386, ..., 57, 253, 147],[905, 380, 10, ..., 154, 117, 739],[906, 646, 880, ..., 465, 129, 219]], dtypeint64)
#剔除自己
nearest_indices indices[:, 1:]
nearest_indicesarray([[518, 603, 341, ..., 526, 345, 559],[ 12, 7, 59, ..., 204, 56, 5],[124, 245, 542, ..., 133, 96, 93],...,[852, 386, 679, ..., 57, 253, 147],[380, 10, 3, ..., 154, 117, 739],[646, 880, 429, ..., 465, 129, 219]], dtypeint64)7 保存到locations里面
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/web/82844.shtml
如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!