shapely 1.2.5__tar.gz → 1.2.6__tar.gz
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.
- {Shapely-1.2.5 → Shapely-1.2.6}/CHANGES.txt +9 -3
- {Shapely-1.2.5/Shapely.egg-info → Shapely-1.2.6}/PKG-INFO +1 -1
- {Shapely-1.2.5 → Shapely-1.2.6/Shapely.egg-info}/PKG-INFO +1 -1
- {Shapely-1.2.5 → Shapely-1.2.6}/Shapely.egg-info/SOURCES.txt +2 -1
- {Shapely-1.2.5 → Shapely-1.2.6}/docs/manual.txt +8 -6
- {Shapely-1.2.5 → Shapely-1.2.6}/setup.py +1 -1
- {Shapely-1.2.5 → Shapely-1.2.6}/shapely/geometry/base.py +8 -4
- {Shapely-1.2.5 → Shapely-1.2.6}/shapely/geometry/collection.py +3 -2
- {Shapely-1.2.5 → Shapely-1.2.6}/shapely/geometry/polygon.py +6 -4
- {Shapely-1.2.5 → Shapely-1.2.6}/shapely/tests/__init__.py +4 -1
- {Shapely-1.2.5 → Shapely-1.2.6}/shapely/tests/test_collection.py +1 -0
- {Shapely-1.2.5 → Shapely-1.2.6}/shapely/tests/test_delegated.py +6 -2
- Shapely-1.2.6/shapely/tests/test_linear_referencing.py +67 -0
- Shapely-1.2.6/shapely/tests/test_products_z.py +14 -0
- Shapely-1.2.5/shapely/tests/linear-referencing.txt +0 -58
- {Shapely-1.2.5 → Shapely-1.2.6}/CREDITS.txt +0 -0
- {Shapely-1.2.5 → Shapely-1.2.6}/LICENSE.txt +0 -0
- {Shapely-1.2.5 → Shapely-1.2.6}/README.txt +0 -0
- {Shapely-1.2.5 → Shapely-1.2.6}/Shapely.egg-info/dependency_links.txt +0 -0
- {Shapely-1.2.5 → Shapely-1.2.6}/Shapely.egg-info/top_level.txt +0 -0
- {Shapely-1.2.5 → Shapely-1.2.6}/examples/dissolve.py +0 -0
- {Shapely-1.2.5 → Shapely-1.2.6}/examples/intersect.py +0 -0
- {Shapely-1.2.5 → Shapely-1.2.6}/setup.cfg +0 -0
- {Shapely-1.2.5 → Shapely-1.2.6}/shapely/__init__.py +0 -0
- {Shapely-1.2.5 → Shapely-1.2.6}/shapely/coords.py +0 -0
- {Shapely-1.2.5 → Shapely-1.2.6}/shapely/ctypes_declarations.py +0 -0
- {Shapely-1.2.5 → Shapely-1.2.6}/shapely/geometry/__init__.py +0 -0
- {Shapely-1.2.5 → Shapely-1.2.6}/shapely/geometry/geo.py +0 -0
- {Shapely-1.2.5 → Shapely-1.2.6}/shapely/geometry/linestring.py +0 -0
- {Shapely-1.2.5 → Shapely-1.2.6}/shapely/geometry/multilinestring.py +0 -0
- {Shapely-1.2.5 → Shapely-1.2.6}/shapely/geometry/multipoint.py +0 -0
- {Shapely-1.2.5 → Shapely-1.2.6}/shapely/geometry/multipolygon.py +0 -0
- {Shapely-1.2.5 → Shapely-1.2.6}/shapely/geometry/point.py +0 -0
- {Shapely-1.2.5 → Shapely-1.2.6}/shapely/geometry/proxy.py +0 -0
- {Shapely-1.2.5 → Shapely-1.2.6}/shapely/geos.py +0 -0
- {Shapely-1.2.5 → Shapely-1.2.6}/shapely/impl.py +0 -0
- {Shapely-1.2.5 → Shapely-1.2.6}/shapely/iterops.py +0 -0
- {Shapely-1.2.5 → Shapely-1.2.6}/shapely/linref.py +0 -0
- {Shapely-1.2.5 → Shapely-1.2.6}/shapely/ops.py +0 -0
- {Shapely-1.2.5 → Shapely-1.2.6}/shapely/predicates.py +0 -0
- {Shapely-1.2.5 → Shapely-1.2.6}/shapely/prepared.py +0 -0
- {Shapely-1.2.5 → Shapely-1.2.6}/shapely/tests/Array.txt +0 -0
- {Shapely-1.2.5 → Shapely-1.2.6}/shapely/tests/GeoInterface.txt +0 -0
- {Shapely-1.2.5 → Shapely-1.2.6}/shapely/tests/IterOps.txt +0 -0
- {Shapely-1.2.5 → Shapely-1.2.6}/shapely/tests/LineString.txt +0 -0
- {Shapely-1.2.5 → Shapely-1.2.6}/shapely/tests/MultiLineString.txt +0 -0
- {Shapely-1.2.5 → Shapely-1.2.6}/shapely/tests/MultiPoint.txt +0 -0
- {Shapely-1.2.5 → Shapely-1.2.6}/shapely/tests/MultiPolygon.txt +0 -0
- {Shapely-1.2.5 → Shapely-1.2.6}/shapely/tests/Operations.txt +0 -0
- {Shapely-1.2.5 → Shapely-1.2.6}/shapely/tests/Persist.txt +0 -0
- {Shapely-1.2.5 → Shapely-1.2.6}/shapely/tests/Point.txt +0 -0
- {Shapely-1.2.5 → Shapely-1.2.6}/shapely/tests/Polygon.txt +0 -0
- {Shapely-1.2.5 → Shapely-1.2.6}/shapely/tests/Predicates.txt +0 -0
- {Shapely-1.2.5 → Shapely-1.2.6}/shapely/tests/attribute-chains.txt +0 -0
- {Shapely-1.2.5 → Shapely-1.2.6}/shapely/tests/binascii_hex.txt +0 -0
- {Shapely-1.2.5 → Shapely-1.2.6}/shapely/tests/cascaded_union.txt +0 -0
- {Shapely-1.2.5 → Shapely-1.2.6}/shapely/tests/dimensions.txt +0 -0
- {Shapely-1.2.5 → Shapely-1.2.6}/shapely/tests/invalid_intersection.txt +0 -0
- {Shapely-1.2.5 → Shapely-1.2.6}/shapely/tests/linemerge.txt +0 -0
- {Shapely-1.2.5 → Shapely-1.2.6}/shapely/tests/polygonize.txt +0 -0
- {Shapely-1.2.5 → Shapely-1.2.6}/shapely/tests/test_dlls.py +0 -0
- {Shapely-1.2.5 → Shapely-1.2.6}/shapely/tests/test_doctests.py +0 -0
- {Shapely-1.2.5 → Shapely-1.2.6}/shapely/tests/test_emptiness.py +0 -0
- {Shapely-1.2.5 → Shapely-1.2.6}/shapely/tests/test_equality.py +0 -0
- {Shapely-1.2.5 → Shapely-1.2.6}/shapely/tests/test_geomseq.py +0 -0
- {Shapely-1.2.5 → Shapely-1.2.6}/shapely/tests/test_mapping.py +0 -0
- {Shapely-1.2.5 → Shapely-1.2.6}/shapely/tests/test_prepared.py +0 -0
- {Shapely-1.2.5 → Shapely-1.2.6}/shapely/tests/test_singularity.py +0 -0
- {Shapely-1.2.5 → Shapely-1.2.6}/shapely/tests/test_validation.py +0 -0
- {Shapely-1.2.5 → Shapely-1.2.6}/shapely/tests/test_xy.py +0 -0
- {Shapely-1.2.5 → Shapely-1.2.6}/shapely/tests/threading_test.py +0 -0
- {Shapely-1.2.5 → Shapely-1.2.6}/shapely/tests/wkt_locale.txt +0 -0
- {Shapely-1.2.5 → Shapely-1.2.6}/shapely/topology.py +0 -0
- {Shapely-1.2.5 → Shapely-1.2.6}/shapely/validation.py +0 -0
- {Shapely-1.2.5 → Shapely-1.2.6}/shapely/wkb.py +0 -0
- {Shapely-1.2.5 → Shapely-1.2.6}/shapely/wkt.py +0 -0
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
1.2.6 (2010-10-21)
|
|
3
|
+
------------------
|
|
4
|
+
- The geoms property of an empty collection yields [] instead of a ValueError
|
|
5
|
+
(#3).
|
|
6
|
+
- The coords and geometry type sproperties have the same behavior as above.
|
|
7
|
+
- Ensure that z values carry through into products of operations (#4).
|
|
2
8
|
|
|
3
9
|
1.2.5 (2010-09-19)
|
|
4
10
|
------------------
|
|
@@ -9,8 +15,8 @@ All tickets are children of http://trac.gispython.org/lab/ticket.
|
|
|
9
15
|
------------------
|
|
10
16
|
- Raise AttributeError when there's no backend support for a method.
|
|
11
17
|
- Raise OSError if libgeos_c.so (or variants) can't be found and loaded.
|
|
12
|
-
- Add geos_c DLL loading support for linux platforms where find_library
|
|
13
|
-
|
|
18
|
+
- Add geos_c DLL loading support for linux platforms where find_library doesn't
|
|
19
|
+
work.
|
|
14
20
|
|
|
15
21
|
1.2.3 (2010-08-17)
|
|
16
22
|
------------------
|
|
@@ -54,7 +54,6 @@ shapely/tests/binascii_hex.txt
|
|
|
54
54
|
shapely/tests/cascaded_union.txt
|
|
55
55
|
shapely/tests/dimensions.txt
|
|
56
56
|
shapely/tests/invalid_intersection.txt
|
|
57
|
-
shapely/tests/linear-referencing.txt
|
|
58
57
|
shapely/tests/linemerge.txt
|
|
59
58
|
shapely/tests/polygonize.txt
|
|
60
59
|
shapely/tests/test_collection.py
|
|
@@ -64,8 +63,10 @@ shapely/tests/test_doctests.py
|
|
|
64
63
|
shapely/tests/test_emptiness.py
|
|
65
64
|
shapely/tests/test_equality.py
|
|
66
65
|
shapely/tests/test_geomseq.py
|
|
66
|
+
shapely/tests/test_linear_referencing.py
|
|
67
67
|
shapely/tests/test_mapping.py
|
|
68
68
|
shapely/tests/test_prepared.py
|
|
69
|
+
shapely/tests/test_products_z.py
|
|
69
70
|
shapely/tests/test_singularity.py
|
|
70
71
|
shapely/tests/test_validation.py
|
|
71
72
|
shapely/tests/test_xy.py
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
The Shapely
|
|
3
|
-
|
|
1
|
+
=======================
|
|
2
|
+
The Shapely User Manual
|
|
3
|
+
=======================
|
|
4
4
|
|
|
5
5
|
:Author: Sean Gillies, <sean.gillies@gmail.com>
|
|
6
|
-
:Revision: 1.2.
|
|
7
|
-
:Date:
|
|
6
|
+
:Revision: 1.2.6
|
|
7
|
+
:Date: 17 October 2010
|
|
8
8
|
:Copyright:
|
|
9
9
|
This work is licensed under a `Creative Commons Attribution 3.0
|
|
10
10
|
United States License`__.
|
|
@@ -56,7 +56,7 @@ multitude of State Plane projections, and Shapely doesn't burden you with them.
|
|
|
56
56
|
The third premise is that Python idioms trump GIS (or Java, in this case, since
|
|
57
57
|
the GEOS library is derived from JTS, a Java project) idioms.
|
|
58
58
|
|
|
59
|
-
If you enjoy and profit from Python
|
|
59
|
+
If you enjoy and profit from idiommatic Python, appreciate packages that do one
|
|
60
60
|
thing well, and agree that a spatially enabled RDBMS is often enough the wrong
|
|
61
61
|
tool for your computational geometry job, Shapely might be for you.
|
|
62
62
|
|
|
@@ -687,6 +687,8 @@ by empty features.
|
|
|
687
687
|
0.0
|
|
688
688
|
>>> line.bounds
|
|
689
689
|
()
|
|
690
|
+
>>> line.coords
|
|
691
|
+
[]
|
|
690
692
|
|
|
691
693
|
The coordinates of a empty feature can be set, after which the geometry is no
|
|
692
694
|
longer empty.
|
|
@@ -16,7 +16,7 @@ readme_text = file('README.txt', 'rb').read()
|
|
|
16
16
|
setup_args = dict(
|
|
17
17
|
metadata_version = '1.2',
|
|
18
18
|
name = 'Shapely',
|
|
19
|
-
version = '1.2.
|
|
19
|
+
version = '1.2.6',
|
|
20
20
|
requires_python = '>=2.5,<3',
|
|
21
21
|
requires_external = 'libgeos_c (>=3.1)',
|
|
22
22
|
description = 'Geometric objects, predicates, and operations',
|
|
@@ -42,7 +42,10 @@ def geom_factory(g, parent=None):
|
|
|
42
42
|
ob.__class__ = getattr(mod, geom_type)
|
|
43
43
|
ob.__geom__ = g
|
|
44
44
|
ob.__p__ = parent
|
|
45
|
-
|
|
45
|
+
if lgeos.methods['has_z'](g):
|
|
46
|
+
ob._ndim = 3
|
|
47
|
+
else:
|
|
48
|
+
ob._ndim = 2
|
|
46
49
|
return ob
|
|
47
50
|
|
|
48
51
|
def exceptNull(func):
|
|
@@ -159,9 +162,10 @@ class BaseGeometry(object):
|
|
|
159
162
|
# Coordinate access
|
|
160
163
|
# -----------------
|
|
161
164
|
|
|
162
|
-
@exceptNull
|
|
163
165
|
def _get_coords(self):
|
|
164
166
|
"""Access to geometry's coordinates (CoordinateSequence)"""
|
|
167
|
+
if self.is_empty:
|
|
168
|
+
return []
|
|
165
169
|
return CoordinateSequence(self)
|
|
166
170
|
|
|
167
171
|
def _set_coords(self, ob):
|
|
@@ -185,7 +189,6 @@ class BaseGeometry(object):
|
|
|
185
189
|
# Type of geometry and its representations
|
|
186
190
|
# ----------------------------------------
|
|
187
191
|
|
|
188
|
-
@exceptNull
|
|
189
192
|
def geometryType(self):
|
|
190
193
|
return geometry_type_name(self._geom)
|
|
191
194
|
|
|
@@ -480,8 +483,9 @@ class BaseMultipartGeometry(BaseGeometry):
|
|
|
480
483
|
"Multi-part geometries do not provide a coordinate sequence")
|
|
481
484
|
|
|
482
485
|
@property
|
|
483
|
-
@exceptNull
|
|
484
486
|
def geoms(self):
|
|
487
|
+
if self.is_empty:
|
|
488
|
+
return []
|
|
485
489
|
return GeometrySequence(self, self.shape_factory)
|
|
486
490
|
|
|
487
491
|
def __iter__(self):
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"""
|
|
3
3
|
|
|
4
4
|
from shapely.geometry.base import BaseMultipartGeometry
|
|
5
|
-
from shapely.geometry.base import HeterogeneousGeometrySequence
|
|
5
|
+
from shapely.geometry.base import HeterogeneousGeometrySequence
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
class GeometryCollection(BaseMultipartGeometry):
|
|
@@ -26,8 +26,9 @@ class GeometryCollection(BaseMultipartGeometry):
|
|
|
26
26
|
return dict(type='GeometryCollection', geometries=geometries)
|
|
27
27
|
|
|
28
28
|
@property
|
|
29
|
-
@exceptNull
|
|
30
29
|
def geoms(self):
|
|
30
|
+
if self.is_empty:
|
|
31
|
+
return []
|
|
31
32
|
return HeterogeneousGeometrySequence(self)
|
|
32
33
|
|
|
33
34
|
|
|
@@ -5,7 +5,7 @@ from ctypes import c_double, c_void_p, cast, POINTER
|
|
|
5
5
|
from ctypes import ArgumentError
|
|
6
6
|
import weakref
|
|
7
7
|
from shapely.geos import lgeos
|
|
8
|
-
from shapely.geometry.base import BaseGeometry
|
|
8
|
+
from shapely.geometry.base import BaseGeometry
|
|
9
9
|
from shapely.geometry.linestring import LineString, LineStringAdapter
|
|
10
10
|
from shapely.geometry.proxy import PolygonProxy
|
|
11
11
|
|
|
@@ -198,9 +198,10 @@ class Polygon(BaseGeometry):
|
|
|
198
198
|
self._geom, self._ndim = geos_polygon_from_py(shell, holes)
|
|
199
199
|
|
|
200
200
|
@property
|
|
201
|
-
@exceptNull
|
|
202
201
|
def exterior(self):
|
|
203
|
-
if self.
|
|
202
|
+
if self.is_empty:
|
|
203
|
+
return None
|
|
204
|
+
elif self._exterior is None or self._exterior() is None:
|
|
204
205
|
g = lgeos.GEOSGetExteriorRing(self._geom)
|
|
205
206
|
ring = LinearRing()
|
|
206
207
|
ring.__geom__ = g
|
|
@@ -211,8 +212,9 @@ class Polygon(BaseGeometry):
|
|
|
211
212
|
return self._exterior()
|
|
212
213
|
|
|
213
214
|
@property
|
|
214
|
-
@exceptNull
|
|
215
215
|
def interiors(self):
|
|
216
|
+
if self.is_empty:
|
|
217
|
+
return []
|
|
216
218
|
return InteriorRingSequence(self)
|
|
217
219
|
|
|
218
220
|
@property
|
|
@@ -2,7 +2,8 @@ from unittest import TestSuite
|
|
|
2
2
|
|
|
3
3
|
import test_doctests, test_prepared, test_equality, test_geomseq, test_xy
|
|
4
4
|
import test_collection, test_emptiness, test_singularity, test_validation
|
|
5
|
-
import test_mapping, test_delegated, test_dlls
|
|
5
|
+
import test_mapping, test_delegated, test_dlls, test_linear_referencing
|
|
6
|
+
import test_products_z
|
|
6
7
|
|
|
7
8
|
def test_suite():
|
|
8
9
|
suite = TestSuite()
|
|
@@ -18,5 +19,7 @@ def test_suite():
|
|
|
18
19
|
suite.addTest(test_mapping.test_suite())
|
|
19
20
|
suite.addTest(test_delegated.test_suite())
|
|
20
21
|
suite.addTest(test_dlls.test_suite())
|
|
22
|
+
suite.addTest(test_linear_referencing.test_suite())
|
|
23
|
+
suite.addTest(test_products_z.test_suite())
|
|
21
24
|
return suite
|
|
22
25
|
|
|
@@ -5,6 +5,7 @@ class CollectionTestCase(unittest.TestCase):
|
|
|
5
5
|
def test_array_interface(self):
|
|
6
6
|
m = GeometryCollection()
|
|
7
7
|
self.failUnlessEqual(len(m), 0)
|
|
8
|
+
self.failUnlessEqual(m.geoms, [])
|
|
8
9
|
|
|
9
10
|
def test_suite():
|
|
10
11
|
return unittest.TestLoader().loadTestsFromTestCase(CollectionTestCase)
|
|
@@ -15,8 +15,12 @@ class WrapperTestCase(unittest.TestCase):
|
|
|
15
15
|
def test_delegated(self):
|
|
16
16
|
self.assertRaises(AttributeError, getattr, Geometry(), 'foo')
|
|
17
17
|
def test_defaultimpl(self):
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
project_impl = Point.impl.map.pop('project', None)
|
|
19
|
+
try:
|
|
20
|
+
self.assertRaises(AttributeError, Point(0, 0).project, 1.0)
|
|
21
|
+
finally:
|
|
22
|
+
if project_impl is not None:
|
|
23
|
+
Point.impl.map['project'] = project_impl
|
|
20
24
|
|
|
21
25
|
def test_suite():
|
|
22
26
|
return unittest.TestLoader().loadTestsFromTestCase(WrapperTestCase)
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import unittest
|
|
2
|
+
from shapely.geometry import Point, LineString, MultiLineString
|
|
3
|
+
|
|
4
|
+
class LinearReferencingTestCase(unittest.TestCase):
|
|
5
|
+
def setUp(self):
|
|
6
|
+
self.point = Point(1, 1)
|
|
7
|
+
self.line1 = LineString(([0, 0], [2, 0]))
|
|
8
|
+
self.line2 = LineString(([3, 0], [3, 6]))
|
|
9
|
+
self.multiline = MultiLineString([
|
|
10
|
+
list(self.line1.coords), list(self.line2.coords)
|
|
11
|
+
])
|
|
12
|
+
|
|
13
|
+
def test_line1_project(self):
|
|
14
|
+
self.assertEqual(self.line1.project(self.point), 1.0)
|
|
15
|
+
self.assertEqual(self.line1.project(self.point, normalized=True), 0.5)
|
|
16
|
+
|
|
17
|
+
def test_line2_project(self):
|
|
18
|
+
self.assertEqual(self.line2.project(self.point), 1.0)
|
|
19
|
+
self.assertAlmostEqual(self.line2.project(self.point, normalized=True),
|
|
20
|
+
0.16666666666, 8)
|
|
21
|
+
|
|
22
|
+
def test_multiline_project(self):
|
|
23
|
+
self.assertEqual(self.multiline.project(self.point), 1.0)
|
|
24
|
+
self.assertEqual(self.multiline.project(self.point, normalized=True),
|
|
25
|
+
0.125)
|
|
26
|
+
|
|
27
|
+
def test_not_supported_project(self):
|
|
28
|
+
self.assertRaises(TypeError, self.point.buffer(1.0).project,
|
|
29
|
+
self.point)
|
|
30
|
+
|
|
31
|
+
def test_not_on_line_project(self):
|
|
32
|
+
# Points that aren't on the line project to 0.
|
|
33
|
+
self.assertEqual(self.line1.project(Point(-10,-10)), 0.0)
|
|
34
|
+
|
|
35
|
+
def test_line1_interpolate(self):
|
|
36
|
+
self.failUnless(self.line1.interpolate(0.5).equals(Point(0.5, 0.0)))
|
|
37
|
+
self.failUnless(
|
|
38
|
+
self.line1.interpolate(0.5, normalized=True).equals(
|
|
39
|
+
Point(1.0, 0.0)))
|
|
40
|
+
|
|
41
|
+
def test_line2_interpolate(self):
|
|
42
|
+
self.failUnless(self.line2.interpolate(0.5).equals(Point(3.0, 0.5)))
|
|
43
|
+
self.failUnless(
|
|
44
|
+
self.line2.interpolate(0.5, normalized=True).equals(
|
|
45
|
+
Point(3.0, 3.0)))
|
|
46
|
+
|
|
47
|
+
def test_multiline_interpolate(self):
|
|
48
|
+
self.failUnless(self.multiline.interpolate(0.5).equals(
|
|
49
|
+
Point(0.5, 0.0)))
|
|
50
|
+
self.failUnless(
|
|
51
|
+
self.multiline.interpolate(0.5, normalized=True).equals(
|
|
52
|
+
Point(3.0, 2.0)))
|
|
53
|
+
|
|
54
|
+
def test_line_ends_interpolate(self):
|
|
55
|
+
# Distances greater than length of the line or less than
|
|
56
|
+
# zero yield the line's ends.
|
|
57
|
+
self.failUnless(self.line1.interpolate(-1000).equals(Point(0.0, 0.0)))
|
|
58
|
+
self.failUnless(self.line1.interpolate(1000).equals(Point(2.0, 0.0)))
|
|
59
|
+
|
|
60
|
+
def test_suite():
|
|
61
|
+
try:
|
|
62
|
+
LineString(([0, 0], [2, 0])).project(Point(0, 0))
|
|
63
|
+
except AttributeError:
|
|
64
|
+
return lambda x: None
|
|
65
|
+
return unittest.TestLoader().loadTestsFromTestCase(
|
|
66
|
+
LinearReferencingTestCase
|
|
67
|
+
)
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import unittest
|
|
2
|
+
from shapely.geometry import LineString
|
|
3
|
+
|
|
4
|
+
class ProductZTestCase(unittest.TestCase):
|
|
5
|
+
def test_line_intersection(self):
|
|
6
|
+
line1 = LineString([(0,0,0), (1,1,1)])
|
|
7
|
+
line2 = LineString([(0,1,1), (1,0,0)])
|
|
8
|
+
interxn = line1.intersection(line2)
|
|
9
|
+
self.failUnless(interxn.has_z)
|
|
10
|
+
self.failUnless(interxn._ndim == 3)
|
|
11
|
+
self.failUnless(0.0 <= interxn.z <= 1.0)
|
|
12
|
+
|
|
13
|
+
def test_suite():
|
|
14
|
+
return unittest.TestLoader().loadTestsFromTestCase(ProductZTestCase)
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
First, tests of projection
|
|
2
|
-
|
|
3
|
-
>>> from shapely.geometry import Point, LineString, MultiLineString
|
|
4
|
-
|
|
5
|
-
>>> point = Point(1, 1)
|
|
6
|
-
>>> line1 = LineString(([0, 0], [2, 0]))
|
|
7
|
-
>>> line1.project(point)
|
|
8
|
-
1.0
|
|
9
|
-
>>> line1.project(point, normalized=True)
|
|
10
|
-
0.5
|
|
11
|
-
|
|
12
|
-
>>> line2 = LineString(([3, 0], [3, 6]))
|
|
13
|
-
>>> line2.project(point)
|
|
14
|
-
1.0
|
|
15
|
-
>>> line2.project(point, normalized=True)
|
|
16
|
-
0.16666666666666666
|
|
17
|
-
|
|
18
|
-
>>> multiline = MultiLineString([list(line1.coords), list(line2.coords)])
|
|
19
|
-
>>> multiline.project(point)
|
|
20
|
-
1.0
|
|
21
|
-
>>> multiline.project(point, normalized=True)
|
|
22
|
-
0.125
|
|
23
|
-
|
|
24
|
-
>>> point.buffer(1.0).project(point) # doctest: +ELLIPSIS
|
|
25
|
-
Traceback (most recent call last):
|
|
26
|
-
...
|
|
27
|
-
TypeError: Only linear types support this operation
|
|
28
|
-
|
|
29
|
-
Points that aren't on the line project to 0.
|
|
30
|
-
|
|
31
|
-
>>> line1.project(Point(-10,-10))
|
|
32
|
-
0.0
|
|
33
|
-
|
|
34
|
-
Now tests of interpolation
|
|
35
|
-
|
|
36
|
-
>>> line1.interpolate(0.5).wkt
|
|
37
|
-
'POINT (0.5000000000000000 0.0000000000000000)'
|
|
38
|
-
>>> line1.interpolate(0.5, normalized=True).wkt
|
|
39
|
-
'POINT (1.0000000000000000 0.0000000000000000)'
|
|
40
|
-
|
|
41
|
-
>>> line2.interpolate(0.5).wkt
|
|
42
|
-
'POINT (3.0000000000000000 0.5000000000000000)'
|
|
43
|
-
>>> line2.interpolate(0.5, normalized=True).wkt
|
|
44
|
-
'POINT (3.0000000000000000 3.0000000000000000)'
|
|
45
|
-
|
|
46
|
-
>>> multiline.interpolate(0.5).wkt
|
|
47
|
-
'POINT (0.5000000000000000 0.0000000000000000)'
|
|
48
|
-
>>> multiline.interpolate(0.5, normalized=True).wkt
|
|
49
|
-
'POINT (3.0000000000000000 2.0000000000000000)'
|
|
50
|
-
|
|
51
|
-
Distances greater than length of the line or less than zero yield the line's
|
|
52
|
-
ends.
|
|
53
|
-
|
|
54
|
-
>>> line1.interpolate(-1000.0).wkt
|
|
55
|
-
'POINT (0.0000000000000000 0.0000000000000000)'
|
|
56
|
-
>>> line1.interpolate(1000.0).wkt
|
|
57
|
-
'POINT (2.0000000000000000 0.0000000000000000)'
|
|
58
|
-
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|