Indexing in python quadtree -


i have set of points coordinates (latitudes, longigutes), , have region (a box). points inside box. want distribute points small cells (rectangles) considering density of points. basically, cell containing many points should subdivided smaller ones, while keeping larger cells small number of points.

i have check this question, has same problem me couldn't find answer. think should use quad tree, implementations found doesn't provide that.

for example, this library allows making tree associated box, , can insert boxes follows:

spindex = index(bbox=(0, 0, 100, 100)) item in items:     spindex.insert(item, item.bbox) 

but doens't allow inserting points. moreover, i'll need ids of cells (or names), , check if point belongs given cell.

here lib found. allow inserting points, doens't give me cell's id (or name), cannot check if point belongs cell. notice tree should decomposition automatically.

could please suggest me solution? thanks.

finally, ended using google's s2-geometry-library python wrapper. in fact, each cell created lib not rectangle (it's projection), satisfies need. lib divided earth surface cells @ different levels (quad tree). given point (lat,lng), can corresponding cell @ leaf level. these leaf nodes, go , merge cells based on need (number of points in cell). this tutorial explains in details.

here result: enter image description here


Comments

Popular posts from this blog

python - Selenium remoteWebDriver (& SauceLabs) Firefox moseMoveTo action exception -

html - How to custom Bootstrap grid height? -

transpose - Maple isnt executing function but prints function term -