跳转到主要内容

为R-Trees实现地理和平面距离函数的Cython化。

项目描述

boxdist

为R-Trees实现地理和平面距离函数的Cython化。该实现基于 Tile38,该实现基于论文 Geodetic Distance Queries on R-Trees for Indexing Geographic Data

地理距离

from boxdist import geodetic_box_dist

targetlon = -72.946472
targetlat = 45.154927

minlon = -74.19342
minlat = 45.265222
maxlon = -73.157959
maxlat = 45.704261

meters = geodetic_box_dist(
    targetlon,
    targetlat,
    minlon,
    minlat,
    maxlon,
    maxlat,
)

meters #=> 20612.892322138163

平面距离

from boxdist import planar_box_dist

targetx = 0
targety = 0

minx = 1
miny = 1
maxx = 2
maxy = 2

squared_dist = planar_box_dist(
    targetx,
    targety,
    minx,
    miny,
    maxx,
    maxy,
)

squared_dist #=> 2

项目详情


下载文件

下载适用于您的平台的文件。如果您不确定选择哪个,请了解更多关于 安装包 的信息。

源分布

boxdist-1.3.1.tar.gz (54.5 kB 查看哈希值)

上传时间:

构建分布

boxdist-1.3.1-cp310-cp310-macosx_12_0_arm64.whl (21.1 kB 查看哈希值)

上传时间: CPython 3.10 macOS 12.0+ ARM64

由以下支持