shapely 1.2.8__py2.5-win32.egg → 1.2.10__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 CHANGED
@@ -1,14 +1,14 @@
1
1
  Metadata-Version: 1.0
2
2
  Name: Shapely
3
- Version: 1.2.8
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
7
7
  Author-email: sean.gillies@gmail.com
8
8
  License: BSD
9
- Description: =======
10
- Shapely
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,206 @@ Description: =======
162
162
  :trim:
163
163
  .. _Pleiades: http://pleiades.stoa.org
164
164
 
165
+ =======
166
+ CHANGES
167
+ =======
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
+
176
+ 1.2.9 (2011-03-31)
177
+ ------------------
178
+ - Remove extra glob import.
179
+ - Move examples to shapely.examples.
180
+ - Add box() constructor for rectangular polygons.
181
+ - Fix extraneous imports.
182
+
183
+ 1.2.8 (2011-12-03)
184
+ ------------------
185
+ - New parallel_offset method (#6).
186
+ - Support for Python 2.4.
187
+
188
+ 1.2.7 (2010-11-05)
189
+ ------------------
190
+ - Support for Windows eggs.
191
+
192
+ 1.2.6 (2010-10-21)
193
+ ------------------
194
+ - The geoms property of an empty collection yields [] instead of a ValueError
195
+ (#3).
196
+ - The coords and geometry type sproperties have the same behavior as above.
197
+ - Ensure that z values carry through into products of operations (#4).
198
+
199
+ 1.2.5 (2010-09-19)
200
+ ------------------
201
+ - Stop distributing docs/_build.
202
+ - Include library fallbacks in test_dlls.py for linux platform.
203
+
204
+ 1.2.4 (2010-09-09)
205
+ ------------------
206
+ - Raise AttributeError when there's no backend support for a method.
207
+ - Raise OSError if libgeos_c.so (or variants) can't be found and loaded.
208
+ - Add geos_c DLL loading support for linux platforms where find_library doesn't
209
+ work.
210
+
211
+ 1.2.3 (2010-08-17)
212
+ ------------------
213
+ - Add mapping function.
214
+ - Fix problem with GEOSisValidReason symbol for GEOS < 3.1.
215
+
216
+ 1.2.2 (2010-07-23)
217
+ ------------------
218
+ - Add representative_point method.
219
+
220
+ 1.2.1 (2010-06-23)
221
+ ------------------
222
+ - Fixed bounds of singular polygons.
223
+ - Added shapely.validation.explain_validity function (#226).
224
+
225
+ 1.2 (2010-05-27)
226
+ ----------------
227
+ - Final release.
228
+
229
+ 1.2rc2 (2010-05-26)
230
+ -------------------
231
+ - Add examples and tests to MANIFEST.in.
232
+ - Release candidate 2.
233
+
234
+ 1.2rc1 (2010-05-25)
235
+ -------------------
236
+ - Release candidate.
237
+
238
+ 1.2b7 (2010-04-22)
239
+ ------------------
240
+ - Memory leak associated with new empty geometry state fixed.
241
+
242
+ 1.2b6 (2010-04-13)
243
+ ------------------
244
+ - Broken GeometryCollection fixed.
245
+
246
+ 1.2b5 (2010-04-09)
247
+ ------------------
248
+ - Objects can be constructed from others of the same type, thereby making
249
+ copies. Collections can be constructed from sequences of objects, also making
250
+ copies.
251
+ - Collections are now iterators over their component objects.
252
+ - New code for manual figures, using the descartes package.
253
+
254
+ 1.2b4 (2010-03-19)
255
+ ------------------
256
+ - Adds support for the "sunos5" platform.
257
+
258
+ 1.2b3 (2010-02-28)
259
+ ------------------
260
+ - Only provide simplification implementations for GEOS C API >= 1.5.
261
+
262
+ 1.2b2 (2010-02-19)
263
+ ------------------
264
+ - Fix cascaded_union bug introduced in 1.2b1 (#212).
265
+
266
+ 1.2b1 (2010-02-18)
267
+ ------------------
268
+ - Update the README. Remove cruft from setup.py. Add some version 1.2 metadata
269
+ regarding required Python version (>=2.5,<3) and external dependency
270
+ (libgeos_c >= 3.1).
271
+
272
+ 1.2a6 (2010-02-09)
273
+ ------------------
274
+ - Add accessor for separate arrays of X and Y values (#210).
275
+
276
+ TODO: fill gap here
277
+
278
+ 1.2a1 (2010-01-20)
279
+ ------------------
280
+ - Proper prototyping of WKB writer, and avoidance of errors on 64-bit systems
281
+ (#191).
282
+ - Prototype libgeos_c functions in a way that lets py2exe apps import shapely
283
+ (#189).
284
+
285
+ =========================
286
+ 1.2 Branched (2009-09-19)
287
+ =========================
288
+
289
+ 1.0.12 (2009-04-09)
290
+ -------------------
291
+ - Fix for references held by topology and predicate descriptors.
292
+
293
+ 1.0.11 (2008-11-20)
294
+ -------------------
295
+ - Work around bug in GEOS 2.2.3, GEOSCoordSeq_getOrdinate not exported properly
296
+ (#178).
297
+
298
+ 1.0.10 (2008-11-17)
299
+ -------------------
300
+ - Fixed compatibility with GEOS 2.2.3 that was broken in 1.0.8 release (#176).
301
+
302
+ 1.0.9 (2008-11-16)
303
+ ------------------
304
+ - Find and load MacPorts libgeos.
305
+
306
+ 1.0.8 (2008-11-01)
307
+ ------------------
308
+ - Fill out GEOS function result and argument types to prevent faults on a
309
+ 64-bit arch.
310
+
311
+ 1.0.7 (2008-08-22)
312
+ ------------------
313
+ - Polygon rings now have the same dimensions as parent (#168).
314
+ - Eliminated reference cycles in polygons (#169).
315
+
316
+ 1.0.6 (2008-07-10)
317
+ ------------------
318
+ - Fixed adaptation of multi polygon data.
319
+ - Raise exceptions earlier from binary predicates.
320
+ - Beginning distributing new windows DLLs (#166).
321
+
322
+ 1.0.5 (2008-05-20)
323
+ ------------------
324
+ - Added access to GEOS polygonizer function.
325
+ - Raise exception when insufficient coordinate tuples are passed to LinearRing
326
+ constructor (#164).
327
+
328
+ 1.0.4 (2008-05-01)
329
+ ------------------
330
+ - Disentangle Python and topological equality (#163).
331
+ - Add shape(), a factory that copies coordinates from a geo interface provider.
332
+ To be used instead of asShape() unless you really need to store coordinates
333
+ outside shapely for efficient use in other code.
334
+ - Cache GEOS geometries in adapters (#163).
335
+
336
+ 1.0.3 (2008-04-09)
337
+ ------------------
338
+ - Do not release GIL when calling GEOS functions (#158).
339
+ - Prevent faults when chaining multiple GEOS operators (#159).
340
+
341
+ 1.0.2 (2008-02-26)
342
+ ------------------
343
+ - Fix loss of dimensionality in polygon rings (#155).
344
+
345
+ 1.0.1 (2008-02-08)
346
+ ------------------
347
+ - Allow chaining expressions involving coordinate sequences and geometry parts
348
+ (#151).
349
+ - Protect against abnormal use of coordinate accessors (#152).
350
+ - Coordinate sequences now implement the numpy array protocol (#153).
351
+
352
+ 1.0 (2008-01-18)
353
+ ----------------
354
+ - Final release.
355
+
356
+ 1.0 RC2 (2008-01-16)
357
+ --------------------
358
+ - Added temporary solution for #149.
359
+
360
+ 1.0 RC1 (2008-01-14)
361
+ --------------------
362
+ - First release candidate
363
+
364
+
165
365
  Keywords: geometry topology gis
166
366
  Platform: UNKNOWN
167
367
  Classifier: Development Status :: 5 - Production/Stable
File without changes
Binary file
@@ -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
+
Binary file
shapely/coords.py CHANGED
@@ -2,8 +2,7 @@
2
2
  """
3
3
 
4
4
  from array import array
5
- from ctypes import string_at, byref, c_char_p, c_double, c_void_p
6
- from ctypes import c_int, c_size_t, c_uint
5
+ from ctypes import byref, c_double, c_uint
7
6
  import sys
8
7
 
9
8
  from shapely.geos import lgeos
shapely/coords.pyc CHANGED
Binary file
@@ -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'
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, asMultiPolygon
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
@@ -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:
Binary file
shapely/geometry/proxy.py CHANGED
@@ -23,7 +23,6 @@ class CachingGeometryProxy(object):
23
23
 
24
24
  def empty(self):
25
25
  if not self._is_empty:
26
- from shapely.geos import lgeos
27
26
  lgeos.GEOSGeom_destroy(self.__geom__)
28
27
  self.__geom__ = EMPTY
29
28
 
Binary file
shapely/geos.py CHANGED
@@ -6,10 +6,9 @@ import atexit
6
6
  import logging
7
7
  import os
8
8
  import sys
9
- import time
10
9
  import threading
11
10
  import ctypes
12
- from ctypes import cdll, CDLL, PyDLL, CFUNCTYPE, c_char_p, c_void_p, string_at
11
+ from ctypes import cdll, CDLL, CFUNCTYPE, c_char_p, c_void_p, string_at
13
12
  from ctypes.util import find_library
14
13
 
15
14
  import ftools
shapely/geos.pyc CHANGED
Binary file
shapely/impl.py CHANGED
@@ -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 = {
shapely/impl.pyc CHANGED
Binary file
shapely/iterops.py CHANGED
@@ -3,7 +3,7 @@ Iterative forms of operations
3
3
  """
4
4
 
5
5
  from ctypes import c_char_p, c_size_t
6
- from shapely.geos import lgeos, free
6
+ from shapely.geos import lgeos, PredicateError
7
7
 
8
8
 
9
9
  def geos_from_geometry(geom):
shapely/iterops.pyc CHANGED
Binary file
shapely/predicates.py CHANGED
@@ -2,7 +2,6 @@
2
2
  Support for GEOS spatial predicates
3
3
  """
4
4
 
5
- from shapely.geos import PredicateError, lgeos
6
5
  from shapely.topology import Delegating
7
6
 
8
7
  class BinaryPredicate(Delegating):
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, string_at
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
@@ -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
-
@@ -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
-