shapely 1.2.9__tar.gz → 1.2.10__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.9 → Shapely-1.2.10}/CHANGES.txt +7 -0
- {Shapely-1.2.9/Shapely.egg-info → Shapely-1.2.10}/PKG-INFO +8 -1
- {Shapely-1.2.9 → Shapely-1.2.10/Shapely.egg-info}/PKG-INFO +8 -1
- {Shapely-1.2.9 → Shapely-1.2.10}/Shapely.egg-info/SOURCES.txt +7 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/docs/manual.txt +64 -2
- Shapely-1.2.10/setup.py +116 -0
- Shapely-1.2.10/shapely/algorithms/__init__.py +0 -0
- Shapely-1.2.10/shapely/algorithms/cga.py +17 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/shapely/geometry/polygon.py +21 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/shapely/impl.py +4 -0
- Shapely-1.2.10/shapely/speedups/__init__.py +39 -0
- Shapely-1.2.10/shapely/speedups/_speedups.c +4551 -0
- Shapely-1.2.10/shapely/speedups/_speedups.pyx +295 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/shapely/tests/__init__.py +3 -1
- Shapely-1.2.10/shapely/tests/test_cga.py +33 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/shapely/tests/test_dlls.py +3 -2
- Shapely-1.2.10/shapely/tests/test_speedups.py +38 -0
- Shapely-1.2.9/setup.py +0 -57
- {Shapely-1.2.9 → Shapely-1.2.10}/CREDITS.txt +0 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/LICENSE.txt +0 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/README.txt +0 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/Shapely.egg-info/dependency_links.txt +0 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/Shapely.egg-info/top_level.txt +0 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/setup.cfg +0 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/shapely/__init__.py +0 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/shapely/coords.py +0 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/shapely/ctypes_declarations.py +0 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/shapely/examples/__init__.py +0 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/shapely/examples/dissolve.py +0 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/shapely/examples/geoms.py +0 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/shapely/examples/intersect.py +0 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/shapely/examples/world.py +0 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/shapely/ftools.py +0 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/shapely/geometry/__init__.py +0 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/shapely/geometry/base.py +0 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/shapely/geometry/collection.py +0 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/shapely/geometry/geo.py +0 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/shapely/geometry/linestring.py +0 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/shapely/geometry/multilinestring.py +0 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/shapely/geometry/multipoint.py +0 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/shapely/geometry/multipolygon.py +0 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/shapely/geometry/point.py +0 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/shapely/geometry/proxy.py +0 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/shapely/geos.py +0 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/shapely/iterops.py +0 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/shapely/linref.py +0 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/shapely/ops.py +0 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/shapely/predicates.py +0 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/shapely/prepared.py +0 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/shapely/tests/Array.txt +0 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/shapely/tests/GeoInterface.txt +0 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/shapely/tests/IterOps.txt +0 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/shapely/tests/LineString.txt +0 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/shapely/tests/MultiLineString.txt +0 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/shapely/tests/MultiPoint.txt +0 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/shapely/tests/MultiPolygon.txt +0 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/shapely/tests/Operations.txt +0 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/shapely/tests/Persist.txt +0 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/shapely/tests/Point.txt +0 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/shapely/tests/Polygon.txt +0 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/shapely/tests/Predicates.txt +0 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/shapely/tests/attribute-chains.txt +0 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/shapely/tests/binascii_hex.txt +0 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/shapely/tests/cascaded_union.txt +0 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/shapely/tests/dimensions.txt +0 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/shapely/tests/invalid_intersection.txt +0 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/shapely/tests/linemerge.txt +0 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/shapely/tests/polygonize.txt +0 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/shapely/tests/test_box.py +0 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/shapely/tests/test_collection.py +0 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/shapely/tests/test_delegated.py +0 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/shapely/tests/test_doctests.py +0 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/shapely/tests/test_emptiness.py +0 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/shapely/tests/test_equality.py +0 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/shapely/tests/test_geomseq.py +0 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/shapely/tests/test_linear_referencing.py +0 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/shapely/tests/test_mapping.py +0 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/shapely/tests/test_prepared.py +0 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/shapely/tests/test_products_z.py +0 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/shapely/tests/test_singularity.py +0 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/shapely/tests/test_validation.py +0 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/shapely/tests/test_xy.py +0 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/shapely/tests/threading_test.py +0 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/shapely/tests/wkt_locale.txt +0 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/shapely/topology.py +0 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/shapely/validation.py +0 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/shapely/wkb.py +0 -0
- {Shapely-1.2.9 → Shapely-1.2.10}/shapely/wkt.py +0 -0
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
CHANGES
|
|
3
3
|
=======
|
|
4
4
|
|
|
5
|
+
1.2.10 (2011-05-09)
|
|
6
|
+
-------------------
|
|
7
|
+
- Add optional Cython speedups.
|
|
8
|
+
- Add is_cww predicate to LinearRing.
|
|
9
|
+
- Add function that forces orientation of Polygons.
|
|
10
|
+
- Disable build of speedups on Windows pending packaging work.
|
|
11
|
+
|
|
5
12
|
1.2.9 (2011-03-31)
|
|
6
13
|
------------------
|
|
7
14
|
- Remove extra glob import.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 1.0
|
|
2
2
|
Name: Shapely
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.10
|
|
4
4
|
Summary: Geometric objects, predicates, and operations
|
|
5
5
|
Home-page: http://trac.gispython.org/lab/wiki/Shapely
|
|
6
6
|
Author: Sean Gillies
|
|
@@ -166,6 +166,13 @@ Description: ======
|
|
|
166
166
|
CHANGES
|
|
167
167
|
=======
|
|
168
168
|
|
|
169
|
+
1.2.10 (2011-05-09)
|
|
170
|
+
-------------------
|
|
171
|
+
- Add optional Cython speedups.
|
|
172
|
+
- Add is_cww predicate to LinearRing.
|
|
173
|
+
- Add function that forces orientation of Polygons.
|
|
174
|
+
- Disable build of speedups on Windows pending packaging work.
|
|
175
|
+
|
|
169
176
|
1.2.9 (2011-03-31)
|
|
170
177
|
------------------
|
|
171
178
|
- Remove extra glob import.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 1.0
|
|
2
2
|
Name: Shapely
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.10
|
|
4
4
|
Summary: Geometric objects, predicates, and operations
|
|
5
5
|
Home-page: http://trac.gispython.org/lab/wiki/Shapely
|
|
6
6
|
Author: Sean Gillies
|
|
@@ -166,6 +166,13 @@ Description: ======
|
|
|
166
166
|
CHANGES
|
|
167
167
|
=======
|
|
168
168
|
|
|
169
|
+
1.2.10 (2011-05-09)
|
|
170
|
+
-------------------
|
|
171
|
+
- Add optional Cython speedups.
|
|
172
|
+
- Add is_cww predicate to LinearRing.
|
|
173
|
+
- Add function that forces orientation of Polygons.
|
|
174
|
+
- Disable build of speedups on Windows pending packaging work.
|
|
175
|
+
|
|
169
176
|
1.2.9 (2011-03-31)
|
|
170
177
|
------------------
|
|
171
178
|
- Remove extra glob import.
|
|
@@ -24,6 +24,8 @@ shapely/topology.py
|
|
|
24
24
|
shapely/validation.py
|
|
25
25
|
shapely/wkb.py
|
|
26
26
|
shapely/wkt.py
|
|
27
|
+
shapely/algorithms/__init__.py
|
|
28
|
+
shapely/algorithms/cga.py
|
|
27
29
|
shapely/examples/__init__.py
|
|
28
30
|
shapely/examples/dissolve.py
|
|
29
31
|
shapely/examples/geoms.py
|
|
@@ -40,6 +42,9 @@ shapely/geometry/multipolygon.py
|
|
|
40
42
|
shapely/geometry/point.py
|
|
41
43
|
shapely/geometry/polygon.py
|
|
42
44
|
shapely/geometry/proxy.py
|
|
45
|
+
shapely/speedups/__init__.py
|
|
46
|
+
shapely/speedups/_speedups.c
|
|
47
|
+
shapely/speedups/_speedups.pyx
|
|
43
48
|
shapely/tests/Array.txt
|
|
44
49
|
shapely/tests/GeoInterface.txt
|
|
45
50
|
shapely/tests/IterOps.txt
|
|
@@ -61,6 +66,7 @@ shapely/tests/invalid_intersection.txt
|
|
|
61
66
|
shapely/tests/linemerge.txt
|
|
62
67
|
shapely/tests/polygonize.txt
|
|
63
68
|
shapely/tests/test_box.py
|
|
69
|
+
shapely/tests/test_cga.py
|
|
64
70
|
shapely/tests/test_collection.py
|
|
65
71
|
shapely/tests/test_delegated.py
|
|
66
72
|
shapely/tests/test_dlls.py
|
|
@@ -73,6 +79,7 @@ shapely/tests/test_mapping.py
|
|
|
73
79
|
shapely/tests/test_prepared.py
|
|
74
80
|
shapely/tests/test_products_z.py
|
|
75
81
|
shapely/tests/test_singularity.py
|
|
82
|
+
shapely/tests/test_speedups.py
|
|
76
83
|
shapely/tests/test_validation.py
|
|
77
84
|
shapely/tests/test_xy.py
|
|
78
85
|
shapely/tests/threading_test.py
|
|
@@ -3,8 +3,8 @@ The Shapely User Manual
|
|
|
3
3
|
=======================
|
|
4
4
|
|
|
5
5
|
:Author: Sean Gillies, <sean.gillies@gmail.com>
|
|
6
|
-
:Revision: 1.2.
|
|
7
|
-
:Date:
|
|
6
|
+
:Revision: 1.2.10
|
|
7
|
+
:Date: 2 May 2011
|
|
8
8
|
:Copyright:
|
|
9
9
|
This work is licensed under a `Creative Commons Attribution 3.0
|
|
10
10
|
United States License`__.
|
|
@@ -493,6 +493,17 @@ For example:
|
|
|
493
493
|
|
|
494
494
|
This is the first appearance of an explicit polygon handedness in Shapely.
|
|
495
495
|
|
|
496
|
+
To obtain a polygon with a known orientation, use
|
|
497
|
+
:func:`shapely.geometry.polygon.orient()`:
|
|
498
|
+
|
|
499
|
+
.. function:: shapely.geometry.polygon.orient(polygon, sign=1.0)
|
|
500
|
+
|
|
501
|
+
Returns a properly oriented copy of the given polygon. The signed area of the
|
|
502
|
+
result will have the given sign. A sign of 1.0 means that the coordinates of the
|
|
503
|
+
product's exterior ring will be oriented counter-clockwise.
|
|
504
|
+
|
|
505
|
+
`New in version 1.2.10`.
|
|
506
|
+
|
|
496
507
|
.. _collections:
|
|
497
508
|
|
|
498
509
|
Collections
|
|
@@ -835,6 +846,29 @@ example will be shown for each.
|
|
|
835
846
|
>>> Point(0, 0, 0).has_z
|
|
836
847
|
True
|
|
837
848
|
|
|
849
|
+
.. attribute:: object.is_ccw
|
|
850
|
+
|
|
851
|
+
Returns ``True`` if coordinates are in counter-clockwise order (bounding a region
|
|
852
|
+
with positive signed area). This method applies to `LinearRing` objects only.
|
|
853
|
+
|
|
854
|
+
`New in version 1.2.10`.
|
|
855
|
+
|
|
856
|
+
.. sourcecode:: pycon
|
|
857
|
+
|
|
858
|
+
>>> LinearRing([(1,0), (1,1), (0,0)]).is_ccw
|
|
859
|
+
True
|
|
860
|
+
|
|
861
|
+
A ring with an undesired orientation can be reversed like this:
|
|
862
|
+
|
|
863
|
+
.. sourcecode:: pycon
|
|
864
|
+
|
|
865
|
+
>>> ring = LinearRing([(0,0), (1,1), (1,0)])
|
|
866
|
+
>>> ring.is_ccw
|
|
867
|
+
False
|
|
868
|
+
>>> ring.coords = list(ring.coords)[::-1]
|
|
869
|
+
>>> ring.is_ccw
|
|
870
|
+
True
|
|
871
|
+
|
|
838
872
|
.. attribute:: object.is_empty
|
|
839
873
|
|
|
840
874
|
Returns ``True`` if the feature's `interior` and `boundary` (in point set
|
|
@@ -1756,6 +1790,34 @@ For example, using the same `GeoThing` class:
|
|
|
1756
1790
|
>>> m['coordinates']
|
|
1757
1791
|
(0.0, 0.0)}
|
|
1758
1792
|
|
|
1793
|
+
|
|
1794
|
+
Performance
|
|
1795
|
+
===========
|
|
1796
|
+
|
|
1797
|
+
Shapely uses the GEOS_ library for all operations. GEOS is written in C++ and
|
|
1798
|
+
used in many applications and you can expect that all operations are highly
|
|
1799
|
+
optimized. Only the creation of new geometries involves some overhead that
|
|
1800
|
+
might slow down your code, if you create lots of geometries with a large number
|
|
1801
|
+
of coordinates.
|
|
1802
|
+
|
|
1803
|
+
.. versionadded:: 1.2.10
|
|
1804
|
+
|
|
1805
|
+
The :mod:`shapely.speedups` module contains performance enhancements written
|
|
1806
|
+
in C. They are automaticaly installed when Python has access to a compiler
|
|
1807
|
+
during installation.
|
|
1808
|
+
|
|
1809
|
+
You can check if the speedups are installed with the :attr:`available`
|
|
1810
|
+
attribute. To enable the speedups call :func:`enable`. You can revert to the
|
|
1811
|
+
default implementation with :func:`disable`.
|
|
1812
|
+
|
|
1813
|
+
.. sourcecode:: pycon
|
|
1814
|
+
|
|
1815
|
+
>>> from shapely import speedups
|
|
1816
|
+
>>> speedups.available
|
|
1817
|
+
True
|
|
1818
|
+
>>> speedups.enable()
|
|
1819
|
+
|
|
1820
|
+
|
|
1759
1821
|
Conclusion
|
|
1760
1822
|
==========
|
|
1761
1823
|
|
Shapely-1.2.10/setup.py
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import glob
|
|
2
|
+
import warnings
|
|
3
|
+
|
|
4
|
+
try:
|
|
5
|
+
from distribute_setup import use_setuptools
|
|
6
|
+
use_setuptools()
|
|
7
|
+
except:
|
|
8
|
+
warnings.warn(
|
|
9
|
+
"Failed to import distribute_setup, continuing without distribute.",
|
|
10
|
+
Warning)
|
|
11
|
+
|
|
12
|
+
from distutils.errors import CCompilerError, DistutilsExecError, \
|
|
13
|
+
DistutilsPlatformError
|
|
14
|
+
from setuptools.extension import Extension
|
|
15
|
+
from setuptools.command.build_ext import build_ext
|
|
16
|
+
from setuptools import setup, find_packages
|
|
17
|
+
import sys
|
|
18
|
+
|
|
19
|
+
readme_text = file('README.txt', 'rb').read()
|
|
20
|
+
changes_text = file('CHANGES.txt', 'rb').read()
|
|
21
|
+
|
|
22
|
+
setup_args = dict(
|
|
23
|
+
metadata_version = '1.2',
|
|
24
|
+
name = 'Shapely',
|
|
25
|
+
version = '1.2.10',
|
|
26
|
+
requires_python = '>=2.5,<3',
|
|
27
|
+
requires_external = 'libgeos_c (>=3.1)',
|
|
28
|
+
description = 'Geometric objects, predicates, and operations',
|
|
29
|
+
license = 'BSD',
|
|
30
|
+
keywords = 'geometry topology gis',
|
|
31
|
+
author = 'Sean Gillies',
|
|
32
|
+
author_email = 'sean.gillies@gmail.com',
|
|
33
|
+
maintainer = 'Sean Gillies',
|
|
34
|
+
maintainer_email = 'sean.gillies@gmail.com',
|
|
35
|
+
url = 'http://trac.gispython.org/lab/wiki/Shapely',
|
|
36
|
+
long_description = readme_text + "\n" + changes_text,
|
|
37
|
+
packages = find_packages(),
|
|
38
|
+
test_suite = 'shapely.tests.test_suite',
|
|
39
|
+
classifiers = [
|
|
40
|
+
'Development Status :: 5 - Production/Stable',
|
|
41
|
+
'Intended Audience :: Developers',
|
|
42
|
+
'Intended Audience :: Science/Research',
|
|
43
|
+
'License :: OSI Approved :: BSD License',
|
|
44
|
+
'Operating System :: OS Independent',
|
|
45
|
+
'Programming Language :: Python',
|
|
46
|
+
'Topic :: Scientific/Engineering :: GIS',
|
|
47
|
+
],
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
# Add DLLs for Windows
|
|
51
|
+
if sys.platform == 'win32':
|
|
52
|
+
if '(AMD64)' in sys.version:
|
|
53
|
+
setup_args.update(
|
|
54
|
+
data_files=[('DLLs', glob.glob('DLLs_AMD64/*.dll'))]
|
|
55
|
+
)
|
|
56
|
+
else:
|
|
57
|
+
setup_args.update(
|
|
58
|
+
data_files=[('DLLs', glob.glob('DLLs_x86/*.dll'))]
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
# Optional compilation of speedups
|
|
63
|
+
# setuptools stuff from Bob Ippolito's simplejson project
|
|
64
|
+
if sys.platform == 'win32' and sys.version_info > (2, 6):
|
|
65
|
+
# 2.6's distutils.msvc9compiler can raise an IOError when failing to
|
|
66
|
+
# find the compiler
|
|
67
|
+
ext_errors = (CCompilerError, DistutilsExecError, DistutilsPlatformError,
|
|
68
|
+
IOError)
|
|
69
|
+
else:
|
|
70
|
+
ext_errors = (CCompilerError, DistutilsExecError, DistutilsPlatformError)
|
|
71
|
+
|
|
72
|
+
class BuildFailed(Exception):
|
|
73
|
+
pass
|
|
74
|
+
|
|
75
|
+
class ve_build_ext(build_ext):
|
|
76
|
+
# This class allows C extension building to fail.
|
|
77
|
+
|
|
78
|
+
def run(self):
|
|
79
|
+
try:
|
|
80
|
+
build_ext.run(self)
|
|
81
|
+
except DistutilsPlatformError, x:
|
|
82
|
+
raise BuildFailed(x)
|
|
83
|
+
|
|
84
|
+
def build_extension(self, ext):
|
|
85
|
+
try:
|
|
86
|
+
build_ext.build_extension(self, ext)
|
|
87
|
+
except ext_errors, x:
|
|
88
|
+
raise BuildFailed(x)
|
|
89
|
+
|
|
90
|
+
if sys.platform == 'win32':
|
|
91
|
+
ext_modules = []
|
|
92
|
+
else:
|
|
93
|
+
ext_modules = [
|
|
94
|
+
Extension("shapely.speedups._speedups",
|
|
95
|
+
["shapely/speedups/_speedups.c"], libraries=['geos_c']),
|
|
96
|
+
]
|
|
97
|
+
|
|
98
|
+
try:
|
|
99
|
+
# try building with speedups
|
|
100
|
+
setup(
|
|
101
|
+
cmdclass={'build_ext': ve_build_ext},
|
|
102
|
+
ext_modules=ext_modules,
|
|
103
|
+
**setup_args
|
|
104
|
+
)
|
|
105
|
+
except BuildFailed, ex:
|
|
106
|
+
BUILD_EXT_WARNING = "Warning: The C extension could not be compiled, speedups are not enabled."
|
|
107
|
+
print ex
|
|
108
|
+
print BUILD_EXT_WARNING
|
|
109
|
+
print "Failure information, if any, is above."
|
|
110
|
+
print "I'm retrying the build without the C extension now."
|
|
111
|
+
|
|
112
|
+
setup(**setup_args)
|
|
113
|
+
|
|
114
|
+
print BUILD_EXT_WARNING
|
|
115
|
+
print "Plain-Python installation succeeded."
|
|
116
|
+
|
|
File without changes
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
from itertools import islice, izip
|
|
2
|
+
|
|
3
|
+
def signed_area(ring):
|
|
4
|
+
"""Return the signed area enclosed by a ring in linear time using the
|
|
5
|
+
algorithm at: http://www.cgafaq.info/wiki/Polygon_Area.
|
|
6
|
+
"""
|
|
7
|
+
xs, ys = ring.coords.xy
|
|
8
|
+
xs.append(xs[1])
|
|
9
|
+
ys.append(ys[1])
|
|
10
|
+
return sum(xs[i]*(ys[i+1]-ys[i-1]) for i in range(1, len(ring.coords)))/2.0
|
|
11
|
+
|
|
12
|
+
def is_ccw_impl(name):
|
|
13
|
+
"""Predicate implementation"""
|
|
14
|
+
def is_ccw_op(ring):
|
|
15
|
+
return signed_area(ring) >= 0.0
|
|
16
|
+
return is_ccw_op
|
|
17
|
+
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
from ctypes import c_double, c_void_p, cast, POINTER
|
|
5
5
|
from ctypes import ArgumentError
|
|
6
6
|
import weakref
|
|
7
|
+
|
|
8
|
+
from shapely.algorithms.cga import signed_area
|
|
7
9
|
from shapely.geos import lgeos
|
|
8
10
|
from shapely.geometry.base import BaseGeometry
|
|
9
11
|
from shapely.geometry.linestring import LineString, LineStringAdapter
|
|
@@ -61,6 +63,11 @@ class LinearRing(LineString):
|
|
|
61
63
|
|
|
62
64
|
coords = property(_get_coords, _set_coords)
|
|
63
65
|
|
|
66
|
+
@property
|
|
67
|
+
def is_ccw(self):
|
|
68
|
+
"""Brand new"""
|
|
69
|
+
return bool(self.impl['is_ccw'](self))
|
|
70
|
+
|
|
64
71
|
|
|
65
72
|
class LinearRingAdapter(LineStringAdapter):
|
|
66
73
|
|
|
@@ -277,6 +284,20 @@ def asPolygon(shell, holes=None):
|
|
|
277
284
|
"""Adapt objects to the Polygon interface"""
|
|
278
285
|
return PolygonAdapter(shell, holes)
|
|
279
286
|
|
|
287
|
+
def orient(polygon, sign=1.0):
|
|
288
|
+
s = float(sign)
|
|
289
|
+
rings = []
|
|
290
|
+
ring = polygon.exterior
|
|
291
|
+
if signed_area(ring)/s >= 0.0:
|
|
292
|
+
rings.append(ring)
|
|
293
|
+
else:
|
|
294
|
+
rings.append(list(ring.coords)[::-1])
|
|
295
|
+
for ring in polygon.interiors:
|
|
296
|
+
if signed_area(ring)/s <= 0.0:
|
|
297
|
+
rings.append(ring)
|
|
298
|
+
else:
|
|
299
|
+
rings.append(list(ring.coords)[::-1])
|
|
300
|
+
return Polygon(rings[0], rings[1:])
|
|
280
301
|
|
|
281
302
|
def geos_linearring_from_py(ob, update_geom=None, update_ndim=0):
|
|
282
303
|
try:
|
|
@@ -13,6 +13,7 @@ Shapely 1.2 includes a GEOS backend and it is the default.
|
|
|
13
13
|
|
|
14
14
|
from ftools import wraps
|
|
15
15
|
|
|
16
|
+
from shapely.algorithms import cga
|
|
16
17
|
from shapely.coords import BoundsOp
|
|
17
18
|
from shapely.geos import lgeos
|
|
18
19
|
from shapely.linref import ProjectOp, InterpolateOp
|
|
@@ -81,6 +82,9 @@ IMPL14 = {
|
|
|
81
82
|
'touches': (BinaryPredicate, 'touches'),
|
|
82
83
|
'within': (BinaryPredicate, 'within'),
|
|
83
84
|
'equals_exact': (BinaryPredicate, 'equals_exact'),
|
|
85
|
+
|
|
86
|
+
# First pure Python implementation
|
|
87
|
+
'is_ccw': (cga.is_ccw_impl, 'is_ccw'),
|
|
84
88
|
}
|
|
85
89
|
|
|
86
90
|
IMPL15 = {
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import warnings
|
|
2
|
+
|
|
3
|
+
from shapely.geometry import linestring, polygon
|
|
4
|
+
from shapely import coords
|
|
5
|
+
|
|
6
|
+
try:
|
|
7
|
+
from shapely.speedups import _speedups
|
|
8
|
+
available = True
|
|
9
|
+
except ImportError:
|
|
10
|
+
available = False
|
|
11
|
+
|
|
12
|
+
__all__ = ['available', 'enable', 'disable']
|
|
13
|
+
_orig = {}
|
|
14
|
+
|
|
15
|
+
def enable():
|
|
16
|
+
if not available:
|
|
17
|
+
warnings.warn("shapely.speedups not available", RuntimeWarning)
|
|
18
|
+
return
|
|
19
|
+
|
|
20
|
+
if _orig:
|
|
21
|
+
return
|
|
22
|
+
|
|
23
|
+
_orig['CoordinateSequence.ctypes'] = coords.CoordinateSequence.ctypes
|
|
24
|
+
coords.CoordinateSequence.ctypes = property(_speedups.coordseq_ctypes)
|
|
25
|
+
|
|
26
|
+
_orig['geos_linestring_from_py'] = linestring.geos_linestring_from_py
|
|
27
|
+
linestring.geos_linestring_from_py = _speedups.geos_linestring_from_py
|
|
28
|
+
|
|
29
|
+
_orig['geos_linearring_from_py'] = polygon.geos_linearring_from_py
|
|
30
|
+
polygon.geos_linearring_from_py = _speedups.geos_linearring_from_py
|
|
31
|
+
|
|
32
|
+
def disable():
|
|
33
|
+
if not _orig:
|
|
34
|
+
return
|
|
35
|
+
|
|
36
|
+
coords.CoordinateSequence.ctypes = _orig['CoordinateSequence.ctypes']
|
|
37
|
+
linestring.geos_linestring_from_py = _orig['geos_linestring_from_py']
|
|
38
|
+
polygon.geos_linearring_from_py = _orig['geos_linearring_from_py']
|
|
39
|
+
_orig.clear()
|