1Geo::ShapeFile::Shape::UIsnedrexC(o3n)tributed Perl DocuGmeeon:t:aSthiaopneFile::Shape::Index(3)
2
3
4

NAME

6       Geo::ShapeFile::Shape - Geo::ShapeFile utility class.
7

SYNOPSIS

9         use Geo::ShapeFile::Shape::Index;
10
11         my $index = Geo::ShapeFile::Shape->new;
12         #  $pt1 and $pt2 are point objects in this example.
13         my $segment = [$pt1, $pt2];  #  example of something to pack into the index.
14         my @bbox = ($x_min, $y_min, $x_max, $y_max);
15         $index->insert($segment, @bbox);
16

ABSTRACT

18         This is a utility class for L<Geo::ShapeFile> that indexes shape objects.
19

DESCRIPTION

21       This is a 2-d block-based index class for Geo::ShapeFile::Shape
22       objects.  It probably has more generic applications, of course.
23
24       It uses a flat 2-d structure comprising a series of blocks of full
25       width which slice the shape along the y-axis (it should really also use
26       blocks along the x axis).
27
28       The index coordinates are simply the number of blocks across and up
29       from the minimum coordinate specified in the new() call.  These are
30       stoed as strings jpoined by a colon, so 0:0 is the lower left.
31       Negative block coordinates can occur if data are added which fall
32       outside the speficied bounds.  This should not affect the index,
33       though, as it is merely a relative offset.
34
35       It is used internally by Geo::ShapeFile::Shape, so look there for
36       examples.  The method names are adapted from Tree::R to make transition
37       easier during development, albeit the argument have morphed so it is
38       not a drop-in replacement.
39
40   EXPORT
41       None by default.
42

METHODS

44       new($n_blocks_y, @bbox)
45           Creates a new Geo::ShapeFile::Shape::Index objectand returns it.
46
47           $n_blocks_y is the number of blocks along the y-axis.  @bbox is the
48           bounding box the index represents (x_min, y_min, x_max, y_max).
49
50       insert($item, $min_x, $min_y, $max_x, $max_y)
51           Adds item $item to the blocks which overlap with the specified
52           bounds.  Returns the number of blocks the item was added to.
53
54       query_point($x, $y)
55           Returns an array of objects on the block contains point $x,$y.
56           Returns an arrayref in scalar context.
57
58       get_x_max() get_x_min() get_y_max() get_y_min()
59           Bounds of the index, as set in the call to ->new().  There is no
60           guarantee they are the bounds of the data, as data outside the
61           original bounds can be indexed.
62
63       get_y_res()
64           Block resolution along the y-axis.
65
66       snap_to_index ($x, $y)
67           Returns the index key associated with point $x,$y.  Does not check
68           if it is outside the bounds of the index, so negative index values
69           are possible.
70

REPORTING BUGS

72       Please send any bugs, suggestions, or feature requests to
73         <https://github.com/shawnlaffan/Geo-ShapeFile/issues>.
74

SEE ALSO

76       Geo::ShapeFile::Shape
77

AUTHOR

79       Shawn Laffan, <shawnlaffan@gmail.com>
80
82       Copyright 2014-2023 by Shawn Laffan
83
84       This library is free software; you can redistribute it and/or modify it
85       under the same terms as Perl itself.
86
87
88
89perl v5.38.0                      2023-07-20   Geo::ShapeFile::Shape::Index(3)
Impressum