Skip to content

Vezarachan/quadtree-py

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

quadtree-py

Quadtree is an essential data structure in the realm of GIS (Geographic Information System) which is able to build spatial index, perform spatial analysis, and compress data.

The visualization of quadtree is displayed as following:

Usage

from quadtree import QuadTree, Bounds, Point
import json

if __name__ == '__main__':
    my_tree = QuadTree(Bounds(0, 0, 400, 400), max_objects=4, max_level=5)
    # get point data from json file
    with open('path/to/json/example_data.json', 'r') as f:
        json_data = json.loads(f.read())
        point_set = json_data['data']
    # insert points
    for point in point_set:
        my_tree.insert(Point(point['x'], point['y'], point['value']))   
    # visualize quadtree
    my_tree.visualize()
    # retrieve objects that may collide with given boundingbox
    objects = my_tree.retrieve(Bounds(200, 200, 50, 50))
    # retrive objects that intersects with provided boundingbox
    objects_intersects = my_tree.retrieve_intersections(Bounds(200, 200, 50, 50))
    # retrieve nearest neighbors
    nearest_neighbors = my_tree.nearest_neighbors(Point(225, 225), radius=25, max_num=20)

TODO

  • visualization
  • nearest neighbors
  • spatial analysis
    • kernel density estimation (KDE)
    • spatial clustering

Current Projects

  • quadtree-py - A quadtree implementation in pure Python
  • cocopulas - A Python lib for copulas (elliptical, archimedean copulas)
  • map_spider - A spider searching for POI and streetview from Amap and Bmap

Next Projects

  • KD-Tree - The k-dimensional tree implementation in Python
  • V2ML - Way to Machine Learning (Courses from Hung-yi Lee in NTU)
  • GeoBayesian - Combination of Spatial Analysis and Bayesian Data Analysis
  • MicroGIS - A lightweight, full-function, modern GIS based on C++

About

A pure Python quadrtree implementation.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages