shapely 1.5.5__tar.gz → 1.5.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.5.5 → Shapely-1.5.6}/CHANGES.txt +5 -0
- {Shapely-1.5.5/Shapely.egg-info → Shapely-1.5.6}/PKG-INFO +6 -1
- {Shapely-1.5.5 → Shapely-1.5.6/Shapely.egg-info}/PKG-INFO +6 -1
- {Shapely-1.5.5 → Shapely-1.5.6}/Shapely.egg-info/SOURCES.txt +1 -0
- Shapely-1.5.6/VERSION.txt +1 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/setup.py +2 -75
- Shapely-1.5.6/shapely/__init__.py +1 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/shapely/geometry/base.py +54 -31
- {Shapely-1.5.5 → Shapely-1.5.6}/shapely/geometry/linestring.py +18 -15
- {Shapely-1.5.5 → Shapely-1.5.6}/shapely/geometry/multilinestring.py +17 -19
- {Shapely-1.5.5 → Shapely-1.5.6}/shapely/geometry/multipoint.py +17 -21
- {Shapely-1.5.5 → Shapely-1.5.6}/shapely/geometry/multipolygon.py +17 -22
- {Shapely-1.5.5 → Shapely-1.5.6}/shapely/geometry/point.py +18 -18
- {Shapely-1.5.5 → Shapely-1.5.6}/shapely/geometry/polygon.py +22 -14
- {Shapely-1.5.5 → Shapely-1.5.6}/shapely/speedups/_speedups.c +9 -9
- Shapely-1.5.6/tests/test_svg.py +192 -0
- Shapely-1.5.5/VERSION.txt +0 -1
- Shapely-1.5.5/shapely/__init__.py +0 -1
- {Shapely-1.5.5 → Shapely-1.5.6}/CREDITS.txt +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/LICENSE.txt +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/README.rst +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/Shapely.egg-info/dependency_links.txt +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/Shapely.egg-info/top_level.txt +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/docs/design.rst +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/docs/index.rst +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/docs/manual.rst +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/docs/project.rst +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/setup.cfg +1 -1
- {Shapely-1.5.5 → Shapely-1.5.6}/shapely/_geos.pxi +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/shapely/affinity.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/shapely/algorithms/__init__.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/shapely/algorithms/cga.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/shapely/coords.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/shapely/ctypes_declarations.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/shapely/examples/__init__.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/shapely/examples/dissolve.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/shapely/examples/geoms.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/shapely/examples/intersect.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/shapely/ftools.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/shapely/geometry/__init__.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/shapely/geometry/collection.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/shapely/geometry/geo.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/shapely/geometry/proxy.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/shapely/geos.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/shapely/impl.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/shapely/iterops.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/shapely/linref.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/shapely/ops.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/shapely/predicates.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/shapely/prepared.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/shapely/speedups/__init__.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/shapely/speedups/_speedups.pyx +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/shapely/strtree.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/shapely/topology.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/shapely/validation.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/shapely/vectorized/__init__.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/shapely/vectorized/_vectorized.pyx +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/shapely/wkb.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/shapely/wkt.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/tests/__init__.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/tests/binascii_hex.txt +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/tests/conftest.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/tests/test_affinity.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/tests/test_box.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/tests/test_cga.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/tests/test_collection.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/tests/test_coords.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/tests/test_delaunay.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/tests/test_delegated.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/tests/test_dlls.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/tests/test_doctests.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/tests/test_emptiness.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/tests/test_equality.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/tests/test_geointerface.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/tests/test_geomseq.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/tests/test_getitem.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/tests/test_hash.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/tests/test_invalid_geometries.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/tests/test_iterops.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/tests/test_linear_referencing.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/tests/test_linemerge.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/tests/test_linestring.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/tests/test_locale.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/tests/test_mapping.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/tests/test_multilinestring.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/tests/test_multipoint.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/tests/test_multipolygon.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/tests/test_ndarrays.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/tests/test_nearest.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/tests/test_operations.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/tests/test_operators.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/tests/test_persist.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/tests/test_pickle.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/tests/test_point.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/tests/test_polygon.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/tests/test_polygonize.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/tests/test_predicates.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/tests/test_prepared.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/tests/test_products_z.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/tests/test_singularity.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/tests/test_snap.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/tests/test_strtree.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/tests/test_styles.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/tests/test_transform.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/tests/test_union.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/tests/test_validation.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/tests/test_vectorized.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/tests/test_xy.py +0 -0
- {Shapely-1.5.5 → Shapely-1.5.6}/tests/threading_test.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 1.1
|
|
2
2
|
Name: Shapely
|
|
3
|
-
Version: 1.5.
|
|
3
|
+
Version: 1.5.6
|
|
4
4
|
Summary: Geometric objects, predicates, and operations
|
|
5
5
|
Home-page: https://github.com/Toblerity/Shapely
|
|
6
6
|
Author: Sean Gillies
|
|
@@ -215,6 +215,11 @@ Description: =======
|
|
|
215
215
|
Changes
|
|
216
216
|
=======
|
|
217
217
|
|
|
218
|
+
1.5.6 (2015-02-02)
|
|
219
|
+
------------------
|
|
220
|
+
- Fix setup regression (#232, #234).
|
|
221
|
+
- SVG representation improvements (#233, #237).
|
|
222
|
+
|
|
218
223
|
1.5.5 (2015-01-20)
|
|
219
224
|
------------------
|
|
220
225
|
- MANIFEST changes to restore _geox.pxi (#231).
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 1.1
|
|
2
2
|
Name: Shapely
|
|
3
|
-
Version: 1.5.
|
|
3
|
+
Version: 1.5.6
|
|
4
4
|
Summary: Geometric objects, predicates, and operations
|
|
5
5
|
Home-page: https://github.com/Toblerity/Shapely
|
|
6
6
|
Author: Sean Gillies
|
|
@@ -215,6 +215,11 @@ Description: =======
|
|
|
215
215
|
Changes
|
|
216
216
|
=======
|
|
217
217
|
|
|
218
|
+
1.5.6 (2015-02-02)
|
|
219
|
+
------------------
|
|
220
|
+
- Fix setup regression (#232, #234).
|
|
221
|
+
- SVG representation improvements (#233, #237).
|
|
222
|
+
|
|
218
223
|
1.5.5 (2015-01-20)
|
|
219
224
|
------------------
|
|
220
225
|
- MANIFEST changes to restore _geox.pxi (#231).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
1.5.6
|
|
@@ -2,19 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import print_function
|
|
4
4
|
|
|
5
|
-
import ctypes
|
|
6
|
-
import ctypes.util
|
|
7
5
|
try:
|
|
8
6
|
# If possible, use setuptools
|
|
9
7
|
from setuptools import setup
|
|
10
8
|
from setuptools.extension import Extension
|
|
11
9
|
from setuptools.command.build_ext import build_ext as distutils_build_ext
|
|
12
|
-
from setuptools.command.install import install
|
|
13
10
|
except ImportError:
|
|
14
11
|
from distutils.core import setup
|
|
15
12
|
from distutils.extension import Extension
|
|
16
13
|
from distutils.command.build_ext import build_ext as distutils_build_ext
|
|
17
|
-
from distutils.command.install import install
|
|
18
14
|
from distutils.cmd import Command
|
|
19
15
|
from distutils.errors import CCompilerError, DistutilsExecError, \
|
|
20
16
|
DistutilsPlatformError
|
|
@@ -23,7 +19,6 @@ import errno
|
|
|
23
19
|
import glob
|
|
24
20
|
import os
|
|
25
21
|
import platform
|
|
26
|
-
import re
|
|
27
22
|
import shutil
|
|
28
23
|
import subprocess
|
|
29
24
|
import sys
|
|
@@ -58,74 +53,6 @@ with open('CHANGES.txt', 'r', **open_kwds) as fp:
|
|
|
58
53
|
|
|
59
54
|
long_description = readme + '\n\n' + credits + '\n\n' + changes
|
|
60
55
|
|
|
61
|
-
# Fail installation if we can't find a GEOS shared library with the right
|
|
62
|
-
# version. We ship it with Shapely for Windows, so no need to check on that
|
|
63
|
-
# platform. Code below copied from shapely/geos.py.
|
|
64
|
-
class InstallCommand(install):
|
|
65
|
-
|
|
66
|
-
def run(self):
|
|
67
|
-
def load_dll(libname, fallbacks=None):
|
|
68
|
-
lib = ctypes.util.find_library(libname)
|
|
69
|
-
if lib is not None:
|
|
70
|
-
try:
|
|
71
|
-
return ctypes.CDLL(lib)
|
|
72
|
-
except OSError:
|
|
73
|
-
pass
|
|
74
|
-
if fallbacks is not None:
|
|
75
|
-
for name in fallbacks:
|
|
76
|
-
try:
|
|
77
|
-
return ctypes.CDLL(name)
|
|
78
|
-
except OSError:
|
|
79
|
-
# move on to the next fallback
|
|
80
|
-
pass
|
|
81
|
-
# No shared library was loaded. Raise OSError.
|
|
82
|
-
raise OSError(
|
|
83
|
-
"Could not find library %s or load any of its variants %s" % (
|
|
84
|
-
libname, fallbacks or []))
|
|
85
|
-
|
|
86
|
-
if sys.platform.startswith('linux'):
|
|
87
|
-
_lgeos = load_dll(
|
|
88
|
-
'geos_c', fallbacks=['libgeos_c.so.1', 'libgeos_c.so'])
|
|
89
|
-
elif sys.platform == 'darwin':
|
|
90
|
-
if hasattr(sys, 'frozen'):
|
|
91
|
-
# .app file from py2app
|
|
92
|
-
alt_paths = [os.path.join(os.environ['RESOURCEPATH'],
|
|
93
|
-
'..', 'Frameworks', 'libgeos_c.dylib')]
|
|
94
|
-
else:
|
|
95
|
-
alt_paths = [
|
|
96
|
-
# The Framework build from Kyng Chaos:
|
|
97
|
-
"/Library/Frameworks/GEOS.framework/Versions/Current/GEOS",
|
|
98
|
-
# macports
|
|
99
|
-
'/opt/local/lib/libgeos_c.dylib',
|
|
100
|
-
]
|
|
101
|
-
_lgeos = load_dll('geos_c', fallbacks=alt_paths)
|
|
102
|
-
elif sys.platform == 'sunos5':
|
|
103
|
-
_lgeos = load_dll(
|
|
104
|
-
'geos_c', fallbacks=['libgeos_c.so.1', 'libgeos_c.so'])
|
|
105
|
-
else: # other *nix systems
|
|
106
|
-
_lgeos = load_dll(
|
|
107
|
-
'geos_c', fallbacks=['libgeos_c.so.1', 'libgeos_c.so'])
|
|
108
|
-
|
|
109
|
-
GEOSversion = _lgeos.GEOSversion
|
|
110
|
-
GEOSversion.restype = ctypes.c_char_p
|
|
111
|
-
GEOSversion.argtypes = []
|
|
112
|
-
geos_version_string = GEOSversion()
|
|
113
|
-
if sys.version_info[0] >= 3:
|
|
114
|
-
geos_version_string = geos_version_string.decode('ascii')
|
|
115
|
-
res = re.findall(r'(\d+)\.(\d+)\.(\d+)', geos_version_string)
|
|
116
|
-
assert len(res) == 2, res
|
|
117
|
-
geos_version = tuple(int(x) for x in res[0])
|
|
118
|
-
shapely_version = tuple(int(x) for x in version.split('.'))
|
|
119
|
-
|
|
120
|
-
if shapely_version >= (1, 3):
|
|
121
|
-
if geos_version >= (3, 3):
|
|
122
|
-
install.run(self)
|
|
123
|
-
else:
|
|
124
|
-
print(
|
|
125
|
-
"Shapely >= 1.3 requires GEOS >= 3.3. "
|
|
126
|
-
"Install GEOS 3.3+ and reinstall Shapely.")
|
|
127
|
-
sys.exit(1)
|
|
128
|
-
|
|
129
56
|
setup_args = dict(
|
|
130
57
|
name = 'Shapely',
|
|
131
58
|
version = version,
|
|
@@ -147,7 +74,7 @@ setup_args = dict(
|
|
|
147
74
|
'shapely.speedups',
|
|
148
75
|
'shapely.vectorized',
|
|
149
76
|
],
|
|
150
|
-
cmdclass = {
|
|
77
|
+
cmdclass = {},
|
|
151
78
|
classifiers = [
|
|
152
79
|
'Development Status :: 5 - Production/Stable',
|
|
153
80
|
'Intended Audience :: Developers',
|
|
@@ -162,7 +89,7 @@ setup_args = dict(
|
|
|
162
89
|
data_files = [('shapely', ['shapely/_geos.pxi'])]
|
|
163
90
|
)
|
|
164
91
|
|
|
165
|
-
# Add DLLs
|
|
92
|
+
# Add DLLs for Windows
|
|
166
93
|
if sys.platform == 'win32':
|
|
167
94
|
try:
|
|
168
95
|
os.mkdir('shapely/DLLs')
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "1.5.6"
|
|
@@ -353,35 +353,47 @@ class BaseGeometry(object):
|
|
|
353
353
|
"""WKB hex representation of the geometry"""
|
|
354
354
|
return WKBWriter(lgeos).write_hex(self)
|
|
355
355
|
|
|
356
|
-
def svg(self, scale_factor=1
|
|
357
|
-
"""
|
|
358
|
-
SVG representation of the geometry. Scale factor is multiplied by
|
|
359
|
-
the size of the SVG symbol so it can be scaled consistently for a
|
|
360
|
-
consistent appearance based on the canvas size.
|
|
361
|
-
"""
|
|
356
|
+
def svg(self, scale_factor=1., **kwargs):
|
|
357
|
+
"""Raises NotImplementedError"""
|
|
362
358
|
raise NotImplementedError
|
|
363
359
|
|
|
364
360
|
def _repr_svg_(self):
|
|
365
361
|
"""SVG representation for iPython notebook"""
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
362
|
+
svg_top = '<svg xmlns="http://www.w3.org/2000/svg" ' \
|
|
363
|
+
'xmlns:xlink="http://www.w3.org/1999/xlink" '
|
|
364
|
+
if self.is_empty:
|
|
365
|
+
return svg_top + '/>'
|
|
366
|
+
else:
|
|
367
|
+
# Establish SVG canvas that will fit all the data + small space
|
|
368
|
+
xmin, ymin, xmax, ymax = self.bounds
|
|
369
|
+
if xmin == xmax and ymin == ymax:
|
|
370
|
+
# This is a point; buffer using an arbitrary size
|
|
371
|
+
xmin, ymin, xmax, ymax = self.buffer(1).bounds
|
|
372
|
+
else:
|
|
373
|
+
# Expand bounds by a fraction of the data ranges
|
|
374
|
+
expand = 0.04 # or 4%, same as R plots
|
|
375
|
+
widest_part = max([xmax - xmin, ymax - ymin])
|
|
376
|
+
expand_amount = widest_part * expand
|
|
377
|
+
xmin -= expand_amount
|
|
378
|
+
ymin -= expand_amount
|
|
379
|
+
xmax += expand_amount
|
|
380
|
+
ymax += expand_amount
|
|
381
|
+
dx = xmax - xmin
|
|
382
|
+
dy = ymax - ymin
|
|
383
|
+
width = min([max([100., dx]), 300])
|
|
384
|
+
height = min([max([100., dy]), 300])
|
|
385
|
+
try:
|
|
386
|
+
scale_factor = max([dx, dy]) / max([width, height])
|
|
387
|
+
except ZeroDivisionError:
|
|
388
|
+
scale_factor = 1.
|
|
389
|
+
view_box = "{0} {1} {2} {3}".format(xmin, ymin, dx, dy)
|
|
390
|
+
transform = "matrix(1,0,0,-1,0,{0})".format(ymax + ymin)
|
|
391
|
+
return svg_top + (
|
|
392
|
+
'width="{1}" height="{2}" viewBox="{0}" '
|
|
393
|
+
'preserveAspectRatio="xMinYMin meet">'
|
|
394
|
+
'<g transform="{3}">{4}</g></svg>'
|
|
395
|
+
).format(view_box, width, height, transform,
|
|
396
|
+
self.svg(scale_factor))
|
|
385
397
|
|
|
386
398
|
@property
|
|
387
399
|
def geom_type(self):
|
|
@@ -744,13 +756,24 @@ class BaseMultipartGeometry(BaseGeometry):
|
|
|
744
756
|
|
|
745
757
|
__hash__ = object.__hash__
|
|
746
758
|
|
|
747
|
-
def svg(self, scale_factor=1
|
|
748
|
-
"""
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
759
|
+
def svg(self, scale_factor=1., color=None):
|
|
760
|
+
"""Returns a group of SVG elements for the multipart geometry.
|
|
761
|
+
|
|
762
|
+
Parameters
|
|
763
|
+
==========
|
|
764
|
+
scale_factor : float
|
|
765
|
+
Multiplication factor for the SVG stroke-width. Default is 1.
|
|
766
|
+
color : str, optional
|
|
767
|
+
Hex string for stroke or fill color. Default is to use "#66cc99"
|
|
768
|
+
if geometry is valid, and "#ff3333" if invalid.
|
|
752
769
|
"""
|
|
753
|
-
|
|
770
|
+
if self.is_empty:
|
|
771
|
+
return '<g />'
|
|
772
|
+
if color is None:
|
|
773
|
+
color = "#66cc99" if self.is_valid else "#ff3333"
|
|
774
|
+
return '<g>' + \
|
|
775
|
+
''.join(p.svg(scale_factor, color) for p in self) + \
|
|
776
|
+
'</g>'
|
|
754
777
|
|
|
755
778
|
|
|
756
779
|
class GeometrySequence(object):
|
|
@@ -55,23 +55,26 @@ class LineString(BaseGeometry):
|
|
|
55
55
|
'coordinates': tuple(self.coords)
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
def svg(self, scale_factor=1
|
|
59
|
-
"""
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
58
|
+
def svg(self, scale_factor=1., stroke_color=None):
|
|
59
|
+
"""Returns SVG polyline element for the LineString geometry.
|
|
60
|
+
|
|
61
|
+
Parameters
|
|
62
|
+
==========
|
|
63
|
+
scale_factor : float
|
|
64
|
+
Multiplication factor for the SVG stroke-width. Default is 1.
|
|
65
|
+
stroke_color : str, optional
|
|
66
|
+
Hex string for stroke color. Default is to use "#66cc99" if
|
|
67
|
+
geometry is valid, and "#ff3333" if invalid.
|
|
63
68
|
"""
|
|
69
|
+
if self.is_empty:
|
|
70
|
+
return '<g />'
|
|
71
|
+
if stroke_color is None:
|
|
72
|
+
stroke_color = "#66cc99" if self.is_valid else "#ff3333"
|
|
64
73
|
pnt_format = " ".join(["{0},{1}".format(*c) for c in self.coords])
|
|
65
|
-
return
|
|
66
|
-
fill="none"
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
points="{0}"
|
|
70
|
-
opacity=".8"
|
|
71
|
-
/>""".format(
|
|
72
|
-
pnt_format,
|
|
73
|
-
2.*scale_factor,
|
|
74
|
-
"#66cc99" if self.is_valid else "#ff3333")
|
|
74
|
+
return (
|
|
75
|
+
'<polyline fill="none" stroke="{2}" stroke-width="{1}" '
|
|
76
|
+
'points="{0}" opacity="0.8" />'
|
|
77
|
+
).format(pnt_format, 2. * scale_factor, stroke_color)
|
|
75
78
|
|
|
76
79
|
@property
|
|
77
80
|
def ctypes(self):
|
|
@@ -61,26 +61,24 @@ class MultiLineString(BaseMultipartGeometry):
|
|
|
61
61
|
'coordinates': tuple(tuple(c for c in g.coords) for g in self.geoms)
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
def svg(self, scale_factor=1
|
|
65
|
-
"""
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
64
|
+
def svg(self, scale_factor=1., stroke_color=None):
|
|
65
|
+
"""Returns a group of SVG polyline elements for the LineString geometry.
|
|
66
|
+
|
|
67
|
+
Parameters
|
|
68
|
+
==========
|
|
69
|
+
scale_factor : float
|
|
70
|
+
Multiplication factor for the SVG stroke-width. Default is 1.
|
|
71
|
+
stroke_color : str, optional
|
|
72
|
+
Hex string for stroke color. Default is to use "#66cc99" if
|
|
73
|
+
geometry is valid, and "#ff3333" if invalid.
|
|
69
74
|
"""
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
points="{0}"
|
|
78
|
-
opacity=".8"
|
|
79
|
-
/>""".format(
|
|
80
|
-
pnt_format,
|
|
81
|
-
2.*scale_factor,
|
|
82
|
-
"#66cc99" if self.is_valid else "#ff3333"))
|
|
83
|
-
return "\n".join(parts)
|
|
75
|
+
if self.is_empty:
|
|
76
|
+
return '<g />'
|
|
77
|
+
if stroke_color is None:
|
|
78
|
+
stroke_color = "#66cc99" if self.is_valid else "#ff3333"
|
|
79
|
+
return '<g>' + \
|
|
80
|
+
''.join(p.svg(scale_factor, stroke_color) for p in self) + \
|
|
81
|
+
'</g>'
|
|
84
82
|
|
|
85
83
|
|
|
86
84
|
class MultiLineStringAdapter(CachingGeometryProxy, MultiLineString):
|
|
@@ -69,28 +69,24 @@ class MultiPoint(BaseMultipartGeometry):
|
|
|
69
69
|
'coordinates': tuple([g.coords[0] for g in self.geoms])
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
def svg(self, scale_factor=1
|
|
73
|
-
"""
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
72
|
+
def svg(self, scale_factor=1., fill_color=None):
|
|
73
|
+
"""Returns a group of SVG circle elements for the MultiPoint geometry.
|
|
74
|
+
|
|
75
|
+
Parameters
|
|
76
|
+
==========
|
|
77
|
+
scale_factor : float
|
|
78
|
+
Multiplication factor for the SVG circle diameters. Default is 1.
|
|
79
|
+
fill_color : str, optional
|
|
80
|
+
Hex string for fill color. Default is to use "#66cc99" if
|
|
81
|
+
geometry is valid, and "#ff3333" if invalid.
|
|
77
82
|
"""
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
stroke="#555555"
|
|
86
|
-
stroke-width="{2}"
|
|
87
|
-
fill="{3}"
|
|
88
|
-
opacity=".6"
|
|
89
|
-
/>""".format(
|
|
90
|
-
part,
|
|
91
|
-
3*scale_factor,
|
|
92
|
-
1*scale_factor, "#66cc99" if self.is_valid else "#ff3333"))
|
|
93
|
-
return "\n".join(parts)
|
|
83
|
+
if self.is_empty:
|
|
84
|
+
return '<g />'
|
|
85
|
+
if fill_color is None:
|
|
86
|
+
fill_color = "#66cc99" if self.is_valid else "#ff3333"
|
|
87
|
+
return '<g>' + \
|
|
88
|
+
''.join(p.svg(scale_factor, fill_color) for p in self) + \
|
|
89
|
+
'</g>'
|
|
94
90
|
|
|
95
91
|
@property
|
|
96
92
|
@exceptNull
|
|
@@ -80,29 +80,24 @@ class MultiPolygon(BaseMultipartGeometry):
|
|
|
80
80
|
'coordinates': allcoords
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
def svg(self, scale_factor=1
|
|
84
|
-
"""
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
83
|
+
def svg(self, scale_factor=1., fill_color=None):
|
|
84
|
+
"""Returns group of SVG path elements for the MultiPolygon geometry.
|
|
85
|
+
|
|
86
|
+
Parameters
|
|
87
|
+
==========
|
|
88
|
+
scale_factor : float
|
|
89
|
+
Multiplication factor for the SVG stroke-width. Default is 1.
|
|
90
|
+
fill_color : str, optional
|
|
91
|
+
Hex string for fill color. Default is to use "#66cc99" if
|
|
92
|
+
geometry is valid, and "#ff3333" if invalid.
|
|
88
93
|
"""
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
"M {0} L {1} z".format(coords[0], " L ".join(coords[1:]))
|
|
97
|
-
for coords in exterior_coords + interior_coords ])
|
|
98
|
-
parts.append(
|
|
99
|
-
"""<g fill-rule="evenodd" fill="{2}" stroke="#555555"
|
|
100
|
-
stroke-width="{0}" opacity="0.6">
|
|
101
|
-
<path d="{1}" /></g>""".format(
|
|
102
|
-
2. * scale_factor,
|
|
103
|
-
path,
|
|
104
|
-
"#66cc99" if self.is_valid else "#ff3333"))
|
|
105
|
-
return "\n".join(parts)
|
|
94
|
+
if self.is_empty:
|
|
95
|
+
return '<g />'
|
|
96
|
+
if fill_color is None:
|
|
97
|
+
fill_color = "#66cc99" if self.is_valid else "#ff3333"
|
|
98
|
+
return '<g>' + \
|
|
99
|
+
''.join(p.svg(scale_factor, fill_color) for p in self) + \
|
|
100
|
+
'</g>'
|
|
106
101
|
|
|
107
102
|
|
|
108
103
|
class MultiPolygonAdapter(CachingGeometryProxy, MultiPolygon):
|
|
@@ -74,25 +74,25 @@ class Point(BaseGeometry):
|
|
|
74
74
|
'coordinates': self.coords[0]
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
def svg(self, scale_factor=1
|
|
78
|
-
"""
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
77
|
+
def svg(self, scale_factor=1., fill_color=None):
|
|
78
|
+
"""Returns SVG circle element for the Point geometry.
|
|
79
|
+
|
|
80
|
+
Parameters
|
|
81
|
+
==========
|
|
82
|
+
scale_factor : float
|
|
83
|
+
Multiplication factor for the SVG circle diameter. Default is 1.
|
|
84
|
+
fill_color : str, optional
|
|
85
|
+
Hex string for fill color. Default is to use "#66cc99" if
|
|
86
|
+
geometry is valid, and "#ff3333" if invalid.
|
|
82
87
|
"""
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
fill="{3}"
|
|
90
|
-
|
|
91
|
-
/>""".format(
|
|
92
|
-
self,
|
|
93
|
-
3 * scale_factor,
|
|
94
|
-
1 * scale_factor,
|
|
95
|
-
"#66cc99" if self.is_valid else "#ff3333")
|
|
88
|
+
if self.is_empty:
|
|
89
|
+
return '<g />'
|
|
90
|
+
if fill_color is None:
|
|
91
|
+
fill_color = "#66cc99" if self.is_valid else "#ff3333"
|
|
92
|
+
return (
|
|
93
|
+
'<circle cx="{0.x}" cy="{0.y}" r="{1}" '
|
|
94
|
+
'stroke="#555555" stroke-width="{2}" fill="{3}" opacity="0.6" />'
|
|
95
|
+
).format(self, 3. * scale_factor, 1. * scale_factor, fill_color)
|
|
96
96
|
|
|
97
97
|
@property
|
|
98
98
|
def ctypes(self):
|
|
@@ -300,25 +300,33 @@ class Polygon(BaseGeometry):
|
|
|
300
300
|
'coordinates': tuple(coords)
|
|
301
301
|
}
|
|
302
302
|
|
|
303
|
-
def svg(self, scale_factor=1
|
|
304
|
-
"""
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
303
|
+
def svg(self, scale_factor=1., fill_color=None):
|
|
304
|
+
"""Returns SVG path element for the Polygon geometry.
|
|
305
|
+
|
|
306
|
+
Parameters
|
|
307
|
+
==========
|
|
308
|
+
scale_factor : float
|
|
309
|
+
Multiplication factor for the SVG stroke-width. Default is 1.
|
|
310
|
+
fill_color : str, optional
|
|
311
|
+
Hex string for fill color. Default is to use "#66cc99" if
|
|
312
|
+
geometry is valid, and "#ff3333" if invalid.
|
|
308
313
|
"""
|
|
309
|
-
|
|
314
|
+
if self.is_empty:
|
|
315
|
+
return '<g />'
|
|
316
|
+
if fill_color is None:
|
|
317
|
+
fill_color = "#66cc99" if self.is_valid else "#ff3333"
|
|
318
|
+
exterior_coords = [
|
|
319
|
+
["{0},{1}".format(*c) for c in self.exterior.coords]]
|
|
310
320
|
interior_coords = [
|
|
311
321
|
["{0},{1}".format(*c) for c in interior.coords]
|
|
312
|
-
for interior in self.interiors
|
|
322
|
+
for interior in self.interiors]
|
|
313
323
|
path = " ".join([
|
|
314
324
|
"M {0} L {1} z".format(coords[0], " L ".join(coords[1:]))
|
|
315
|
-
for coords in exterior_coords + interior_coords
|
|
316
|
-
return
|
|
317
|
-
<
|
|
318
|
-
stroke-width="{0}" opacity="0.6"
|
|
319
|
-
|
|
320
|
-
</g>""".format(
|
|
321
|
-
2.*scale_factor, path, "#66cc99" if self.is_valid else "#ff3333")
|
|
325
|
+
for coords in exterior_coords + interior_coords])
|
|
326
|
+
return (
|
|
327
|
+
'<path fill-rule="evenodd" fill="{2}" stroke="#555555" '
|
|
328
|
+
'stroke-width="{0}" opacity="0.6" d="{1}" />'
|
|
329
|
+
).format(2. * scale_factor, path, fill_color)
|
|
322
330
|
|
|
323
331
|
|
|
324
332
|
class PolygonAdapter(PolygonProxy, Polygon):
|
|
@@ -870,7 +870,7 @@ static char __pyx_k_geos_linestring_from_py[] = "geos_linestring_from_py";
|
|
|
870
870
|
static char __pyx_k_shapely_speedups__speedups[] = "shapely.speedups._speedups";
|
|
871
871
|
static char __pyx_k_geos_linestring_from_py_locals[] = "geos_linestring_from_py.<locals>._coords";
|
|
872
872
|
static char __pyx_k_A_LinearRing_must_have_at_least[] = "A LinearRing must have at least 3 coordinate tuples";
|
|
873
|
-
static char
|
|
873
|
+
static char __pyx_k_Users_seang_code_frs_wheel_buil[] = "/Users/seang/code/frs-wheel-builds/src/Shapely/shapely/speedups/_speedups.pyx";
|
|
874
874
|
static char __pyx_k_matrix_expects_either_6_or_12_c[] = "'matrix' expects either 6 or 12 coefficients";
|
|
875
875
|
static char __pyx_k_Inconsistent_coordinate_dimensio[] = "Inconsistent coordinate dimensionality";
|
|
876
876
|
static char __pyx_k_Input_s_is_the_wrong_shape_for_a[] = "Input %s is the wrong shape for a LineString";
|
|
@@ -892,7 +892,7 @@ static PyObject *__pyx_n_s_Point;
|
|
|
892
892
|
static PyObject *__pyx_n_s_Polygon;
|
|
893
893
|
static PyObject *__pyx_n_s_TypeError;
|
|
894
894
|
static PyObject *__pyx_kp_s_Type_r_not_recognized;
|
|
895
|
-
static PyObject *
|
|
895
|
+
static PyObject *__pyx_kp_s_Users_seang_code_frs_wheel_buil;
|
|
896
896
|
static PyObject *__pyx_n_s_ValueError;
|
|
897
897
|
static PyObject *__pyx_kp_s_Wrong_coordinate_dimensions_this;
|
|
898
898
|
static PyObject *__pyx_n_s_addressof;
|
|
@@ -6854,7 +6854,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
|
|
|
6854
6854
|
{&__pyx_n_s_Polygon, __pyx_k_Polygon, sizeof(__pyx_k_Polygon), 0, 0, 1, 1},
|
|
6855
6855
|
{&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
|
|
6856
6856
|
{&__pyx_kp_s_Type_r_not_recognized, __pyx_k_Type_r_not_recognized, sizeof(__pyx_k_Type_r_not_recognized), 0, 0, 1, 0},
|
|
6857
|
-
{&
|
|
6857
|
+
{&__pyx_kp_s_Users_seang_code_frs_wheel_buil, __pyx_k_Users_seang_code_frs_wheel_buil, sizeof(__pyx_k_Users_seang_code_frs_wheel_buil), 0, 0, 1, 0},
|
|
6858
6858
|
{&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
|
|
6859
6859
|
{&__pyx_kp_s_Wrong_coordinate_dimensions_this, __pyx_k_Wrong_coordinate_dimensions_this, sizeof(__pyx_k_Wrong_coordinate_dimensions_this), 0, 0, 1, 0},
|
|
6860
6860
|
{&__pyx_n_s_addressof, __pyx_k_addressof, sizeof(__pyx_k_addressof), 0, 0, 1, 1},
|
|
@@ -6994,7 +6994,7 @@ static int __Pyx_InitCachedConstants(void) {
|
|
|
6994
6994
|
__pyx_tuple__4 = PyTuple_Pack(1, __pyx_n_s_o); if (unlikely(!__pyx_tuple__4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
|
6995
6995
|
__Pyx_GOTREF(__pyx_tuple__4);
|
|
6996
6996
|
__Pyx_GIVEREF(__pyx_tuple__4);
|
|
6997
|
-
__pyx_codeobj__5 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__4, __pyx_empty_tuple, __pyx_empty_tuple,
|
|
6997
|
+
__pyx_codeobj__5 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__4, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_seang_code_frs_wheel_buil, __pyx_n_s_coords_2, 129, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
|
6998
6998
|
|
|
6999
6999
|
/* "shapely/speedups/_speedups.pyx":160
|
|
7000
7000
|
* if n == 3:
|
|
@@ -7072,7 +7072,7 @@ static int __Pyx_InitCachedConstants(void) {
|
|
|
7072
7072
|
__pyx_tuple__12 = PyTuple_Pack(1, __pyx_n_s_geom_2); if (unlikely(!__pyx_tuple__12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
|
7073
7073
|
__Pyx_GOTREF(__pyx_tuple__12);
|
|
7074
7074
|
__Pyx_GIVEREF(__pyx_tuple__12);
|
|
7075
|
-
__pyx_codeobj__13 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__12, __pyx_empty_tuple, __pyx_empty_tuple,
|
|
7075
|
+
__pyx_codeobj__13 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__12, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_seang_code_frs_wheel_buil, __pyx_n_s_destroy, 30, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
|
7076
7076
|
|
|
7077
7077
|
/* "shapely/speedups/_speedups.pyx":34
|
|
7078
7078
|
*
|
|
@@ -7084,7 +7084,7 @@ static int __Pyx_InitCachedConstants(void) {
|
|
|
7084
7084
|
__pyx_tuple__14 = PyTuple_Pack(19, __pyx_n_s_ob, __pyx_n_s_update_geom, __pyx_n_s_update_ndim, __pyx_n_s_cp, __pyx_n_s_handle, __pyx_n_s_cs, __pyx_n_s_g, __pyx_n_s_dx, __pyx_n_s_dy, __pyx_n_s_dz, __pyx_n_s_i, __pyx_n_s_n, __pyx_n_s_m, __pyx_n_s_sm, __pyx_n_s_sn, __pyx_n_s_array, __pyx_n_s_coords_2, __pyx_n_s_coords_2, __pyx_n_s_coords); if (unlikely(!__pyx_tuple__14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
|
7085
7085
|
__Pyx_GOTREF(__pyx_tuple__14);
|
|
7086
7086
|
__Pyx_GIVEREF(__pyx_tuple__14);
|
|
7087
|
-
__pyx_codeobj__15 = (PyObject*)__Pyx_PyCode_New(3, 0, 19, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__14, __pyx_empty_tuple, __pyx_empty_tuple,
|
|
7087
|
+
__pyx_codeobj__15 = (PyObject*)__Pyx_PyCode_New(3, 0, 19, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__14, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_seang_code_frs_wheel_buil, __pyx_n_s_geos_linestring_from_py, 34, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
|
7088
7088
|
|
|
7089
7089
|
/* "shapely/speedups/_speedups.pyx":176
|
|
7090
7090
|
*
|
|
@@ -7096,7 +7096,7 @@ static int __Pyx_InitCachedConstants(void) {
|
|
|
7096
7096
|
__pyx_tuple__16 = PyTuple_Pack(18, __pyx_n_s_ob, __pyx_n_s_update_geom, __pyx_n_s_update_ndim, __pyx_n_s_cp, __pyx_n_s_handle, __pyx_n_s_g, __pyx_n_s_cs, __pyx_n_s_dx, __pyx_n_s_dy, __pyx_n_s_dz, __pyx_n_s_i, __pyx_n_s_n, __pyx_n_s_m, __pyx_n_s_M, __pyx_n_s_sm, __pyx_n_s_sn, __pyx_n_s_array, __pyx_n_s_coords); if (unlikely(!__pyx_tuple__16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
|
7097
7097
|
__Pyx_GOTREF(__pyx_tuple__16);
|
|
7098
7098
|
__Pyx_GIVEREF(__pyx_tuple__16);
|
|
7099
|
-
__pyx_codeobj__17 = (PyObject*)__Pyx_PyCode_New(3, 0, 18, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__16, __pyx_empty_tuple, __pyx_empty_tuple,
|
|
7099
|
+
__pyx_codeobj__17 = (PyObject*)__Pyx_PyCode_New(3, 0, 18, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__16, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_seang_code_frs_wheel_buil, __pyx_n_s_geos_linearring_from_py, 176, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
|
7100
7100
|
|
|
7101
7101
|
/* "shapely/speedups/_speedups.pyx":348
|
|
7102
7102
|
*
|
|
@@ -7108,7 +7108,7 @@ static int __Pyx_InitCachedConstants(void) {
|
|
|
7108
7108
|
__pyx_tuple__18 = PyTuple_Pack(10, __pyx_n_s_self, __pyx_n_s_i, __pyx_n_s_n, __pyx_n_s_m, __pyx_n_s_temp, __pyx_n_s_handle, __pyx_n_s_cs, __pyx_n_s_data_p, __pyx_n_s_array_type, __pyx_n_s_data); if (unlikely(!__pyx_tuple__18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
|
7109
7109
|
__Pyx_GOTREF(__pyx_tuple__18);
|
|
7110
7110
|
__Pyx_GIVEREF(__pyx_tuple__18);
|
|
7111
|
-
__pyx_codeobj__19 = (PyObject*)__Pyx_PyCode_New(1, 0, 10, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__18, __pyx_empty_tuple, __pyx_empty_tuple,
|
|
7111
|
+
__pyx_codeobj__19 = (PyObject*)__Pyx_PyCode_New(1, 0, 10, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__18, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_seang_code_frs_wheel_buil, __pyx_n_s_coordseq_ctypes, 348, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
|
7112
7112
|
|
|
7113
7113
|
/* "shapely/speedups/_speedups.pyx":373
|
|
7114
7114
|
* return data
|
|
@@ -7120,7 +7120,7 @@ static int __Pyx_InitCachedConstants(void) {
|
|
|
7120
7120
|
__pyx_tuple__20 = PyTuple_Pack(8, __pyx_n_s_self, __pyx_n_s_i, __pyx_n_s_dx, __pyx_n_s_dy, __pyx_n_s_dz, __pyx_n_s_has_z, __pyx_n_s_handle, __pyx_n_s_cs); if (unlikely(!__pyx_tuple__20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
|
7121
7121
|
__Pyx_GOTREF(__pyx_tuple__20);
|
|
7122
7122
|
__Pyx_GIVEREF(__pyx_tuple__20);
|
|
7123
|
-
__pyx_codeobj__21 = (PyObject*)__Pyx_PyCode_New(1, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__20, __pyx_empty_tuple, __pyx_empty_tuple,
|
|
7123
|
+
__pyx_codeobj__21 = (PyObject*)__Pyx_PyCode_New(1, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__20, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_seang_code_frs_wheel_buil, __pyx_n_s_coordseq_iter, 373, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
|
|
7124
7124
|
__Pyx_RefNannyFinishContext();
|
|
7125
7125
|
return 0;
|
|
7126
7126
|
__pyx_L1_error:;
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
# Tests SVG output and validity
|
|
2
|
+
import os
|
|
3
|
+
from xml.dom.minidom import parseString as parse_xml_string
|
|
4
|
+
|
|
5
|
+
from . import unittest
|
|
6
|
+
from shapely.geometry import Point, MultiPoint, LineString, MultiLineString,\
|
|
7
|
+
Polygon, MultiPolygon
|
|
8
|
+
from shapely.geometry.collection import GeometryCollection
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class SvgTestCase(unittest.TestCase):
|
|
12
|
+
|
|
13
|
+
def assertSVG(self, geom, expected, **kwrds):
|
|
14
|
+
"""Helper function to check XML and debug SVG"""
|
|
15
|
+
svg_elem = geom.svg(**kwrds)
|
|
16
|
+
try:
|
|
17
|
+
parse_xml_string(svg_elem)
|
|
18
|
+
except:
|
|
19
|
+
raise AssertionError(
|
|
20
|
+
'XML is not valid for SVG element: ' + str(svg_elem))
|
|
21
|
+
svg_doc = geom._repr_svg_()
|
|
22
|
+
try:
|
|
23
|
+
doc = parse_xml_string(svg_doc)
|
|
24
|
+
except:
|
|
25
|
+
raise AssertionError(
|
|
26
|
+
'XML is not valid for SVG doucment: ' + str(svg_doc))
|
|
27
|
+
svg_output_dir = None
|
|
28
|
+
# svg_output_dir = '.' # useful for debugging SVG files
|
|
29
|
+
if svg_output_dir:
|
|
30
|
+
fname = geom.type
|
|
31
|
+
if geom.is_empty:
|
|
32
|
+
fname += '_empty'
|
|
33
|
+
if not geom.is_valid:
|
|
34
|
+
fname += '_invalid'
|
|
35
|
+
if kwrds:
|
|
36
|
+
fname += '_' + \
|
|
37
|
+
','.join(str(k) + '=' + str(kwrds[k]) for k in kwrds)
|
|
38
|
+
svg_path = os.path.join(svg_output_dir, fname + '.svg')
|
|
39
|
+
with open(svg_path, 'w') as fp:
|
|
40
|
+
fp.write(doc.toprettyxml())
|
|
41
|
+
self.assertEqual(svg_elem, expected)
|
|
42
|
+
|
|
43
|
+
def test_point(self):
|
|
44
|
+
# Empty
|
|
45
|
+
self.assertSVG(Point(), '<g />')
|
|
46
|
+
# Valid
|
|
47
|
+
g = Point(6, 7)
|
|
48
|
+
self.assertSVG(
|
|
49
|
+
g,
|
|
50
|
+
'<circle cx="6.0" cy="7.0" r="3.0" stroke="#555555" '
|
|
51
|
+
'stroke-width="1.0" fill="#66cc99" opacity="0.6" />')
|
|
52
|
+
self.assertSVG(
|
|
53
|
+
g,
|
|
54
|
+
'<circle cx="6.0" cy="7.0" r="15.0" stroke="#555555" '
|
|
55
|
+
'stroke-width="5.0" fill="#66cc99" opacity="0.6" />',
|
|
56
|
+
scale_factor=5)
|
|
57
|
+
|
|
58
|
+
def test_multipoint(self):
|
|
59
|
+
# Empty
|
|
60
|
+
self.assertSVG(MultiPoint(), '<g />')
|
|
61
|
+
# Valid
|
|
62
|
+
g = MultiPoint([(6, 7), (3, 4)])
|
|
63
|
+
self.assertSVG(
|
|
64
|
+
g,
|
|
65
|
+
'<g><circle cx="6.0" cy="7.0" r="3.0" stroke="#555555" '
|
|
66
|
+
'stroke-width="1.0" fill="#66cc99" opacity="0.6" />'
|
|
67
|
+
'<circle cx="3.0" cy="4.0" r="3.0" stroke="#555555" '
|
|
68
|
+
'stroke-width="1.0" fill="#66cc99" opacity="0.6" /></g>')
|
|
69
|
+
self.assertSVG(
|
|
70
|
+
g,
|
|
71
|
+
'<g><circle cx="6.0" cy="7.0" r="15.0" stroke="#555555" '
|
|
72
|
+
'stroke-width="5.0" fill="#66cc99" opacity="0.6" />'
|
|
73
|
+
'<circle cx="3.0" cy="4.0" r="15.0" stroke="#555555" '
|
|
74
|
+
'stroke-width="5.0" fill="#66cc99" opacity="0.6" /></g>',
|
|
75
|
+
scale_factor=5)
|
|
76
|
+
|
|
77
|
+
def test_linestring(self):
|
|
78
|
+
# Empty
|
|
79
|
+
self.assertSVG(LineString(), '<g />')
|
|
80
|
+
# Valid
|
|
81
|
+
g = LineString([(5, 8), (496, -6), (530, 20)])
|
|
82
|
+
self.assertSVG(
|
|
83
|
+
g,
|
|
84
|
+
'<polyline fill="none" stroke="#66cc99" stroke-width="2.0" '
|
|
85
|
+
'points="5.0,8.0 496.0,-6.0 530.0,20.0" opacity="0.8" />')
|
|
86
|
+
self.assertSVG(
|
|
87
|
+
g,
|
|
88
|
+
'<polyline fill="none" stroke="#66cc99" stroke-width="10.0" '
|
|
89
|
+
'points="5.0,8.0 496.0,-6.0 530.0,20.0" opacity="0.8" />',
|
|
90
|
+
scale_factor=5)
|
|
91
|
+
# Invalid
|
|
92
|
+
self.assertSVG(
|
|
93
|
+
LineString([(0, 0), (0, 0)]),
|
|
94
|
+
'<polyline fill="none" stroke="#ff3333" stroke-width="2.0" '
|
|
95
|
+
'points="0.0,0.0 0.0,0.0" opacity="0.8" />')
|
|
96
|
+
|
|
97
|
+
def test_multilinestring(self):
|
|
98
|
+
# Empty
|
|
99
|
+
self.assertSVG(MultiLineString(), '<g />')
|
|
100
|
+
# Valid
|
|
101
|
+
self.assertSVG(
|
|
102
|
+
MultiLineString([[(6, 7), (3, 4)], [(2, 8), (9, 1)]]),
|
|
103
|
+
'<g><polyline fill="none" stroke="#66cc99" stroke-width="2.0" '
|
|
104
|
+
'points="6.0,7.0 3.0,4.0" opacity="0.8" />'
|
|
105
|
+
'<polyline fill="none" stroke="#66cc99" stroke-width="2.0" '
|
|
106
|
+
'points="2.0,8.0 9.0,1.0" opacity="0.8" /></g>')
|
|
107
|
+
# Invalid
|
|
108
|
+
self.assertSVG(
|
|
109
|
+
MultiLineString([[(2, 3), (2, 3)], [(2, 8), (9, 1)]]),
|
|
110
|
+
'<g><polyline fill="none" stroke="#ff3333" stroke-width="2.0" '
|
|
111
|
+
'points="2.0,3.0 2.0,3.0" opacity="0.8" />'
|
|
112
|
+
'<polyline fill="none" stroke="#ff3333" stroke-width="2.0" '
|
|
113
|
+
'points="2.0,8.0 9.0,1.0" opacity="0.8" /></g>')
|
|
114
|
+
|
|
115
|
+
def test_polygon(self):
|
|
116
|
+
# Empty
|
|
117
|
+
self.assertSVG(Polygon(), '<g />')
|
|
118
|
+
# Valid
|
|
119
|
+
g = Polygon([(35, 10), (45, 45), (15, 40), (10, 20), (35, 10)],
|
|
120
|
+
[[(20, 30), (35, 35), (30, 20), (20, 30)]])
|
|
121
|
+
self.assertSVG(
|
|
122
|
+
g,
|
|
123
|
+
'<path fill-rule="evenodd" fill="#66cc99" stroke="#555555" '
|
|
124
|
+
'stroke-width="2.0" opacity="0.6" d="M 35.0,10.0 L 45.0,45.0 L '
|
|
125
|
+
'15.0,40.0 L 10.0,20.0 L 35.0,10.0 z M 20.0,30.0 L 35.0,35.0 L '
|
|
126
|
+
'30.0,20.0 L 20.0,30.0 z" />')
|
|
127
|
+
self.assertSVG(
|
|
128
|
+
g,
|
|
129
|
+
'<path fill-rule="evenodd" fill="#66cc99" stroke="#555555" '
|
|
130
|
+
'stroke-width="10.0" opacity="0.6" d="M 35.0,10.0 L 45.0,45.0 L '
|
|
131
|
+
'15.0,40.0 L 10.0,20.0 L 35.0,10.0 z M 20.0,30.0 L 35.0,35.0 L '
|
|
132
|
+
'30.0,20.0 L 20.0,30.0 z" />',
|
|
133
|
+
scale_factor=5)
|
|
134
|
+
# Invalid
|
|
135
|
+
self.assertSVG(
|
|
136
|
+
Polygon([(0, 40), (0, 0), (40, 40), (40, 0), (0, 40)]),
|
|
137
|
+
'<path fill-rule="evenodd" fill="#ff3333" stroke="#555555" '
|
|
138
|
+
'stroke-width="2.0" opacity="0.6" d="M 0.0,40.0 L 0.0,0.0 L '
|
|
139
|
+
'40.0,40.0 L 40.0,0.0 L 0.0,40.0 z" />')
|
|
140
|
+
|
|
141
|
+
def test_multipolygon(self):
|
|
142
|
+
# Empty
|
|
143
|
+
self.assertSVG(MultiPolygon(), '<g />')
|
|
144
|
+
# Valid
|
|
145
|
+
self.assertSVG(
|
|
146
|
+
MultiPolygon([
|
|
147
|
+
Polygon([(40, 40), (20, 45), (45, 30), (40, 40)]),
|
|
148
|
+
Polygon([(20, 35), (10, 30), (10, 10), (30, 5), (45, 20),
|
|
149
|
+
(20, 35)],
|
|
150
|
+
[[(30, 20), (20, 15), (20, 25), (30, 20)]])
|
|
151
|
+
]),
|
|
152
|
+
'<g><path fill-rule="evenodd" fill="#66cc99" stroke="#555555" '
|
|
153
|
+
'stroke-width="2.0" opacity="0.6" d="M 40.0,40.0 L 20.0,45.0 L '
|
|
154
|
+
'45.0,30.0 L 40.0,40.0 z" />'
|
|
155
|
+
'<path fill-rule="evenodd" fill="#66cc99" stroke="#555555" '
|
|
156
|
+
'stroke-width="2.0" opacity="0.6" d="M 20.0,35.0 L 10.0,30.0 L '
|
|
157
|
+
'10.0,10.0 L 30.0,5.0 L 45.0,20.0 L 20.0,35.0 z M 30.0,20.0 L '
|
|
158
|
+
'20.0,15.0 L 20.0,25.0 L 30.0,20.0 z" /></g>')
|
|
159
|
+
# Invalid
|
|
160
|
+
self.assertSVG(
|
|
161
|
+
MultiPolygon([
|
|
162
|
+
Polygon([(140, 140), (120, 145), (145, 130), (140, 140)]),
|
|
163
|
+
Polygon([(0, 40), (0, 0), (40, 40), (40, 0), (0, 40)])
|
|
164
|
+
]),
|
|
165
|
+
'<g><path fill-rule="evenodd" fill="#ff3333" stroke="#555555" '
|
|
166
|
+
'stroke-width="2.0" opacity="0.6" d="M 140.0,140.0 L '
|
|
167
|
+
'120.0,145.0 L 145.0,130.0 L 140.0,140.0 z" />'
|
|
168
|
+
'<path fill-rule="evenodd" fill="#ff3333" stroke="#555555" '
|
|
169
|
+
'stroke-width="2.0" opacity="0.6" d="M 0.0,40.0 L 0.0,0.0 L '
|
|
170
|
+
'40.0,40.0 L 40.0,0.0 L 0.0,40.0 z" /></g>')
|
|
171
|
+
|
|
172
|
+
def test_collection(self):
|
|
173
|
+
# Empty
|
|
174
|
+
self.assertSVG(GeometryCollection(), '<g />')
|
|
175
|
+
# Valid
|
|
176
|
+
self.assertSVG(
|
|
177
|
+
Point(7, 3).union(LineString([(4, 2), (8, 4)])),
|
|
178
|
+
'<g><circle cx="7.0" cy="3.0" r="3.0" stroke="#555555" '
|
|
179
|
+
'stroke-width="1.0" fill="#66cc99" opacity="0.6" />'
|
|
180
|
+
'<polyline fill="none" stroke="#66cc99" stroke-width="2.0" '
|
|
181
|
+
'points="4.0,2.0 8.0,4.0" opacity="0.8" /></g>')
|
|
182
|
+
# Invalid
|
|
183
|
+
self.assertSVG(
|
|
184
|
+
Point(7, 3).union(LineString([(4, 2), (4, 2)])),
|
|
185
|
+
'<g><circle cx="7.0" cy="3.0" r="3.0" stroke="#555555" '
|
|
186
|
+
'stroke-width="1.0" fill="#ff3333" opacity="0.6" />'
|
|
187
|
+
'<polyline fill="none" stroke="#ff3333" stroke-width="2.0" '
|
|
188
|
+
'points="4.0,2.0 4.0,2.0" opacity="0.8" /></g>')
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
def test_suite():
|
|
192
|
+
return unittest.TestLoader().loadTestsFromTestCase(SvgTestCase)
|
Shapely-1.5.5/VERSION.txt
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
1.5.5
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "1.5.5"
|
|
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
|
|
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
|