togo 0.1.2__cp310-cp310-musllinux_1_2_x86_64.whl → 0.1.3__cp310-cp310-musllinux_1_2_x86_64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of togo might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: togo
3
- Version: 0.1.2
3
+ Version: 0.1.3
4
4
  Summary: Lightweight Python bindings for the TG geometry library
5
5
  Author-email: Giorgio Salluzzo <giorgio.salluzzo@gmail.com>
6
6
  License: MIT
@@ -94,50 +94,27 @@ second = gc[1]
94
94
  print(first.type_string()) # 'Point'
95
95
  ```
96
96
 
97
- ### Point, Line, Ring, Poly
98
-
99
- Building blocks for constructing geometries:
97
+ ### Point
100
98
 
101
99
  ```python
100
+ from togo import Point
101
+
102
102
  # Create a point
103
103
  p = Point(1.0, 2.0)
104
104
 
105
- # Create a line
106
- line = Line([(0,0), (1,1), (2,2)])
107
-
108
- # Create a ring (closed line)
109
- ring = Ring([(0,0), (10,0), (10,10), (0,10), (0,0)])
110
-
111
- # Create a polygon with holes
112
- exterior = Ring([(0,0), (10,0), (10,10), (0,10), (0,0)])
113
- hole = Ring([(2,2), (8,2), (8,8), (2,8), (2,2)])
114
- poly = Poly(exterior, [hole])
115
- ```
105
+ # Access coordinates
106
+ print(f"X: {p.x}, Y: {p.y}")
116
107
 
117
- ### MultiGeometries
118
-
119
- Creating collections of geometries:
120
-
121
- ```python
122
- # Create a MultiPoint
123
- multi_point = Geometry.from_multipoint([(0,0), (1,1), Point(2,2)])
124
-
125
- # Create a MultiLineString
126
- multi_line = Geometry.from_multilinestring([
127
- [(0,0), (1,1)],
128
- Line([(2,2), (3,3)])
129
- ])
108
+ # Get as a tuple
109
+ print(p.as_tuple())
130
110
 
131
- # Create a MultiPolygon
132
- poly1 = Poly(Ring([(0,0), (1,0), (1,1), (0,1), (0,0)]))
133
- poly2 = Poly(Ring([(2,2), (3,2), (3,3), (2,3), (2,2)]))
134
- multi_poly = Geometry.from_multipolygon([poly1, poly2])
111
+ # Convert to a Geometry object
112
+ geom = p.as_geometry()
113
+ print(geom.type_string())
135
114
  ```
136
115
 
137
116
  ### Segment
138
117
 
139
- Represents a line segment between two points:
140
-
141
118
  ```python
142
119
  from togo import Segment, Point
143
120
 
@@ -159,6 +136,101 @@ other = Segment((1, 1), (2, 2))
159
136
  print(seg.intersects(other)) # True or False
