Skip to content

Instantly share code, notes, and snippets.

@aaronpk
Last active August 29, 2015 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aaronpk/edb21402ab1d9168ba3e to your computer and use it in GitHub Desktop.
Save aaronpk/edb21402ab1d9168ba3e to your computer and use it in GitHub Desktop.
Example disk-based storage of a QuadTree index. The index is built from the raw data in `data.csv`, resulting in the index txt files you see below. The index files contain pointers to their child nodes as well as a reference to the file and line number of the record. In this example, each node has a capacity of 4 data points.
nw:
ne:
sw:
se:
data.csv#5
nw:-90,45,180,90.txt
ne:90,45,180,90.txt
sw:-90,-45,180,90.txt
se:90,-45,180,90.txt
data.csv#1
data.csv#2
data.csv#3
data.csv#4
Portland United States 45.52345 -122.67621
Beaverton United States 45.48706 -122.80371
Eugene United States 44.05207 -123.08675
Milwaukie United States 45.44623 -122.63926
Hillsboro United States 45.52289 -122.98983
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment