togo 0.1.1__cp38-cp38-musllinux_1_2_x86_64.whl → 0.1.3__cp38-cp38-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 +6 -0
- togo.cpython-38-x86_64-linux-gnu.so +0 -0
- togo-0.1.1.dist-info/RECORD +0 -6
- {togo-0.1.1.dist-info → togo-0.1.3.dist-info}/LICENSE +0 -0
- {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}/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
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
|
|
@@ -84,26 +84,127 @@ g1.within(g2)
|
|
|
84
84
|
# Format conversion
|
|
85
85
|
g1.to_wkt()
|
|
86
86
|
g1.to_geojson()
|
|
87
|
-
```
|
|
88
87
|
|
|
89
|
-
|
|
88
|
+
# Access sub-geometries by index (e.g., for GeometryCollection, MultiPoint, etc.)
|
|
89
|
+
gc = Geometry('GEOMETRYCOLLECTION(POINT(1 2),POINT(3 4))', fmt='wkt')
|
|
90
|
+
first = gc[0] # Bound to TG function call tg_geom_geometry_at(idx)
|
|
91
|
+
second = gc[1]
|
|
92
|
+
print(first.type_string()) # 'Point'
|
|
93
|
+
```
|
|
90
94
|
|
|
91
|
-
|
|
95
|
+
### Point
|
|
92
96
|
|
|
93
97
|
```python
|
|
98
|
+
from togo import Point
|
|
99
|
+
|
|
94
100
|
# Create a point
|
|
95
101
|
p = Point(1.0, 2.0)
|
|
96
102
|
|
|
97
|
-
#
|
|
98
|
-
|
|
103
|
+
# Access coordinates
|
|
104
|
+
print(f"X: {p.x}, Y: {p.y}")
|
|
105
|
+
|
|
106
|
+
# Get as a tuple
|
|
107
|
+
print(p.as_tuple())
|
|
108
|
+
|
|
109
|
+
# Convert to a Geometry object
|
|
110
|
+
geom = p.as_geometry()
|
|
111
|
+
print(geom.type_string())
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Segment
|
|
115
|
+
|
|
116
|
+
```python
|
|
117
|
+
from togo import Segment, Point
|
|
118
|
+
|
|
119
|
+
# Create a segment from two points (or tuples)
|
|
120
|
+
seg = Segment(Point(0, 0), Point(1, 1))
|
|
121
|
+
# Or using tuples
|
|
122
|
+
tuple_seg = Segment((0, 0), (1, 1))
|
|
123
|
+
|
|
124
|
+
# Access endpoints
|
|
125
|
+
print(seg.a) # Point(0, 0)
|
|
126
|
+
print(seg.b) # Point(1, 1)
|
|
127
|
+
|
|
128
|
+
# Get the bounding rectangle
|
|
129
|
+
rect = seg.rect()
|
|
130
|
+
print(rect) # ((0.0, 0.0), (1.0, 1.0))
|
|
131
|
+
|
|
132
|
+
# Check intersection with another segment
|
|
133
|
+
other = Segment((1, 1), (2, 2))
|
|
134
|
+
print(seg.intersects(other)) # True or False
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Line
|
|
138
|
+
|
|
139
|
+
```python
|
|
140
|
+
from togo import Line
|
|
141
|
+
|
|
142
|
+
# Create a line from a list of tuples
|
|
143
|
+
line = Line([(0,0), (1,1), (2,0)])
|
|
144
|
+
|
|
145
|
+
# Get number of points
|
|
146
|
+
print(f"Number of points: {line.num_points()}")
|
|
147
|
+
|
|
148
|
+
# Get all points as a list of tuples
|
|
149
|
+
print(f"Points: {line.points()}")
|
|
99
150
|
|
|
100
|
-
#
|
|
151
|
+
# Get the length of the line
|
|
152
|
+
print(f"Length: {line.length()}")
|
|
153
|
+
|
|
154
|
+
# Get the bounding box
|
|
155
|
+
print(f"Bounding box: {line.rect()}")
|
|
156
|
+
|
|
157
|
+
# Get a point by index
|
|
158
|
+
print(f"First point: {line[0].as_tuple()}")
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### Ring
|
|
162
|
+
|
|
163
|
+
```python
|
|
164
|
+
from togo import Ring
|
|
165
|
+
|
|
166
|
+
# Create a ring (must be closed)
|
|
101
167
|
ring = Ring([(0,0), (10,0), (10,10), (0,10), (0,0)])
|
|
102
168
|
|
|
103
|
-
#
|
|
169
|
+
# Get area and perimeter
|
|
170
|
+
print(f"Area: {ring.area()}")
|
|
171
|
+
print(f"Perimeter: {ring.perimeter()}")
|
|
172
|
+
|
|
173
|
+
# Check if it's convex or clockwise
|
|
174
|
+
print(f"Is convex: {ring.is_convex()}")
|
|
175
|
+
print(f"Is clockwise: {ring.is_clockwise()}")
|
|
176
|
+
|
|
177
|
+
# Get bounding box
|
|
178
|
+
min_pt, max_pt = ring.rect().min, ring.rect().max
|
|
179
|
+
print(f"Bounding box: {min_pt.as_tuple()}, {max_pt.as_tuple()}")
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### Poly
|
|
183
|
+
|
|
184
|
+
```python
|
|
185
|
+
from togo import Poly, Ring, Point
|
|
186
|
+
|
|
187
|
+
# Create a polygon with one exterior ring and one interior hole
|
|
104
188
|
exterior = Ring([(0,0), (10,0), (10,10), (0,10), (0,0)])
|
|
105
|
-
|
|
106
|
-
poly = Poly(exterior, [
|
|
189
|
+
hole1 = Ring([(1,1), (2,1), (2,2), (1,2), (1,1)])
|
|
190
|
+
poly = Poly(exterior, holes=[hole1])
|
|
191
|
+
|
|
192
|
+
# Get the exterior ring
|
|
193
|
+
ext_ring = poly.exterior()
|
|
194
|
+
print(f"Exterior has {ext_ring.num_points()} points")
|
|
195
|
+
|
|
196
|
+
# Get number of holes
|
|
197
|
+
print(f"Number of holes: {poly.num_holes()}")
|
|
198
|
+
|
|
199
|
+
# Get a hole by index
|
|
200
|
+
h = poly.hole(0)
|
|
201
|
+
print(f"Hole area: {h.area()}")
|
|
202
|
+
|
|
203
|
+
# A polygon is a geometry, so you can use geometry methods
|
|
204
|
+
geom = poly.as_geometry()
|
|
205
|
+
print(f"Contains point (5,5): {geom.contains(Point(5,5).as_geometry())}")
|
|
206
|
+
# Point is inside the hole, so it is not contained by the polygon
|
|
207
|
+
print(f"Contains point (1.5,1.5): {geom.contains(Point(1.5,1.5).as_geometry())}")
|
|
107
208
|
```
|
|
108
209
|
|
|
109
210
|
### MultiGeometries
|
|
@@ -111,6 +212,8 @@ poly = Poly(exterior, [hole])
|
|
|
111
212
|
Creating collections of geometries:
|
|
112
213
|
|
|
113
214
|
```python
|
|
215
|
+
from togo import Geometry, Point, Line, Poly, Ring
|
|
216
|
+
|
|
114
217
|
# Create a MultiPoint
|
|
115
218
|
multi_point = Geometry.from_multipoint([(0,0), (1,1), Point(2,2)])
|
|
116
219
|
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
togo.cpython-38-x86_64-linux-gnu.so,sha256=eQS8GlmKkzm7j8Cgwk56P0Wkp4QzHIUtTOvJasJ6XdY,2776376
|
|
2
|
+
togo-0.1.3.dist-info/LICENSE,sha256=OfTFHFMDSt9X89g-BWUVis-GuTPWAdjplg2z9d2dBCw,1073
|
|
3
|
+
togo-0.1.3.dist-info/METADATA,sha256=sbWN-guh8YaVvvIK317CRAUscBjr2C6hi0gfttFEfiI,6500
|
|
4
|
+
togo-0.1.3.dist-info/WHEEL,sha256=AtKzrIIwO6LyEQPNa-CKogjoLSeXFnST8-hqmpwwZQA,110
|
|
5
|
+
togo-0.1.3.dist-info/top_level.txt,sha256=bldd6tssR8THqoSDFauQQdh_pg79DMHBDhiNKgS4ttM,5
|
|
6
|
+
togo-0.1.3.dist-info/RECORD,,
|
|
Binary file
|
togo-0.1.1.dist-info/RECORD
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
togo.cpython-38-x86_64-linux-gnu.so,sha256=gy8NG5S-M-AuUueHVSRh7OkHPSuDjiakSLlxD7OlU68,2440400
|
|
2
|
-
togo-0.1.1.dist-info/LICENSE,sha256=OfTFHFMDSt9X89g-BWUVis-GuTPWAdjplg2z9d2dBCw,1073
|
|
3
|
-
togo-0.1.1.dist-info/METADATA,sha256=n95sQj4JthTc3N48uAuLUStU48rChvQOpiLRb_M8kBg,4089
|
|
4
|
-
togo-0.1.1.dist-info/WHEEL,sha256=AtKzrIIwO6LyEQPNa-CKogjoLSeXFnST8-hqmpwwZQA,110
|
|
5
|
-
togo-0.1.1.dist-info/top_level.txt,sha256=bldd6tssR8THqoSDFauQQdh_pg79DMHBDhiNKgS4ttM,5
|
|
6
|
-
togo-0.1.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|