1Tree::R(3) User Contributed Perl Documentation Tree::R(3)
2
3
4
6 Tree::R - Perl extension for the R-tree data structure and algorithms
7
9 use Tree::R;
10
11 my $rtree = Tree::R->new
12
13 for my $object (@objects) {
14 my @bbox = $object->bbox(); # (minx,miny,maxx,maxy)
15 $rtree->insert($object,@bbox);
16 }
17
18 my @point = (123, 456); # (x,y)
19 my @results;
20 $rtree->query_point(@point,\@results);
21 for my $object (@results) {
22 # point is in object's bounding box
23 }
24
25 my @rect = (123, 456, 789, 1234); # (minx,miny,maxx,maxy)
26 @results = ();
27 $rtree->query_completely_within_rect(@rect,\@results);
28 for my $object (@results) {
29 # object is within rectangle
30 }
31
32 @results = ();
33 $rtree->query_partly_within_rect(@rect,\@results);
34 for my $object (@results) {
35 # object's bounding box and rectangle overlap
36 }
37
39 R-tree is a data structure for storing and indexing and efficiently
40 looking up non-zero-size spatial objects.
41
42 EXPORT
43 None by default.
44
46 A. Guttman: R-trees: a dynamic index structure for spatial indexing.
47 ACM SIGMOD'84, Proc. of Annual Meeting (1984), 47--57.
48
49 N. Beckmann, H.-P. Kriegel, R. Schneider & B. Seeger: The R*-tree: an
50 efficient and robust access method for points and rectangles. Proc. of
51 the 1990 ACM SIGMOD Internat. Conf. on Management of Data (1990),
52 322--331.
53
54 The homepage of this module is on github:
55 https://github.com/ajolma/Tree-R
56
58 Ari Jolma
59
61 Copyright (C) 2005- by Ari Jolma
62
63 This library is free software; you can redistribute it and/or modify it
64 under the terms of The Artistic License 2.0.
65
67 <https://github.com/ajolma/Tree-R>
68
69
70
71perl v5.28.0 2015-09-14 Tree::R(3)