togo 0.1.1__cp39-cp39-musllinux_1_2_x86_64.whl → 0.1.3__cp39-cp39-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.1
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
@@ -86,26 +86,127 @@ g1.within(g2)
86
86
  # Format conversion
87
87
  g1.to_wkt()
88
88
  g1.to_geojson()
89
- ```
90
89
 
91
- ### Point, Line, Ring, Poly
90
+ # Access sub-geometries by index (e.g., for GeometryCollection, MultiPoint, etc.)
91
+ gc = Geometry('GEOMETRYCOLLECTION(POINT(1 2),POINT(3 4))', fmt='wkt')
92
+ first = gc[0] # Bound to TG function call tg_geom_geometry_at(idx)
93
+ second = gc[1]
94
+ print(first.type_string()) # 'Point'
95
+ ```
92
96
 
93
- Building blocks for constructing geometries:
97
+ ### Point
94
98
 
95
99
  ```python
100
+ from togo import Point
101
+
96
102
  # Create a point
97
103
  p = Point(1.0, 2.0)
98
104
 
99
- # Create a line
100
- line = Line([(0,0), (1,1), (2,2)])
105
+ # Access coordinates
106
+ print(f"X: {p.x}, Y: {p.y}")
107
+
108
+ # Get as a tuple
109
+ print(p.as_tuple())
110
+
111
+ # Convert to a Geometry object
112
+ geom = p.as_geometry()
113
+ print(geom.type_string())
114
+ ```
115
+
116
+ ### Segment
117
+
118
+ ```python
119
+ from togo import Segment, Point
120
+
121
+ # Create a segment from two points (or tuples)
122
+ seg = Segment(Point(0, 0), Point(1, 1))
123
+ # Or using tuples
124
+ tuple_seg = Segment((0, 0), (1, 1))
125
+
126
+ # Access endpoints
127
+ print(seg.a) # Point(0, 0)
128
+ print(seg.b) # Point(1, 1)
129
+
130
+ # Get the bounding rectangle
131
+ rect = seg.rect()
132
+ print(rect) # ((0.0, 0.0), (1.0, 1.0))
133
+
134
+ # Check intersection with another segment
135
+ other = Segment((1, 1), (2, 2))
136
+ print(seg.intersects(other)) # True or False
137
+ ```
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()}")
101
152
 
102
- # Create a ring (closed line)
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)
103
169
  ring = Ring([(0,0), (10,0), (10,10), (0,10), (0,0)])
104
170
 
105
- # Create a polygon with holes
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
106
190
  exterior = Ring([(0,0), (10,0), (10,10), (0,10), (0,0)])
107
- hole = Ring([(2,2), (8,2), (8,8), (2,8), (2,2)])
108
- poly = Poly(exterior, [hole])
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())}")
109
210
  ```
110
211
 
111
212
  ### MultiGeometries
@@ -113,6 +214,8 @@ poly = Poly(exterior, [hole])
113
214
  Creating collections of geometries:
114
215
 
115
216
  ```python
217
+ from togo import Geometry, Point, Line, Poly, Ring
218
+
116
219
  # Create a MultiPoint
117
220
  multi_point = Geometry.from_multipoint([(0,0), (1,1), Point(2,2)])
118
221
 
@@ -0,0 +1,6 @@
1
+ togo.cpython-39-x86_64-linux-gnu.so,sha256=ulrFsWI-WYqvQXek0FQA5rxB6vpNOiPltP4WL2SC60k,2684328
2
+ togo-0.1.3.dist-info/METADATA,sha256=q55SCgPt5td9qOCmC_oE3-VEK-dZJPALOiHp5S060AI,6539
3
+ togo-0.1.3.dist-info/WHEEL,sha256=1lQ8uVaF0e0KhYU1_N6mtUH8lO3rq4o3quRVE11_OcQ,110
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-39-x86_64-linux-gnu.so,sha256=YOZt7O_ejgXBiHwt8mMuFXjyEfL7pQCNuMs8E_YIKd8,2358672
2
- togo-0.1.1.dist-info/METADATA,sha256=smJ-qt2aCBBDfYMWWUQHrO8gjVvXQk3KB4RXAG3wQOE,4128
3
- togo-0.1.1.dist-info/WHEEL,sha256=1lQ8uVaF0e0KhYU1_N6mtUH8lO3rq4o3quRVE11_OcQ,110
4
- togo-0.1.1.dist-info/top_level.txt,sha256=bldd6tssR8THqoSDFauQQdh_pg79DMHBDhiNKgS4ttM,5
5
- togo-0.1.1.dist-info/RECORD,,
6
- togo-0.1.1.dist-info/licenses/LICENSE,sha256=OfTFHFMDSt9X89g-BWUVis-GuTPWAdjplg2z9d2dBCw,1073
File without changes