togo 0.1.2__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.2.dist-info → togo-0.1.3.dist-info}/METADATA +106 -34
- togo-0.1.3.dist-info/RECORD +6 -0
- togo.cpython-38-x86_64-linux-gnu.so +0 -0
- togo-0.1.2.dist-info/RECORD +0 -6
- {togo-0.1.2.dist-info → togo-0.1.3.dist-info}/LICENSE +0 -0
- {togo-0.1.2.dist-info → togo-0.1.3.dist-info}/WHEEL +0 -0
- {togo-0.1.2.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
|
|
@@ -92,50 +92,27 @@ second = gc[1]
|
|
|
92
92
|
print(first.type_string()) # 'Point'
|
|
93
93
|
```
|
|
94
94
|
|
|
95
|
-
### Point
|
|
96
|
-
|
|
97
|
-
Building blocks for constructing geometries:
|
|
95
|
+
### Point
|
|
98
96
|
|
|
99
97
|
```python
|
|
98
|
+
from togo import Point
|
|
99
|
+
|
|
100
100
|
# Create a point
|
|
101
101
|
p = Point(1.0, 2.0)
|
|
102
102
|
|
|
103
|
-
#
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
# Create a ring (closed line)
|
|
107
|
-
ring = Ring([(0,0), (10,0), (10,10), (0,10), (0,0)])
|
|
108
|
-
|
|
109
|
-
# Create a polygon with holes
|
|
110
|
-
exterior = Ring([(0,0), (10,0), (10,10), (0,10), (0,0)])
|
|
111
|
-
hole = Ring([(2,2), (8,2), (8,8), (2,8), (2,2)])
|
|
112
|
-
poly = Poly(exterior, [hole])
|
|
113
|
-
```
|
|
103
|
+
# Access coordinates
|
|
104
|
+
print(f"X: {p.x}, Y: {p.y}")
|
|
114
105
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
Creating collections of geometries:
|
|
118
|
-
|
|
119
|
-
```python
|
|
120
|
-
# Create a MultiPoint
|
|
121
|
-
multi_point = Geometry.from_multipoint([(0,0), (1,1), Point(2,2)])
|
|
122
|
-
|
|
123
|
-
# Create a MultiLineString
|
|
124
|
-
multi_line = Geometry.from_multilinestring([
|
|
125
|
-
[(0,0), (1,1)],
|
|
126
|
-
Line([(2,2), (3,3)])
|
|
127
|
-
])
|
|
106
|
+
# Get as a tuple
|
|
107
|
+
print(p.as_tuple())
|
|
128
108
|
|
|
129
|
-
#
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
multi_poly = Geometry.from_multipolygon([poly1, poly2])
|
|
109
|
+
# Convert to a Geometry object
|
|
110
|
+
geom = p.as_geometry()
|
|
111
|
+
print(geom.type_string())
|
|
133
112
|
```
|
|
134
113
|
|
|
135
114
|
### Segment
|
|
136
115
|
|
|
137
|
-
Represents a line segment between two points:
|
|
138
|
-
|
|
139
116
|
```python
|
|
140
117
|
from togo import Segment, Point
|
|
141
118
|
|
|
@@ -157,6 +134,101 @@ other = Segment((1, 1), (2, 2))
|
|
|
157
134
|
print(seg.intersects(other)) # True or False
|
|
158
135
|
```
|
|
159
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()}")
|
|
150
|
+
|
|
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)
|
|
167
|
+
ring = Ring([(0,0), (10,0), (10,10), (0,10), (0,0)])
|
|
168
|
+
|
|
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
|
|
188
|
+
exterior = Ring([(0,0), (10,0), (10,10), (0,10), (0,0)])
|
|
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())}")
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### MultiGeometries
|
|
211
|
+
|
|
212
|
+
Creating collections of geometries:
|
|
213
|
+
|
|
214
|
+
```python
|
|
215
|
+
from togo import Geometry, Point, Line, Poly, Ring
|
|
216
|
+
|
|
217
|
+
# Create a MultiPoint
|
|
218
|
+
multi_point = Geometry.from_multipoint([(0,0), (1,1), Point(2,2)])
|
|
219
|
+
|
|
220
|
+
# Create a MultiLineString
|
|
221
|
+
multi_line = Geometry.from_multilinestring([
|
|
222
|
+
[(0,0), (1,1)],
|
|
223
|
+
Line([(2,2), (3,3)])
|
|
224
|
+
])
|
|
225
|
+
|
|
226
|
+
# Create a MultiPolygon
|
|
227
|
+
poly1 = Poly(Ring([(0,0), (1,0), (1,1), (0,1), (0,0)]))
|
|
228
|
+
poly2 = Poly(Ring([(2,2), (3,2), (3,3), (2,3), (2,2)]))
|
|
229
|
+
multi_poly = Geometry.from_multipolygon([poly1, poly2])
|
|
230
|
+
```
|
|
231
|
+
|
|
160
232
|
## Polygon Indexing
|
|
161
233
|
|
|
162
234
|
Togo supports different polygon indexing strategies for optimized spatial operations:
|
|
@@ -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.2.dist-info/RECORD
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
togo.cpython-38-x86_64-linux-gnu.so,sha256=H_MJ0aPGj3-sVpLBX38PjiYDtBl_cJ1-466sE4RZGls,2616296
|
|
2
|
-
togo-0.1.2.dist-info/LICENSE,sha256=OfTFHFMDSt9X89g-BWUVis-GuTPWAdjplg2z9d2dBCw,1073
|
|
3
|
-
togo-0.1.2.dist-info/METADATA,sha256=g_-jjPQBASw6rWSrqArK8Ad9VHx14-oiegCsedd7Nm8,4897
|
|
4
|
-
togo-0.1.2.dist-info/WHEEL,sha256=AtKzrIIwO6LyEQPNa-CKogjoLSeXFnST8-hqmpwwZQA,110
|
|
5
|
-
togo-0.1.2.dist-info/top_level.txt,sha256=bldd6tssR8THqoSDFauQQdh_pg79DMHBDhiNKgS4ttM,5
|
|
6
|
-
togo-0.1.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|