shapely 1.2.7__py2.5-win32.egg → 1.2.9__py2.5-win32.egg
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.
- EGG-INFO/PKG-INFO +197 -4
- shapely/coords.py +1 -2
- shapely/coords.pyc +0 -0
- shapely/ctypes_declarations.py +3 -0
- shapely/ctypes_declarations.pyc +0 -0
- shapely/ftools.py +78 -0
- shapely/ftools.pyc +0 -0
- shapely/geometry/__init__.py +2 -2
- shapely/geometry/__init__.pyc +0 -0
- shapely/geometry/base.py +1 -1
- shapely/geometry/base.pyc +0 -0
- shapely/geometry/geo.py +8 -1
- shapely/geometry/geo.pyc +0 -0
- shapely/geometry/linestring.py +31 -2
- shapely/geometry/linestring.pyc +0 -0
- shapely/geometry/proxy.py +0 -1
- shapely/geometry/proxy.pyc +0 -0
- shapely/geos.py +6 -4
- shapely/geos.pyc +0 -0
- shapely/impl.py +3 -2
- shapely/impl.pyc +0 -0
- shapely/iterops.py +1 -1
- shapely/iterops.pyc +0 -0
- shapely/predicates.py +0 -1
- shapely/predicates.pyc +0 -0
- shapely/wkb.py +1 -2
- shapely/wkb.pyc +0 -0
- EGG-INFO/scripts/dissolve.py +0 -53
- EGG-INFO/scripts/intersect.py +0 -81
EGG-INFO/PKG-INFO
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
Metadata-Version: 1.0
|
|
2
2
|
Name: Shapely
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.9
|
|
4
4
|
Summary: Geometric objects, predicates, and operations
|
|
5
5
|
Home-page: http://trac.gispython.org/lab/wiki/Shapely
|
|
6
6
|
Author: Sean Gillies
|
|
7
7
|
Author-email: sean.gillies@gmail.com
|
|
8
8
|
License: BSD
|
|
9
|
-
Description:
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
Description: ======
|
|
10
|
+
README
|
|
11
|
+
======
|
|
12
12
|
|
|
13
13
|
.. image:: http://farm3.static.flickr.com/2738/4511827859_b5822043b7_o_d.png
|
|
14
14
|
:width: 800
|
|
@@ -162,6 +162,199 @@ Description: =======
|
|
|
162
162
|
:trim:
|
|
163
163
|
.. _Pleiades: http://pleiades.stoa.org
|
|
164
164
|
|
|
165
|
+
=======
|
|
166
|
+
CHANGES
|
|
167
|
+
=======
|
|
168
|
+
|
|
169
|
+
1.2.9 (2011-03-31)
|
|
170
|
+
------------------
|
|
171
|
+
- Remove extra glob import.
|
|
172
|
+
- Move examples to shapely.examples.
|
|
173
|
+
- Add box() constructor for rectangular polygons.
|
|
174
|
+
- Fix extraneous imports.
|
|
175
|
+
|
|
176
|
+
1.2.8 (2011-12-03)
|
|
177
|
+
------------------
|
|
178
|
+
- New parallel_offset method (#6).
|
|
179
|
+
- Support for Python 2.4.
|
|
180
|
+
|
|
181
|
+
1.2.7 (2010-11-05)
|
|
182
|
+
------------------
|
|
183
|
+
- Support for Windows eggs.
|
|
184
|
+
|
|
185
|
+
1.2.6 (2010-10-21)
|
|
186
|
+
------------------
|
|
187
|
+
- The geoms property of an empty collection yields [] instead of a ValueError
|
|
188
|
+
(#3).
|
|
189
|
+
- The coords and geometry type sproperties have the same behavior as above.
|
|
190
|
+
- Ensure that z values carry through into products of operations (#4).
|
|
191
|
+
|
|
192
|
+
1.2.5 (2010-09-19)
|
|
193
|
+
------------------
|
|
194
|
+
- Stop distributing docs/_build.
|
|
195
|
+
- Include library fallbacks in test_dlls.py for linux platform.
|
|
196
|
+
|
|
197
|
+
1.2.4 (2010-09-09)
|
|
198
|
+
------------------
|
|
199
|
+
- Raise AttributeError when there's no backend support for a method.
|
|
200
|
+
- Raise OSError if libgeos_c.so (or variants) can't be found and loaded.
|
|
201
|
+
- Add geos_c DLL loading support for linux platforms where find_library doesn't
|
|
202
|
+
work.
|
|
203
|
+
|
|
204
|
+
1.2.3 (2010-08-17)
|
|
205
|
+
------------------
|
|
206
|
+
- Add mapping function.
|
|
207
|
+
- Fix problem with GEOSisValidReason symbol for GEOS < 3.1.
|
|
208
|
+
|
|
209
|
+
1.2.2 (2010-07-23)
|
|
210
|
+
------------------
|
|
211
|
+
- Add representative_point method.
|
|
212
|
+
|
|
213
|
+
1.2.1 (2010-06-23)
|
|
214
|
+
------------------
|
|
215
|
+
- Fixed bounds of singular polygons.
|
|
216
|
+
- Added shapely.validation.explain_validity function (#226).
|
|
217
|
+
|
|
218
|
+
1.2 (2010-05-27)
|
|
219
|
+
----------------
|
|
220
|
+
- Final release.
|
|
221
|
+
|
|
222
|
+
1.2rc2 (2010-05-26)
|
|
223
|
+
-------------------
|
|
224
|
+
- Add examples and tests to MANIFEST.in.
|
|
225
|
+
- Release candidate 2.
|
|
226
|
+
|
|
227
|
+
1.2rc1 (2010-05-25)
|
|
228
|
+
-------------------
|
|
229
|
+
- Release candidate.
|
|
230
|
+
|
|
231
|
+
1.2b7 (2010-04-22)
|
|
232
|
+
------------------
|
|
233
|
+
- Memory leak associated with new empty geometry state fixed.
|
|
234
|
+
|
|
235
|
+
1.2b6 (2010-04-13)
|
|
236
|
+
------------------
|
|
237
|
+
- Broken GeometryCollection fixed.
|
|
238
|
+
|
|
239
|
+
1.2b5 (2010-04-09)
|
|
240
|
+
------------------
|
|
241
|
+
- Objects can be constructed from others of the same type, thereby making
|
|
242
|
+
copies. Collections can be constructed from sequences of objects, also making
|
|
243
|
+
copies.
|
|
244
|
+
- Collections are now iterators over their component objects.
|
|
245
|
+
- New code for manual figures, using the descartes package.
|
|
246
|
+
|
|
247
|
+
1.2b4 (2010-03-19)
|
|
248
|
+
------------------
|
|
249
|
+
- Adds support for the "sunos5" platform.
|
|
250
|
+
|
|
251
|
+
1.2b3 (2010-02-28)
|
|
252
|
+
------------------
|
|
253
|
+
- Only provide simplification implementations for GEOS C API >= 1.5.
|
|
254
|
+
|
|
255
|
+
1.2b2 (2010-02-19)
|
|
256
|
+
------------------
|
|
257
|
+
- Fix cascaded_union bug introduced in 1.2b1 (#212).
|
|
258
|
+
|
|
259
|
+
1.2b1 (2010-02-18)
|
|
260
|
+
------------------
|
|
261
|
+
- Update the README. Remove cruft from setup.py. Add some version 1.2 metadata
|
|
262
|
+
regarding required Python version (>=2.5,<3) and external dependency
|
|
263
|
+
(libgeos_c >= 3.1).
|
|
264
|
+
|
|
265
|
+
1.2a6 (2010-02-09)
|
|
266
|
+
------------------
|
|
267
|
+
- Add accessor for separate arrays of X and Y values (#210).
|
|
268
|
+
|
|
269
|
+
TODO: fill gap here
|
|
270
|
+
|
|
271
|
+
1.2a1 (2010-01-20)
|
|
272
|
+
------------------
|
|
273
|
+
- Proper prototyping of WKB writer, and avoidance of errors on 64-bit systems
|
|
274
|
+
(#191).
|
|
275
|
+
- Prototype libgeos_c functions in a way that lets py2exe apps import shapely
|
|
276
|
+
(#189).
|
|
277
|
+
|
|
278
|
+
=========================
|
|
279
|
+
1.2 Branched (2009-09-19)
|
|
280
|
+
=========================
|
|
281
|
+
|
|
282
|
+
1.0.12 (2009-04-09)
|
|
283
|
+
-------------------
|
|
284
|
+
- Fix for references held by topology and predicate descriptors.
|
|
285
|
+
|
|
286
|
+
1.0.11 (2008-11-20)
|
|
287
|
+
-------------------
|
|
288
|
+
- Work around bug in GEOS 2.2.3, GEOSCoordSeq_getOrdinate not exported properly
|
|
289
|
+
(#178).
|
|
290
|
+
|
|
291
|
+
1.0.10 (2008-11-17)
|
|
292
|
+
-------------------
|
|
293
|
+
- Fixed compatibility with GEOS 2.2.3 that was broken in 1.0.8 release (#176).
|
|
294
|
+
|
|
295
|
+
1.0.9 (2008-11-16)
|
|
296
|
+
------------------
|
|
297
|
+
- Find and load MacPorts libgeos.
|
|
298
|
+
|
|
299
|
+
1.0.8 (2008-11-01)
|
|
300
|
+
------------------
|
|
301
|
+
- Fill out GEOS function result and argument types to prevent faults on a
|
|
302
|
+
64-bit arch.
|
|
303
|
+
|
|
304
|
+
1.0.7 (2008-08-22)
|
|
305
|
+
------------------
|
|
306
|
+
- Polygon rings now have the same dimensions as parent (#168).
|
|
307
|
+
- Eliminated reference cycles in polygons (#169).
|
|
308
|
+
|
|
309
|
+
1.0.6 (2008-07-10)
|
|
310
|
+
------------------
|
|
311
|
+
- Fixed adaptation of multi polygon data.
|
|
312
|
+
- Raise exceptions earlier from binary predicates.
|
|
313
|
+
- Beginning distributing new windows DLLs (#166).
|
|
314
|
+
|
|
315
|
+
1.0.5 (2008-05-20)
|
|
316
|
+
------------------
|
|
317
|
+
- Added access to GEOS polygonizer function.
|
|
318
|
+
- Raise exception when insufficient coordinate tuples are passed to LinearRing
|
|
319
|
+
constructor (#164).
|
|
320
|
+
|
|
321
|
+
1.0.4 (2008-05-01)
|
|
322
|
+
------------------
|
|
323
|
+
- Disentangle Python and topological equality (#163).
|
|
324
|
+
- Add shape(), a factory that copies coordinates from a geo interface provider.
|
|
325
|
+
To be used instead of asShape() unless you really need to store coordinates
|
|
326
|
+
outside shapely for efficient use in other code.
|
|
327
|
+
- Cache GEOS geometries in adapters (#163).
|
|
328
|
+
|
|
329
|
+
1.0.3 (2008-04-09)
|
|
330
|
+
------------------
|
|
331
|
+
- Do not release GIL when calling GEOS functions (#158).
|
|
332
|
+
- Prevent faults when chaining multiple GEOS operators (#159).
|
|
333
|
+
|
|
334
|
+
1.0.2 (2008-02-26)
|
|
335
|
+
------------------
|
|
336
|
+
- Fix loss of dimensionality in polygon rings (#155).
|
|
337
|
+
|
|
338
|
+
1.0.1 (2008-02-08)
|
|
339
|
+
------------------
|
|
340
|
+
- Allow chaining expressions involving coordinate sequences and geometry parts
|
|
341
|
+
(#151).
|
|
342
|
+
- Protect against abnormal use of coordinate accessors (#152).
|
|
343
|
+
- Coordinate sequences now implement the numpy array protocol (#153).
|
|
344
|
+
|
|
345
|
+
1.0 (2008-01-18)
|
|
346
|
+
----------------
|
|
347
|
+
- Final release.
|
|
348
|
+
|
|
349
|
+
1.0 RC2 (2008-01-16)
|
|
350
|
+
--------------------
|
|
351
|
+
- Added temporary solution for #149.
|
|
352
|
+
|
|
353
|
+
1.0 RC1 (2008-01-14)
|
|
354
|
+
--------------------
|
|
355
|
+
- First release candidate
|
|
356
|
+
|
|
357
|
+
|
|
165
358
|
Keywords: geometry topology gis
|
|
166
359
|
Platform: UNKNOWN
|
|
167
360
|
Classifier: Development Status :: 5 - Production/Stable
|
shapely/coords.py
CHANGED
shapely/coords.pyc
CHANGED
|
Binary file
|
shapely/ctypes_declarations.py
CHANGED
|
@@ -259,6 +259,9 @@ def prototype(lgeos, geosVersion):
|
|
|
259
259
|
# Linear referencing features aren't found in versions 1.5,
|
|
260
260
|
# but not in all libs versioned 1.6.0 either!
|
|
261
261
|
if hasattr(lgeos, 'GEOSProject'):
|
|
262
|
+
lgeos.GEOSSingleSidedBuffer.restype = ctypes.c_void_p
|
|
263
|
+
lgeos.GEOSSingleSidedBuffer.argtypes = [ctypes.c_void_p, ctypes.c_double, ctypes.c_int, ctypes.c_int, ctypes.c_double, ctypes.c_int]
|
|
264
|
+
|
|
262
265
|
lgeos.GEOSProject.restype = ctypes.c_double
|
|
263
266
|
lgeos.GEOSProject.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
|
|
264
267
|
|
shapely/ctypes_declarations.pyc
CHANGED
|
Binary file
|
shapely/ftools.py
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# Backport some of functools from Python 2.5 standard library for Shapely
|
|
2
|
+
# on Python 2.4
|
|
3
|
+
#
|
|
4
|
+
# Python module wrapper for _functools C module
|
|
5
|
+
# to allow utilities written in Python to be added
|
|
6
|
+
# to the functools module.
|
|
7
|
+
# Written by Nick Coghlan <ncoghlan at gmail.com>
|
|
8
|
+
# Copyright (C) 2006 Python Software Foundation.
|
|
9
|
+
# See C source code for _functools credits/copyright
|
|
10
|
+
#
|
|
11
|
+
# _functools module written and maintained
|
|
12
|
+
# by Hye-Shik Chang <perky@FreeBSD.org>
|
|
13
|
+
# with adaptations by Raymond Hettinger <python@rcn.com>
|
|
14
|
+
# Copyright (c) 2004, 2005, 2006 Python Software Foundation.
|
|
15
|
+
# All rights reserved.
|
|
16
|
+
|
|
17
|
+
def _partial(func, *args, **keywords):
|
|
18
|
+
def newfunc(*fargs, **fkeywords):
|
|
19
|
+
newkeywords = keywords.copy()
|
|
20
|
+
newkeywords.update(fkeywords)
|
|
21
|
+
return func(
|
|
22
|
+
*(args + fargs), **newkeywords)
|
|
23
|
+
newfunc.func = func
|
|
24
|
+
newfunc.args = args
|
|
25
|
+
newfunc.keywords = keywords
|
|
26
|
+
return newfunc
|
|
27
|
+
|
|
28
|
+
# update_wrapper() and wraps() are tools to help write
|
|
29
|
+
# wrapper functions that can handle naive introspection
|
|
30
|
+
|
|
31
|
+
WRAPPER_ASSIGNMENTS = ('__module__', '__name__', '__doc__')
|
|
32
|
+
WRAPPER_UPDATES = ('__dict__',)
|
|
33
|
+
def _update_wrapper(wrapper,
|
|
34
|
+
wrapped,
|
|
35
|
+
assigned = WRAPPER_ASSIGNMENTS,
|
|
36
|
+
updated = WRAPPER_UPDATES):
|
|
37
|
+
"""Update a wrapper function to look like the wrapped function
|
|
38
|
+
|
|
39
|
+
wrapper is the function to be updated
|
|
40
|
+
wrapped is the original function
|
|
41
|
+
assigned is a tuple naming the attributes assigned directly
|
|
42
|
+
from the wrapped function to the wrapper function (defaults to
|
|
43
|
+
functools.WRAPPER_ASSIGNMENTS)
|
|
44
|
+
updated is a tuple naming the attributes of the wrapper that
|
|
45
|
+
are updated with the corresponding attribute from the wrapped
|
|
46
|
+
function (defaults to functools.WRAPPER_UPDATES)
|
|
47
|
+
"""
|
|
48
|
+
for attr in assigned:
|
|
49
|
+
setattr(wrapper, attr, getattr(wrapped, attr))
|
|
50
|
+
for attr in updated:
|
|
51
|
+
getattr(wrapper, attr).update(getattr(wrapped, attr, {}))
|
|
52
|
+
# Return the wrapper so this can be used as a decorator via partial()
|
|
53
|
+
return wrapper
|
|
54
|
+
|
|
55
|
+
def _wraps(wrapped,
|
|
56
|
+
assigned = WRAPPER_ASSIGNMENTS,
|
|
57
|
+
updated = WRAPPER_UPDATES):
|
|
58
|
+
"""Decorator factory to apply update_wrapper() to a wrapper function
|
|
59
|
+
|
|
60
|
+
Returns a decorator that invokes update_wrapper() with the decorated
|
|
61
|
+
function as the wrapper argument and the arguments to wraps() as the
|
|
62
|
+
remaining arguments. Default arguments are as for update_wrapper().
|
|
63
|
+
This is a convenience function to simplify applying partial() to
|
|
64
|
+
update_wrapper().
|
|
65
|
+
"""
|
|
66
|
+
return _partial(_update_wrapper, wrapped=wrapped,
|
|
67
|
+
assigned=assigned, updated=updated)
|
|
68
|
+
|
|
69
|
+
# Use stdlib's functools if available
|
|
70
|
+
try:
|
|
71
|
+
from functools import partial, update_wrapper, wraps
|
|
72
|
+
have_functools = 1
|
|
73
|
+
except ImportError:
|
|
74
|
+
partial = _partial
|
|
75
|
+
update_wrapper = _update_wrapper
|
|
76
|
+
wraps = _wraps
|
|
77
|
+
have_functools = 0
|
|
78
|
+
|
shapely/ftools.pyc
ADDED
|
Binary file
|
shapely/geometry/__init__.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"""Geometry classes and factories
|
|
2
2
|
"""
|
|
3
3
|
|
|
4
|
-
from geo import shape, asShape, mapping
|
|
4
|
+
from geo import box, shape, asShape, mapping
|
|
5
5
|
from point import Point, asPoint
|
|
6
6
|
from linestring import LineString, asLineString
|
|
7
7
|
from polygon import Polygon, asPolygon
|
|
@@ -11,7 +11,7 @@ from multipolygon import MultiPolygon, asMultiPolygon
|
|
|
11
11
|
from collection import GeometryCollection
|
|
12
12
|
|
|
13
13
|
__all__ = [
|
|
14
|
-
'shape', 'asShape', 'Point', 'asPoint', 'LineString', 'asLineString',
|
|
14
|
+
'box', 'shape', 'asShape', 'Point', 'asPoint', 'LineString', 'asLineString',
|
|
15
15
|
'Polygon', 'asPolygon', 'MultiPoint', 'asMultiPoint',
|
|
16
16
|
'MultiLineString', 'asMultiLineString', 'MultiPolygon', 'asMultiPolygon',
|
|
17
17
|
'GeometryCollection', 'mapping'
|
shapely/geometry/__init__.pyc
CHANGED
|
Binary file
|
shapely/geometry/base.py
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"""Base geometry class and utilities
|
|
2
2
|
"""
|
|
3
3
|
|
|
4
|
-
from functools import wraps
|
|
5
4
|
import sys
|
|
6
5
|
import warnings
|
|
7
6
|
|
|
8
7
|
from shapely.coords import CoordinateSequence
|
|
8
|
+
from shapely.ftools import wraps
|
|
9
9
|
from shapely.geos import lgeos
|
|
10
10
|
from shapely.impl import DefaultImplementation, delegated
|
|
11
11
|
from shapely import wkb, wkt
|
shapely/geometry/base.pyc
CHANGED
|
Binary file
|
shapely/geometry/geo.py
CHANGED
|
@@ -7,9 +7,16 @@ from linestring import LineString, asLineString
|
|
|
7
7
|
from polygon import Polygon, asPolygon
|
|
8
8
|
from multipoint import MultiPoint, asMultiPoint
|
|
9
9
|
from multilinestring import MultiLineString, asMultiLineString
|
|
10
|
-
from multipolygon import MultiPolygon, MultiPolygonAdapter
|
|
10
|
+
from multipolygon import MultiPolygon, MultiPolygonAdapter
|
|
11
11
|
|
|
12
12
|
|
|
13
|
+
def box(minx, miny, maxx, maxy, ccw=True):
|
|
14
|
+
"""Return a rectangular polygon with configurable normal vector"""
|
|
15
|
+
coords = [(maxx, miny), (maxx, maxy), (minx, maxy), (minx, miny)]
|
|
16
|
+
if not ccw:
|
|
17
|
+
coords = coords[::-1]
|
|
18
|
+
return Polygon(coords)
|
|
19
|
+
|
|
13
20
|
def shape(context):
|
|
14
21
|
"""Return a new, independent geometry with coordinates *copied* from the
|
|
15
22
|
context.
|
shapely/geometry/geo.pyc
CHANGED
|
Binary file
|
shapely/geometry/linestring.py
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
from ctypes import c_double, cast, POINTER
|
|
5
5
|
from ctypes import ArgumentError
|
|
6
6
|
|
|
7
|
-
from shapely.geos import lgeos
|
|
8
|
-
from shapely.geometry.base import BaseGeometry
|
|
7
|
+
from shapely.geos import lgeos, TopologicalError
|
|
8
|
+
from shapely.geometry.base import BaseGeometry, geom_factory
|
|
9
9
|
from shapely.geometry.proxy import CachingGeometryProxy
|
|
10
10
|
|
|
11
11
|
__all__ = ['LineString', 'asLineString']
|
|
@@ -79,6 +79,35 @@ class LineString(BaseGeometry):
|
|
|
79
79
|
[0.0, 1.0]
|
|
80
80
|
"""
|
|
81
81
|
return self.coords.xy
|
|
82
|
+
|
|
83
|
+
def parallel_offset(
|
|
84
|
+
self, distance, side,
|
|
85
|
+
resolution=16, join_style=1, mitre_limit=1.0):
|
|
86
|
+
|
|
87
|
+
"""Returns a LineString or MultiLineString geometry at a distance from
|
|
88
|
+
the object on its right or its left side.
|
|
89
|
+
|
|
90
|
+
Distance must be a positive float value. The side parameter may be
|
|
91
|
+
'left' or 'right'. The resolution of the buffer around each vertex of
|
|
92
|
+
the object increases by increasing the resolution keyword parameter or
|
|
93
|
+
third positional parameter.
|
|
94
|
+
|
|
95
|
+
The join style is for outside corners between line segments. Accepted
|
|
96
|
+
values are 1 => ROUND, 2 => MITRE, 3 => BEVEL.
|
|
97
|
+
|
|
98
|
+
The mitre ratio limit is used for very sharp corners. It is the ratio
|
|
99
|
+
of the distance from the corner to the end of the mitred offset corner.
|
|
100
|
+
When two line segments meet at a sharp angle, a miter join will extend
|
|
101
|
+
far beyond the original geometry. To prevent unreasonable geometry, the
|
|
102
|
+
mitre limit allows controlling the maximum length of the join corner.
|
|
103
|
+
Corners with a ratio which exceed the limit will be beveled."""
|
|
104
|
+
|
|
105
|
+
try:
|
|
106
|
+
return geom_factory(self.impl['parallel_offset'](
|
|
107
|
+
self, distance, resolution, join_style, mitre_limit,
|
|
108
|
+
bool(side=='left')))
|
|
109
|
+
except WindowsError:
|
|
110
|
+
raise TopologicalError()
|
|
82
111
|
|
|
83
112
|
|
|
84
113
|
class LineStringAdapter(CachingGeometryProxy, LineString):
|
shapely/geometry/linestring.pyc
CHANGED
|
Binary file
|
shapely/geometry/proxy.py
CHANGED
shapely/geometry/proxy.pyc
CHANGED
|
Binary file
|
shapely/geos.py
CHANGED
|
@@ -3,18 +3,19 @@ Proxies for the libgeos_c shared lib, GEOS-specific exceptions, and utilities
|
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
5
|
import atexit
|
|
6
|
-
import functools
|
|
7
6
|
import logging
|
|
8
7
|
import os
|
|
9
8
|
import sys
|
|
10
|
-
import time
|
|
11
9
|
import threading
|
|
12
10
|
import ctypes
|
|
13
|
-
from ctypes import cdll, CDLL,
|
|
11
|
+
from ctypes import cdll, CDLL, CFUNCTYPE, c_char_p, c_void_p, string_at
|
|
14
12
|
from ctypes.util import find_library
|
|
15
13
|
|
|
14
|
+
import ftools
|
|
16
15
|
from ctypes_declarations import prototype
|
|
17
16
|
|
|
17
|
+
|
|
18
|
+
|
|
18
19
|
# Begin by creating a do-nothing handler and adding to this module's logger.
|
|
19
20
|
class NullHandler(logging.Handler):
|
|
20
21
|
def emit(self, record):
|
|
@@ -267,7 +268,7 @@ class LGEOS15(LGEOSBase):
|
|
|
267
268
|
for key in filter(lambda x: not x.endswith('_r'), keys):
|
|
268
269
|
if key + '_r' in keys:
|
|
269
270
|
reentr_func = getattr(self._lgeos, key + '_r')
|
|
270
|
-
attr =
|
|
271
|
+
attr = ftools.partial(reentr_func, self.geos_handle)
|
|
271
272
|
attr.__name__ = reentr_func.__name__
|
|
272
273
|
setattr(self, key, attr)
|
|
273
274
|
else:
|
|
@@ -349,6 +350,7 @@ class LGEOS16LR(LGEOS16):
|
|
|
349
350
|
def __init__(self, dll):
|
|
350
351
|
super(LGEOS16LR, self).__init__(dll)
|
|
351
352
|
|
|
353
|
+
self.methods['parallel_offset'] = self.GEOSSingleSidedBuffer
|
|
352
354
|
self.methods['project'] = self.GEOSProject
|
|
353
355
|
self.methods['project_normalized'] = self.GEOSProjectNormalized
|
|
354
356
|
self.methods['interpolate'] = self.GEOSInterpolate
|
shapely/geos.pyc
CHANGED
|
Binary file
|
shapely/impl.py
CHANGED
|
@@ -11,7 +11,7 @@ This is layer number 2 from the list below.
|
|
|
11
11
|
Shapely 1.2 includes a GEOS backend and it is the default.
|
|
12
12
|
"""
|
|
13
13
|
|
|
14
|
-
from
|
|
14
|
+
from ftools import wraps
|
|
15
15
|
|
|
16
16
|
from shapely.coords import BoundsOp
|
|
17
17
|
from shapely.geos import lgeos
|
|
@@ -98,7 +98,8 @@ IMPL16 = {
|
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
IMPL16LR = {
|
|
101
|
-
|
|
101
|
+
'parallel_offset': (UnaryTopologicalOp, 'parallel_offset'),
|
|
102
|
+
'project_normalized': (ProjectOp, 'project_normalized'),
|
|
102
103
|
'project': (ProjectOp, 'project'),
|
|
103
104
|
'interpolate_normalized': (InterpolateOp, 'interpolate_normalized'),
|
|
104
105
|
'interpolate': (InterpolateOp, 'interpolate'),
|
shapely/impl.pyc
CHANGED
|
Binary file
|
shapely/iterops.py
CHANGED
shapely/iterops.pyc
CHANGED
|
Binary file
|
shapely/predicates.py
CHANGED
shapely/predicates.pyc
CHANGED
|
Binary file
|
shapely/wkb.py
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"""Load/dump geometries using the well-known binary (WKB) format
|
|
2
2
|
"""
|
|
3
3
|
|
|
4
|
-
from ctypes import byref, c_size_t, c_char_p,
|
|
5
|
-
from ctypes import c_void_p, c_size_t
|
|
4
|
+
from ctypes import byref, c_size_t, c_char_p, c_void_p
|
|
6
5
|
|
|
7
6
|
from shapely.geos import lgeos, ReadingError
|
|
8
7
|
|
shapely/wkb.pyc
CHANGED
|
Binary file
|
EGG-INFO/scripts/dissolve.py
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
# dissolve.py
|
|
2
|
-
#
|
|
3
|
-
# Demonstrate how Shapely can be used to build up a collection of patches by
|
|
4
|
-
# dissolving circular regions and how Shapely supports plotting of the results.
|
|
5
|
-
|
|
6
|
-
from functools import partial
|
|
7
|
-
import random
|
|
8
|
-
|
|
9
|
-
import pylab
|
|
10
|
-
|
|
11
|
-
from shapely.geometry import Point
|
|
12
|
-
from shapely.ops import cascaded_union
|
|
13
|
-
|
|
14
|
-
# Use a partial function to make 100 points uniformly distributed in a 40x40
|
|
15
|
-
# box centered on 0,0.
|
|
16
|
-
r = partial(random.uniform, -20.0, 20.0)
|
|
17
|
-
points = [Point(r(), r()) for i in range(100)]
|
|
18
|
-
|
|
19
|
-
# Buffer the points, producing 100 polygon spots
|
|
20
|
-
spots = [p.buffer(2.5) for p in points]
|
|
21
|
-
|
|
22
|
-
# Perform a cascaded union of the polygon spots, dissolving them into a
|
|
23
|
-
# collection of polygon patches
|
|
24
|
-
patches = cascaded_union(spots)
|
|
25
|
-
|
|
26
|
-
if __name__ == "__main__":
|
|
27
|
-
# Illustrate the results using matplotlib's pylab interface
|
|
28
|
-
pylab.figure(num=None, figsize=(4, 4), dpi=180)
|
|
29
|
-
|
|
30
|
-
for patch in patches.geoms:
|
|
31
|
-
assert patch.geom_type in ['Polygon']
|
|
32
|
-
assert patch.is_valid
|
|
33
|
-
|
|
34
|
-
# Fill and outline each patch
|
|
35
|
-
x, y = patch.exterior.xy
|
|
36
|
-
pylab.fill(x, y, color='#cccccc', aa=True)
|
|
37
|
-
pylab.plot(x, y, color='#666666', aa=True, lw=1.0)
|
|
38
|
-
|
|
39
|
-
# Do the same for the holes of the patch
|
|
40
|
-
for hole in patch.interiors:
|
|
41
|
-
x, y = hole.xy
|
|
42
|
-
pylab.fill(x, y, color='#ffffff', aa=True)
|
|
43
|
-
pylab.plot(x, y, color='#999999', aa=True, lw=1.0)
|
|
44
|
-
|
|
45
|
-
# Plot the original points
|
|
46
|
-
pylab.plot([p.x for p in points], [p.y for p in points], 'b,', alpha=0.75)
|
|
47
|
-
|
|
48
|
-
# Write the number of patches and the total patch area to the figure
|
|
49
|
-
pylab.text(-25, 25,
|
|
50
|
-
"Patches: %d, total area: %.2f" % (len(patches.geoms), patches.area))
|
|
51
|
-
|
|
52
|
-
pylab.savefig('dissolve.png')
|
|
53
|
-
|
EGG-INFO/scripts/intersect.py
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
# intersect.py
|
|
2
|
-
#
|
|
3
|
-
# Demonstrate how Shapely can be used to analyze and plot the intersection of
|
|
4
|
-
# a trajectory and regions in space.
|
|
5
|
-
|
|
6
|
-
from functools import partial
|
|
7
|
-
import random
|
|
8
|
-
|
|
9
|
-
import pylab
|
|
10
|
-
|
|
11
|
-
from shapely.geometry import LineString, Point
|
|
12
|
-
from shapely.ops import cascaded_union
|
|
13
|
-
|
|
14
|
-
# Build patches as in dissolved.py
|
|
15
|
-
r = partial(random.uniform, -20.0, 20.0)
|
|
16
|
-
points = [Point(r(), r()) for i in range(100)]
|
|
17
|
-
spots = [p.buffer(2.5) for p in points]
|
|
18
|
-
patches = cascaded_union(spots)
|
|
19
|
-
|
|
20
|
-
# Represent the following geolocation parameters
|
|
21
|
-
#
|
|
22
|
-
# initial position: -25, -25
|
|
23
|
-
# heading: 45.0
|
|
24
|
-
# speed: 50*sqrt(2)
|
|
25
|
-
#
|
|
26
|
-
# as a line
|
|
27
|
-
vector = LineString(((-25.0, -25.0), (25.0, 25.0)))
|
|
28
|
-
|
|
29
|
-
# Find intercepted and missed patches. List the former so we can count them
|
|
30
|
-
# later
|
|
31
|
-
intercepts = [patch for patch in patches.geoms if vector.intersects(patch)]
|
|
32
|
-
misses = (patch for patch in patches.geoms if not vector.intersects(patch))
|
|
33
|
-
|
|
34
|
-
# Plot the intersection
|
|
35
|
-
intersection = vector.intersection(patches)
|
|
36
|
-
assert intersection.geom_type in ['MultiLineString']
|
|
37
|
-
|
|
38
|
-
if __name__ == "__main__":
|
|
39
|
-
# Illustrate the results using matplotlib's pylab interface
|
|
40
|
-
pylab.figure(num=None, figsize=(4, 4), dpi=180)
|
|
41
|
-
|
|
42
|
-
# Plot the misses
|
|
43
|
-
for spot in misses:
|
|
44
|
-
x, y = spot.exterior.xy
|
|
45
|
-
pylab.fill(x, y, color='#cccccc', aa=True)
|
|
46
|
-
pylab.plot(x, y, color='#999999', aa=True, lw=1.0)
|
|
47
|
-
|
|
48
|
-
# Do the same for the holes of the patch
|
|
49
|
-
for hole in spot.interiors:
|
|
50
|
-
x, y = hole.xy
|
|
51
|
-
pylab.fill(x, y, color='#ffffff', aa=True)
|
|
52
|
-
pylab.plot(x, y, color='#999999', aa=True, lw=1.0)
|
|
53
|
-
|
|
54
|
-
# Plot the intercepts
|
|
55
|
-
for spot in intercepts:
|
|
56
|
-
x, y = spot.exterior.xy
|
|
57
|
-
pylab.fill(x, y, color='red', alpha=0.25, aa=True)
|
|
58
|
-
pylab.plot(x, y, color='red', alpha=0.5, aa=True, lw=1.0)
|
|
59
|
-
|
|
60
|
-
# Do the same for the holes of the patch
|
|
61
|
-
for hole in spot.interiors:
|
|
62
|
-
x, y = hole.xy
|
|
63
|
-
pylab.fill(x, y, color='#ffffff', aa=True)
|
|
64
|
-
pylab.plot(x, y, color='red', alpha=0.5, aa=True, lw=1.0)
|
|
65
|
-
|
|
66
|
-
# Draw the projected trajectory
|
|
67
|
-
pylab.arrow(-25, -25, 50, 50, color='#999999', aa=True,
|
|
68
|
-
head_width=1.0, head_length=1.0)
|
|
69
|
-
|
|
70
|
-
for segment in intersection.geoms:
|
|
71
|
-
x, y = segment.xy
|
|
72
|
-
pylab.plot(x, y, color='red', aa=True, lw=1.5)
|
|
73
|
-
|
|
74
|
-
# Write the number of patches and the total patch area to the figure
|
|
75
|
-
pylab.text(-28, 25,
|
|
76
|
-
"Patches: %d/%d (%d), total length: %.1f" \
|
|
77
|
-
% (len(intercepts), len(patches.geoms),
|
|
78
|
-
len(intersection.geoms), intersection.length))
|
|
79
|
-
|
|
80
|
-
pylab.savefig('intersect.png')
|
|
81
|
-
|