togo 0.1.1__cp312-cp312-musllinux_1_2_x86_64.whl → 0.1.3__cp312-cp312-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.
- {togo-0.1.1.dist-info → togo-0.1.3.dist-info}/METADATA +113 -10
- togo-0.1.3.dist-info/RECORD +7 -0
- togo.cpython-312-x86_64-linux-gnu.so +0 -0
- togo.cpython-312-x86_64-linux-musl.so +0 -0
- togo-0.1.1.dist-info/RECORD +0 -7
- {togo-0.1.1.dist-info → togo-0.1.3.dist-info}/WHEEL +0 -0
- {togo-0.1.1.dist-info → togo-0.1.3.dist-info}/licenses/LICENSE +0 -0
- {togo-0.1.1.dist-info → togo-0.1.3.dist-info}/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: togo
|
|
3
|
-
Version: 0.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
|
-
|
|
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
|
-
|
|
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
|
-
#
|
|
100
|
-
|
|
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
|
-
#
|
|
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
|
-
#
|
|
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
|
-
|
|
108
|
-
poly = Poly(exterior, [
|
|
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,7 @@
|
|
|
1
|
+
togo.cpython-312-x86_64-linux-gnu.so,sha256=d_73p3YUgyoBBojhJ4kPT2MzK2Hq2UtNnsRblylehTA,2233576
|
|
2
|
+
togo.cpython-312-x86_64-linux-musl.so,sha256=GBt2OnJz0sqc50pU8ym2bEd8T0I_5AUv8LAdCEJyODo,2793848
|
|
3
|
+
togo-0.1.3.dist-info/METADATA,sha256=q55SCgPt5td9qOCmC_oE3-VEK-dZJPALOiHp5S060AI,6539
|
|
4
|
+
togo-0.1.3.dist-info/WHEEL,sha256=AwHYJA1Do1jwgPIoLQR4DiHSeYY_vU6Ht9Vljq5Yt_M,112
|
|
5
|
+
togo-0.1.3.dist-info/top_level.txt,sha256=bldd6tssR8THqoSDFauQQdh_pg79DMHBDhiNKgS4ttM,5
|
|
6
|
+
togo-0.1.3.dist-info/RECORD,,
|
|
7
|
+
togo-0.1.3.dist-info/licenses/LICENSE,sha256=OfTFHFMDSt9X89g-BWUVis-GuTPWAdjplg2z9d2dBCw,1073
|
|
Binary file
|
|
Binary file
|
togo-0.1.1.dist-info/RECORD
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
togo.cpython-312-x86_64-linux-gnu.so,sha256=HZIi2jOAoYj7ULH8164XCQ0zE-QBbQpkvoaIbSaqyoc,1866336
|
|
2
|
-
togo.cpython-312-x86_64-linux-musl.so,sha256=bHaN67VydDqRLRK5yfjlyG3F-su9h-Wt7Bxmn2kxGvs,2439112
|
|
3
|
-
togo-0.1.1.dist-info/METADATA,sha256=smJ-qt2aCBBDfYMWWUQHrO8gjVvXQk3KB4RXAG3wQOE,4128
|
|
4
|
-
togo-0.1.1.dist-info/WHEEL,sha256=AwHYJA1Do1jwgPIoLQR4DiHSeYY_vU6Ht9Vljq5Yt_M,112
|
|
5
|
-
togo-0.1.1.dist-info/top_level.txt,sha256=bldd6tssR8THqoSDFauQQdh_pg79DMHBDhiNKgS4ttM,5
|
|
6
|
-
togo-0.1.1.dist-info/RECORD,,
|
|
7
|
-
togo-0.1.1.dist-info/licenses/LICENSE,sha256=OfTFHFMDSt9X89g-BWUVis-GuTPWAdjplg2z9d2dBCw,1073
|
|
File without changes
|
|
File without changes
|
|
File without changes
|