Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pure Python Quadtree Implementation

All,

There are a few examples on implementing a quadtree using Python but my question is, does anyone know of a class written in pure python as in a single .py file that I can easily include in my project? The three most popular packages are listed here Are any of these quad-tree libraries any good? but I have not had luck with using them because of all the dependencies required to run them. I am really going for something lighweight and relatively simple to use. I would like to call the script by passing in the bounds for the entire globe and work down from there. myMethod((-180,-90,180,90))

Thanks, Adam

like image 938
aeupinhere Avatar asked May 19 '11 14:05

aeupinhere


2 Answers

PyQuadTree is a pretty lightweight module (that I built based on someone else's code). It's written in pure-Python, has no dependencies, and doesn't require any installation or compiling at all. It's a single .py file that can be easily included as part of bigger project, which sounds like what is being asked about here.

It also has documentation and supports both Python 2x and 3x.

like image 84
Karim Bahgat Avatar answered Oct 06 '22 01:10

Karim Bahgat


Take a look at Rect. You'll need 2 files. You can merge them into one.

like image 31
moraes Avatar answered Oct 05 '22 23:10

moraes