160
137
  ```
161
138
 
139
+ ### Line
140
+
141
+ ```python
142
+ from togo import Line
143
+
144
+ # Create a line from a list of tuples
145
+ line = Line([(0,0), (1,1), (2,0)])
146
+
147
+ # Get number of points
148
+ print(f"Number of points: {line.num_points()}")
149
+
150
+ # Get all points as a list of tuples
151
+ print(f"Points: {line.points()}")
152
+
153
+ # Get the length of the line
154
+ print(f"Length: {line.length()}")
155
+
156
+ # Get the bounding box
157
+ print(f"Bounding box: {line.rect()}")
158
+
159
+ # Get a point by index
160
+ print(f"First point: {line[0].as_tuple()}")
161
+ ```
162
+
163
+ ### Ring
164
+
165
+ ```python
166
+ from togo import Ring
167
+
168
+ # Create a ring (must be closed)
169
+ ring = Ring([(0,0), (10,0), (10,10), (0,10), (0,0)])
170
+
171
+ # Get area and perimeter
172
+ print(f"Area: {ring.area()}")
173
+ print(f"Perimeter: {ring.perimeter()}")
174
+
175
+ # Check if it's convex or clockwise
176
+ print(f"Is convex: {ring.is_convex()}")
177
+ print(f"Is clockwise: {ring.is_clockwise()}")
178
+
179
+ # Get bounding box
180
+ min_pt, max_pt = ring.rect().min, ring.rect().max
181
+ print(f"Bounding box: {min_pt.as_tuple()}, {max_pt.as_tuple()}")
182
+ ```
183
+
184
+ ### Poly
185
+
186
+ ```python
187
+ from togo import Poly, Ring, Point
188
+
189
+ # Create a polygon with one exterior ring and one interior hole
190
+ exterior = Ring([(0,0), (10,0), (10,10), (0,10), (0,0)])
191
+ hole1 = Ring([(1,1), (2,1), (2,2), (1,2), (1,1)])
192
+ poly = Poly(exterior, holes=[hole1])
193
+
194
+ # Get the exterior ring
195
+ ext_ring = poly.exterior()
196
+ print(f"Exterior has {ext_ring.num_points()} points")
197
+
198
+ # Get number of holes
199
+ print(f"Number of holes: {poly.num_holes()}")
200
+
201
+ # Get a hole by index
202
+ h = poly.hole(0)
203
+ print(f"Hole area: {h.area()}")
204
+
205
+ # A polygon is a geometry, so you can use geometry methods
206
+ geom = poly.as_geometry()
207
+ print(f"Contains point (5,5): {geom.contains(Point(5,5).as_geometry())}")
208
+ # Point is inside the hole, so it is not contained by the polygon
209
+ print(f"Contains point (1.5,1.5): {geom.contains(Point(1.5,1.5).as_geometry())}")
210
+ ```
211
+
212
+ ### MultiGeometries
213
+
214
+ Creating collections of geometries:
215
+
216
+ ```python
217
+ from togo import Geometry, Point, Line, Poly, Ring
218
+
219
+ # Create a MultiPoint
220
+ multi_point = Geometry.from_multipoint([(0,0), (1,1), Point(2,2)])
221
+
222
+ # Create a MultiLineString
223
+ multi_line = Geometry.from_multilinestring([
224
+ [(0,0), (1,1)],
225
+ Line([(2,2), (3,3)])
226
+ ])
227
+
228
+ # Create a MultiPolygon
229
+ poly1 = Poly(Ring([(0,0), (1,0), (1,1), (0,1), (0,0)]))
230
+ poly2 = Poly(Ring([(2,2), (3,2), (3,3), (2,3), (2,2)]))
231
+ multi_poly = Geometry.from_multipolygon([poly1, poly2])
232
+ ```
233
+
162
234
  ## Polygon Indexing
163
235
 
164
236
  Togo supports different polygon indexing strategies for optimized spatial operations:
@@ -0,0 +1,6 @@
1
+ togo.cpython-310-x86_64-linux-gnu.so,sha256=tCqfyIgSkj4Wm8PUvD4IyjT61Pl6y-tmsoDIMDESjQ4,2696288
2
+ togo-0.1.3.dist-info/METADATA,sha256=q55SCgPt5td9qOCmC_oE3-VEK-dZJPALOiHp5S060AI,6539
3
+ togo-0.1.3.dist-info/WHEEL,sha256=YJPq7zroHSsdctrb_KymZ4ss41PkmaA9SD9TZzqKSX8,112
4
+ togo-0.1.3.dist-info/top_level.txt,sha256=bldd6tssR8THqoSDFauQQdh_pg79DMHBDhiNKgS4ttM,5
5
+ togo-0.1.3.dist-info/RECORD,,
6
+ togo-0.1.3.dist-info/licenses/LICENSE,sha256=OfTFHFMDSt9X89g-BWUVis-GuTPWAdjplg2z9d2dBCw,1073
Binary file
@@ -1,6 +0,0 @@
1
- togo.cpython-310-x86_64-linux-gnu.so,sha256=lQ7Op3rW5HTTRJy-_5uSSV9kd3l_hSxhdPKviJ9Wqrg,2545088
2
- togo-0.1.2.dist-info/METADATA,sha256=YHTXCAcsWj8Qs61iTDJHDuWGjfiyfvBAwaqomdPsXas,4936
3
- togo-0.1.2.dist-info/WHEEL,sha256=YJPq7zroHSsdctrb_KymZ4ss41PkmaA9SD9TZzqKSX8,112
4
- togo-0.1.2.dist-info/top_level.txt,sha256=bldd6tssR8THqoSDFauQQdh_pg79DMHBDhiNKgS4ttM,5
5
- togo-0.1.2.dist-info/RECORD,,
6
- togo-0.1.2.dist-info/licenses/LICENSE,sha256=OfTFHFMDSt9X89g-BWUVis-GuTPWAdjplg2z9d2dBCw,1073
File without changes