Skip to content

Commit 6c25a01

Browse files
committed
[UPD] update README.md
1 parent ed43751 commit 6c25a01

1 file changed

Lines changed: 27 additions & 15 deletions

File tree

README.md

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# RetailTree
2+
23
RetailTree is a Python library designed for efficient management and querying of spatial data utilizing a tree-based data structure. Specifically, RetailTree employs a VP (Vantage Point) tree for optimized spatial data management.
34

45
# Key Features
@@ -14,34 +15,45 @@ RetailTree is a Python library designed for efficient management and querying of
1415
You can install retailTree via pip:
1516

1617
```
17-
1) clone the repo
18-
2) cd retailTree
19-
3) pip install retailTree-0.0.1-py3-none-any.whl
18+
pip install retailtree
2019
```
2120

2221
# Usage
2322

2423
```
25-
from retailTree import retailTree, Annotation
26-
from retailTree.utils.dist_func import manhattan, euclidean
24+
from retailtree import RetailTree, Annotation
25+
from retailtree.utils.dist_func import manhattan, euclidean
26+
27+
# Create annotation object
28+
ann1 = Annotation(id=1, x_min=2, y_min=1, x_max=3, y_max=2)
29+
ann2 = Annotation(id=2, x_min=1, y_min=2, x_max=2, y_max=3)
30+
ann3 = Annotation(id=3, x_min=2, y_min=2, x_max=3, y_max=3)
31+
ann4 = Annotation(id=4, x_min=3, y_min=2, x_max=4, y_max=3)
32+
ann5 = Annotation(id=5, x_min=2, y_min=3, x_max=3, y_max=4)
33+
34+
annotations = [ann1, ann2, ann3, ann4, ann5]
2735
28-
obj = RetailTree()
36+
# Create retailtree object
37+
rt = RetailTree()
2938
30-
# Adding annotations
31-
obj.add_annotation(id=1, x_min=1, y_min=1, x_max=1, y_max=1)
32-
obj.add_annotation(id=2, x_min=2, y_min=2, x_max=2, y_max=2)
39+
# Adding annotations to retailtree
40+
for ann in annotations:
41+
rt.add_annotation(ann)
3342
34-
# Tree Building
35-
obj.build_tree(dist_func=manhattan)
43+
44+
# Build tree
45+
rt.build_tree(dist_func=euclidean)
3646
3747
# Get neighbors-annotations within radius
38-
obj.find_neighbors(id=961360402, radius=1)
48+
print(rt.neighbors(id=3, radius=1))
3949
4050
# Get Top, Bottom, Right, Left annotations
41-
obj.TBLR(id=961360402, radius=1.4)
51+
print(rt.TBLR(id=3, radius=1, overlap=0.5))
4252
4353
# Get neighboring annotations within a particular angle range
44-
obj.get_neighbors_within_angle(
45-
id=963804130, radius=1, min_angle=0, max_angle=90)
54+
print(rt.neighbors_wa(id=3, radius=1, amin=0, amax=180))
55+
56+
# Get annotation properties
57+
print(rt.get(id=3).get_coords())
4658
4759
```

0 commit comments

Comments
 (0)