Skip to content

invisiblefunnel/boxdist

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Cythonized geodetic and planar distance functions for R-Trees.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published