1Boost::Geometry::Utils(U3spemr)Contributed Perl DocumentBaotoisotn::Geometry::Utils(3pm)
2
3
4

NAME

6       Boost::Geometry::Utils - Bindings for the Boost Geometry library
7

VERSION

9       version 0.07
10

SYNOPSIS

12           use Boost::Geometry::Utils qw(polygon linestring polygon_linestring_intersection);
13
14           my $square = [  # ccw
15               [10, 10],
16               [20, 10],
17               [20, 20],
18               [10, 20],
19           ];
20           my $hole_in_square = [  # cw
21               [14, 14],
22               [14, 16],
23               [16, 16],
24               [16, 14],
25           ];
26           my $polygon = polygon($square, $hole_in_square);
27           my $linestring = linestring([ [5, 15], [30, 15] ]);
28
29           my $intersection = polygon_linestring_intersection($polygon, $linestring);
30
31           # $intersection is:
32           # [
33           #     [ [10, 15], [14, 15] ],
34           #     [ [16, 15], [20, 15] ],
35           # ]
36

ABSTRACT

38       This module provides bindings to perform some geometric operations
39       using the Boost Geometry library. It does not aim at providing full
40       bindings for such library, and that's why I left the Boost::Geometry
41       namespace free. I'm unsure about the optimal architectural for
42       providing full bindings, but I'm interested in such a project -- so, if
43       you have ideas please get in touch with me.
44
45       Warning: the API could change in the future.
46

METHODS

48   polygon_linestring_intersection
49       Performs an intersection between the supplied polygon and linestring,
50       and returns an arrayref of linestrings (represented as arrayrefs of
51       points).  Note that such an intersection is also called clipping.
52
53   polygon_multi_linestring_intersection
54       Same as polygon_linestring_intersection but it accepts a
55       multilinestring object to perform multiple clippings in a single batch.
56
57   multi_polygon_multi_linestring_intersection
58       Same as polygon_multi_linestring_intersection but it accepts a
59       multipolygon object to perform multiple clippings in a single batch.
60
61   multi_linestring_multi_polygon_difference
62       Performs a difference between the supplied multilinestring and the
63       supplied multipolygon. It returns a multilinestring object.
64
65   polygon_to_wkt
66       Converts one or more arrayref(s) of points to a WKT representation of a
67       polygon (with holes).
68
69   linestring_to_wkt
70       Converts an arrayref of points to a WKT representation of a
71       multilinestring.
72
73   wkt_to_multilinestring
74       Parses a MULTILINESTRING back to a Perl data structure.
75
76   linestring_simplify
77       Accepts an arrayref of points representing a linestring and a numeric
78       tolerance and returns an arrayref of points representing the simplified
79       linestring.
80
81   multi_linestring_simplify
82       Accepts an arrayref of arrayrefs of points representing a
83       multilinestring and a numeric tolerance and returns an arrayref of
84       arrayrefs of points representing the simplified linestrings.
85
86   point_covered_by_polygon
87       Accepts a point and an arrayref of points representing a polygon and
88       returns true or false according to the 'cover_by' strategy.
89
90   point_covered_by_multi_polygon
91       Same as above but accepts a multipolygon arrayref.
92
93   point_within_polygon
94       Accepts a point and an arrayref of points representing a polygon and
95       returns true or false according to the 'within' strategy.
96
97   point_within_multi_polygon
98       Same as above but accepts a multipolygon arrayref.
99
100   linestring_length
101       Returns length of a linestring.
102
103   polygon_centroid
104       Returns the centroid point of a given polygon.
105
106   linestring_centroid
107       Returns the centroid point of a given linestring.
108
109   multi_linestring_centroid
110       Returns the centroid point of a given multi_linestring.
111
112   correct_polygon
113       Corrects the orientation(s) of the given polygon.
114
115   correct_multi_polygon
116       Corrects the orientation(s) of the given multi_polygon.
117
118   polygon_area
119       Returns the area of the given polygon.
120

ACKNOWLEDGEMENTS

122       Thanks to mauke and mst (Matt S. Trout (cpan:MSTROUT)
123       <mst@shadowcat.co.uk>) for their valuable help in getting this to
124       compile under Windows (MinGW) too.  Thanks to Mark Hindness for his
125       work on data types conversion.
126

AUTHOR

128       Alessandro Ranellucci <aar@cpan.org>
129
131       This software is copyright (c) 2013 by Alessandro Ranellucci.
132
133       This is free software; you can redistribute it and/or modify it under
134       the same terms as the Perl 5 programming language system itself.
135
136
137
138perl v5.38.0                      2023-07-20       Boost::Geometry::Utils(3pm)
Impressum