Skip to main content

Cythonized geodetic and planar distance functions for R-Trees.

Project description

boxdist

Cythonized geodetic and planar distance functions for R-Trees. The implementation is adapted from Tile38, which is based on the paper Geodetic Distance Queries on R-Trees for Indexing Geographic Data.

Geodetic

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

Planar

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

boxdist-1.2.0.tar.gz (32.0 kB view details)

Uploaded Source

Built Distribution

boxdist-1.2.0-cp310-cp310-macosx_12_0_arm64.whl (13.9 kB view details)

Uploaded CPython 3.10 macOS 12.0+ ARM64

File details

Details for the file boxdist-1.2.0.tar.gz.

File metadata

  • Download URL: boxdist-1.2.0.tar.gz
  • Upload date:
  • Size: 32.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.6

File hashes

Hashes for boxdist-1.2.0.tar.gz
Algorithm Hash digest
SHA256 7359ddb61f79b8a9d1e753bd5bb4f087bcd1a9e772f9bd02cb1ce58fa5a57a00
MD5 7af4c5d747e603ccbe8ce994e8f6a042
BLAKE2b-256 77b02de40bdc213b3fc83404efc7e0d269a11c3bd413793993b6df05183fbb8c

See more details on using hashes here.

File details

Details for the file boxdist-1.2.0-cp310-cp310-macosx_12_0_arm64.whl.

File metadata

File hashes

Hashes for boxdist-1.2.0-cp310-cp310-macosx_12_0_arm64.whl
Algorithm Hash digest
SHA256 e5d7be99094b58aa27a768abae4264ec18a8a3cac952efc85a4987779815fe4f
MD5 2e03ca307d3878fd39a48be2edbe0475
BLAKE2b-256 8c03c373a97057df72dd681b9f19c36a4ceb5d2e7852bc7b1af2ee4229f844b8

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page