shapely 1.2.2__tar.gz → 1.2.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {Shapely-1.2.2 → Shapely-1.2.3}/CHANGES.txt +5 -0
- {Shapely-1.2.2 → Shapely-1.2.3}/PKG-INFO +1 -1
- {Shapely-1.2.2 → Shapely-1.2.3}/Shapely.egg-info/PKG-INFO +1 -1
- {Shapely-1.2.2 → Shapely-1.2.3}/Shapely.egg-info/SOURCES.txt +1 -0
- {Shapely-1.2.2 → Shapely-1.2.3}/docs/_build/html/_sources/manual.txt +25 -10
- {Shapely-1.2.2 → Shapely-1.2.3}/docs/manual.txt +25 -5
- {Shapely-1.2.2 → Shapely-1.2.3}/setup.py +1 -1
- {Shapely-1.2.2 → Shapely-1.2.3}/shapely/ctypes_declarations.py +3 -3
- {Shapely-1.2.2 → Shapely-1.2.3}/shapely/geometry/__init__.py +2 -2
- {Shapely-1.2.2 → Shapely-1.2.3}/shapely/geometry/base.py +6 -3
- {Shapely-1.2.2 → Shapely-1.2.3}/shapely/geometry/geo.py +4 -0
- {Shapely-1.2.2 → Shapely-1.2.3}/shapely/tests/__init__.py +2 -0
- Shapely-1.2.3/shapely/tests/test_mapping.py +11 -0
- {Shapely-1.2.2 → Shapely-1.2.3}/shapely/validation.py +1 -1
- {Shapely-1.2.2 → Shapely-1.2.3}/CREDITS.txt +0 -0
- {Shapely-1.2.2 → Shapely-1.2.3}/LICENSE.txt +0 -0
- {Shapely-1.2.2 → Shapely-1.2.3}/MANIFEST.in +0 -0
- {Shapely-1.2.2 → Shapely-1.2.3}/README.txt +0 -0
- {Shapely-1.2.2 → Shapely-1.2.3}/Shapely.egg-info/dependency_links.txt +0 -0
- {Shapely-1.2.2 → Shapely-1.2.3}/Shapely.egg-info/top_level.txt +0 -0
- {Shapely-1.2.2 → Shapely-1.2.3}/examples/dissolve.py +0 -0
- {Shapely-1.2.2 → Shapely-1.2.3}/examples/intersect.py +0 -0
- {Shapely-1.2.2 → Shapely-1.2.3}/setup.cfg +0 -0
- {Shapely-1.2.2 → Shapely-1.2.3}/shapely/__init__.py +0 -0
- {Shapely-1.2.2 → Shapely-1.2.3}/shapely/coords.py +0 -0
- {Shapely-1.2.2 → Shapely-1.2.3}/shapely/geometry/collection.py +0 -0
- {Shapely-1.2.2 → Shapely-1.2.3}/shapely/geometry/linestring.py +0 -0
- {Shapely-1.2.2 → Shapely-1.2.3}/shapely/geometry/multilinestring.py +0 -0
- {Shapely-1.2.2 → Shapely-1.2.3}/shapely/geometry/multipoint.py +0 -0
- {Shapely-1.2.2 → Shapely-1.2.3}/shapely/geometry/multipolygon.py +0 -0
- {Shapely-1.2.2 → Shapely-1.2.3}/shapely/geometry/point.py +0 -0
- {Shapely-1.2.2 → Shapely-1.2.3}/shapely/geometry/polygon.py +0 -0
- {Shapely-1.2.2 → Shapely-1.2.3}/shapely/geometry/proxy.py +0 -0
- {Shapely-1.2.2 → Shapely-1.2.3}/shapely/geos.py +2 -2
- {Shapely-1.2.2 → Shapely-1.2.3}/shapely/impl.py +0 -0
- {Shapely-1.2.2 → Shapely-1.2.3}/shapely/iterops.py +0 -0
- {Shapely-1.2.2 → Shapely-1.2.3}/shapely/linref.py +0 -0
- {Shapely-1.2.2 → Shapely-1.2.3}/shapely/ops.py +0 -0
- {Shapely-1.2.2 → Shapely-1.2.3}/shapely/predicates.py +0 -0
- {Shapely-1.2.2 → Shapely-1.2.3}/shapely/prepared.py +0 -0
- {Shapely-1.2.2 → Shapely-1.2.3}/shapely/tests/Array.txt +0 -0
- {Shapely-1.2.2 → Shapely-1.2.3}/shapely/tests/GeoInterface.txt +0 -0
- {Shapely-1.2.2 → Shapely-1.2.3}/shapely/tests/IterOps.txt +0 -0
- {Shapely-1.2.2 → Shapely-1.2.3}/shapely/tests/LineString.txt +0 -0
- {Shapely-1.2.2 → Shapely-1.2.3}/shapely/tests/MultiLineString.txt +0 -0
- {Shapely-1.2.2 → Shapely-1.2.3}/shapely/tests/MultiPoint.txt +0 -0
- {Shapely-1.2.2 → Shapely-1.2.3}/shapely/tests/MultiPolygon.txt +0 -0
- {Shapely-1.2.2 → Shapely-1.2.3}/shapely/tests/Operations.txt +0 -0
- {Shapely-1.2.2 → Shapely-1.2.3}/shapely/tests/Persist.txt +0 -0
- {Shapely-1.2.2 → Shapely-1.2.3}/shapely/tests/Point.txt +0 -0
- {Shapely-1.2.2 → Shapely-1.2.3}/shapely/tests/Polygon.txt +0 -0
- {Shapely-1.2.2 → Shapely-1.2.3}/shapely/tests/Predicates.txt +0 -0
- {Shapely-1.2.2 → Shapely-1.2.3}/shapely/tests/attribute-chains.txt +0 -0
- {Shapely-1.2.2 → Shapely-1.2.3}/shapely/tests/binascii_hex.txt +0 -0
- {Shapely-1.2.2 → Shapely-1.2.3}/shapely/tests/cascaded_union.txt +0 -0
- {Shapely-1.2.2 → Shapely-1.2.3}/shapely/tests/dimensions.txt +0 -0
- {Shapely-1.2.2 → Shapely-1.2.3}/shapely/tests/invalid_intersection.txt +0 -0
- {Shapely-1.2.2 → Shapely-1.2.3}/shapely/tests/linear-referencing.txt +0 -0
- {Shapely-1.2.2 → Shapely-1.2.3}/shapely/tests/linemerge.txt +0 -0
- {Shapely-1.2.2 → Shapely-1.2.3}/shapely/tests/polygonize.txt +0 -0
- {Shapely-1.2.2 → Shapely-1.2.3}/shapely/tests/test_collection.py +0 -0
- {Shapely-1.2.2 → Shapely-1.2.3}/shapely/tests/test_doctests.py +0 -0
- {Shapely-1.2.2 → Shapely-1.2.3}/shapely/tests/test_emptiness.py +0 -0
- {Shapely-1.2.2 → Shapely-1.2.3}/shapely/tests/test_equality.py +0 -0
- {Shapely-1.2.2 → Shapely-1.2.3}/shapely/tests/test_geomseq.py +0 -0
- {Shapely-1.2.2 → Shapely-1.2.3}/shapely/tests/test_prepared.py +0 -0
- {Shapely-1.2.2 → Shapely-1.2.3}/shapely/tests/test_singularity.py +0 -0
- {Shapely-1.2.2 → Shapely-1.2.3}/shapely/tests/test_validation.py +0 -0
- {Shapely-1.2.2 → Shapely-1.2.3}/shapely/tests/test_xy.py +0 -0
- {Shapely-1.2.2 → Shapely-1.2.3}/shapely/tests/threading_test.py +0 -0
- {Shapely-1.2.2 → Shapely-1.2.3}/shapely/tests/wkt_locale.txt +0 -0
- {Shapely-1.2.2 → Shapely-1.2.3}/shapely/topology.py +0 -0
- {Shapely-1.2.2 → Shapely-1.2.3}/shapely/wkb.py +0 -0
- {Shapely-1.2.2 → Shapely-1.2.3}/shapely/wkt.py +0 -0
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
All tickets are children of http://trac.gispython.org/lab/ticket.
|
|
2
2
|
|
|
3
|
+
1.2.3 (2010-08-17)
|
|
4
|
+
------------------
|
|
5
|
+
- Add mapping function.
|
|
6
|
+
- Fix problem with GEOSisValidReason symbol for GEOS < 3.1.
|
|
7
|
+
|
|
3
8
|
1.2.2 (2010-07-23)
|
|
4
9
|
------------------
|
|
5
10
|
- Add representative_point method.
|
|
@@ -64,6 +64,7 @@ shapely/tests/test_doctests.py
|
|
|
64
64
|
shapely/tests/test_emptiness.py
|
|
65
65
|
shapely/tests/test_equality.py
|
|
66
66
|
shapely/tests/test_geomseq.py
|
|
67
|
+
shapely/tests/test_mapping.py
|
|
67
68
|
shapely/tests/test_prepared.py
|
|
68
69
|
shapely/tests/test_singularity.py
|
|
69
70
|
shapely/tests/test_validation.py
|
|
@@ -3,8 +3,8 @@ The Shapely 1.2 User Manual (Preview)
|
|
|
3
3
|
=====================================
|
|
4
4
|
|
|
5
5
|
:Author: Sean Gillies, <sean.gillies@gmail.com>
|
|
6
|
-
:Revision: 1.2.
|
|
7
|
-
:Date:
|
|
6
|
+
:Revision: 1.2.2
|
|
7
|
+
:Date: 10 August 2010
|
|
8
8
|
:Copyright:
|
|
9
9
|
This work is licensed under a `Creative Commons Attribution 3.0
|
|
10
10
|
United States License`__.
|
|
@@ -214,7 +214,7 @@ General Attributes and Methods
|
|
|
214
214
|
geometric object.
|
|
215
215
|
|
|
216
216
|
.. note::
|
|
217
|
-
This is not in
|
|
217
|
+
This is not in general the same as the centroid.
|
|
218
218
|
|
|
219
219
|
.. sourcecode:: pycon
|
|
220
220
|
|
|
@@ -224,11 +224,6 @@ General Attributes and Methods
|
|
|
224
224
|
>>> donut.representative_point().wkt
|
|
225
225
|
'POINT (-1.5000000000000000 0.0000000000000000)'
|
|
226
226
|
|
|
227
|
-
.. sourcecode:: pycon
|
|
228
|
-
|
|
229
|
-
>>> Point(0,0).distance(Point(1,1))
|
|
230
|
-
1.4142135623730951
|
|
231
|
-
|
|
232
227
|
.. _points:
|
|
233
228
|
|
|
234
229
|
Points
|
|
@@ -1387,8 +1382,8 @@ Figure 1. Convex hull (blue) of 2 points (left) and of 6 points (right).
|
|
|
1387
1382
|
|
|
1388
1383
|
.. attribute:: object.envelope
|
|
1389
1384
|
|
|
1390
|
-
Returns a representation of the point or smallest rectangular polygon
|
|
1391
|
-
contains the object.
|
|
1385
|
+
Returns a representation of the point or smallest rectangular polygon (with
|
|
1386
|
+
sides parallel to the coordinate axes) that contains the object.
|
|
1392
1387
|
|
|
1393
1388
|
.. sourcecode:: pycon
|
|
1394
1389
|
|
|
@@ -1714,6 +1709,26 @@ Or a simple placemark-type object:
|
|
|
1714
1709
|
>>> list(shape.coords)
|
|
1715
1710
|
[(0.0, 0.0)]
|
|
1716
1711
|
|
|
1712
|
+
The GeoJSON-like mapping of a geometric object can be obtained using
|
|
1713
|
+
:func:`shapely.geometry.mapping`.
|
|
1714
|
+
|
|
1715
|
+
.. function:: shapely.geometry.mapping(ob)
|
|
1716
|
+
|
|
1717
|
+
Return a new, independent geometry with coordinates `copied` from the
|
|
1718
|
+
context.
|
|
1719
|
+
|
|
1720
|
+
For example, using the same `GeoThing` class:
|
|
1721
|
+
|
|
1722
|
+
.. sourcecode:: pycon
|
|
1723
|
+
|
|
1724
|
+
>>> from shapely.geometry import mapping
|
|
1725
|
+
>>> thing = GeoThing({"type": "Point", "coordinates": (0.0, 0.0)})
|
|
1726
|
+
>>> m = mapping(thing)
|
|
1727
|
+
>>> m['type']
|
|
1728
|
+
'Point'
|
|
1729
|
+
>>> m['coordinates']
|
|
1730
|
+
(0.0, 0.0)}
|
|
1731
|
+
|
|
1717
1732
|
Conclusion
|
|
1718
1733
|
==========
|
|
1719
1734
|
|
|
@@ -3,8 +3,8 @@ The Shapely 1.2 User Manual (Preview)
|
|
|
3
3
|
=====================================
|
|
4
4
|
|
|
5
5
|
:Author: Sean Gillies, <sean.gillies@gmail.com>
|
|
6
|
-
:Revision: 1.2.
|
|
7
|
-
:Date:
|
|
6
|
+
:Revision: 1.2.2
|
|
7
|
+
:Date: 10 August 2010
|
|
8
8
|
:Copyright:
|
|
9
9
|
This work is licensed under a `Creative Commons Attribution 3.0
|
|
10
10
|
United States License`__.
|
|
@@ -214,7 +214,7 @@ General Attributes and Methods
|
|
|
214
214
|
geometric object.
|
|
215
215
|
|
|
216
216
|
.. note::
|
|
217
|
-
This is not in
|
|
217
|
+
This is not in general the same as the centroid.
|
|
218
218
|
|
|
219
219
|
.. sourcecode:: pycon
|
|
220
220
|
|
|
@@ -1382,8 +1382,8 @@ Figure 1. Convex hull (blue) of 2 points (left) and of 6 points (right).
|
|
|
1382
1382
|
|
|
1383
1383
|
.. attribute:: object.envelope
|
|
1384
1384
|
|
|
1385
|
-
Returns a representation of the point or smallest rectangular polygon
|
|
1386
|
-
contains the object.
|
|
1385
|
+
Returns a representation of the point or smallest rectangular polygon (with
|
|
1386
|
+
sides parallel to the coordinate axes) that contains the object.
|
|
1387
1387
|
|
|
1388
1388
|
.. sourcecode:: pycon
|
|
1389
1389
|
|
|
@@ -1709,6 +1709,26 @@ Or a simple placemark-type object:
|
|
|
1709
1709
|
>>> list(shape.coords)
|
|
1710
1710
|
[(0.0, 0.0)]
|
|
1711
1711
|
|
|
1712
|
+
The GeoJSON-like mapping of a geometric object can be obtained using
|
|
1713
|
+
:func:`shapely.geometry.mapping`.
|
|
1714
|
+
|
|
1715
|
+
.. function:: shapely.geometry.mapping(ob)
|
|
1716
|
+
|
|
1717
|
+
Return a new, independent geometry with coordinates `copied` from the
|
|
1718
|
+
context.
|
|
1719
|
+
|
|
1720
|
+
For example, using the same `GeoThing` class:
|
|
1721
|
+
|
|
1722
|
+
.. sourcecode:: pycon
|
|
1723
|
+
|
|
1724
|
+
>>> from shapely.geometry import mapping
|
|
1725
|
+
>>> thing = GeoThing({"type": "Point", "coordinates": (0.0, 0.0)})
|
|
1726
|
+
>>> m = mapping(thing)
|
|
1727
|
+
>>> m['type']
|
|
1728
|
+
'Point'
|
|
1729
|
+
>>> m['coordinates']
|
|
1730
|
+
(0.0, 0.0)}
|
|
1731
|
+
|
|
1712
1732
|
Conclusion
|
|
1713
1733
|
==========
|
|
1714
1734
|
|
|
@@ -16,7 +16,7 @@ readme_text = file('README.txt', 'rb').read()
|
|
|
16
16
|
setup_args = dict(
|
|
17
17
|
metadata_version = '1.2',
|
|
18
18
|
name = 'Shapely',
|
|
19
|
-
version = '1.2.
|
|
19
|
+
version = '1.2.3',
|
|
20
20
|
requires_python = '>=2.5,<3',
|
|
21
21
|
requires_external = 'libgeos_c (>=3.1)',
|
|
22
22
|
description = 'Geometric objects, predicates, and operations',
|
|
@@ -167,9 +167,6 @@ def prototype(lgeos, geosVersion):
|
|
|
167
167
|
lgeos.GEOSisValid.restype = ctypes.c_byte
|
|
168
168
|
lgeos.GEOSisValid.argtypes = [ctypes.c_void_p]
|
|
169
169
|
|
|
170
|
-
lgeos.GEOSisValidReason.restype = allocated_c_char_p
|
|
171
|
-
lgeos.GEOSisValidReason.argtypes = [ctypes.c_void_p]
|
|
172
|
-
|
|
173
170
|
lgeos.GEOSisSimple.restype = ctypes.c_byte
|
|
174
171
|
lgeos.GEOSisSimple.argtypes = [ctypes.c_void_p]
|
|
175
172
|
|
|
@@ -249,6 +246,9 @@ def prototype(lgeos, geosVersion):
|
|
|
249
246
|
lgeos.GEOSPreparedCovers.restype = ctypes.c_int
|
|
250
247
|
lgeos.GEOSPreparedCovers.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
|
|
251
248
|
|
|
249
|
+
lgeos.GEOSisValidReason.restype = allocated_c_char_p
|
|
250
|
+
lgeos.GEOSisValidReason.argtypes = [ctypes.c_void_p]
|
|
251
|
+
|
|
252
252
|
# Other, GEOS C API 1.5.0+
|
|
253
253
|
if geosVersion >= (1, 5, 0):
|
|
254
254
|
lgeos.GEOSUnionCascaded.restype = ctypes.c_void_p
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"""Geometry classes and factories
|
|
2
2
|
"""
|
|
3
3
|
|
|
4
|
-
from geo import shape, asShape
|
|
4
|
+
from geo import shape, asShape, mapping
|
|
5
5
|
from point import Point, asPoint
|
|
6
6
|
from linestring import LineString, asLineString
|
|
7
7
|
from polygon import Polygon, asPolygon
|
|
@@ -14,7 +14,7 @@ __all__ = [
|
|
|
14
14
|
'shape', 'asShape', 'Point', 'asPoint', 'LineString', 'asLineString',
|
|
15
15
|
'Polygon', 'asPolygon', 'MultiPoint', 'asMultiPoint',
|
|
16
16
|
'MultiLineString', 'asMultiLineString', 'MultiPolygon', 'asMultiPolygon',
|
|
17
|
-
'GeometryCollection'
|
|
17
|
+
'GeometryCollection', 'mapping'
|
|
18
18
|
]
|
|
19
19
|
|
|
20
20
|
|
|
@@ -94,10 +94,14 @@ class BaseGeometry(object):
|
|
|
94
94
|
def _is_empty(self):
|
|
95
95
|
return self.__geom__ in [EMPTY, None]
|
|
96
96
|
|
|
97
|
+
# a reference to the so/dll proxy to preserve access during clean up
|
|
98
|
+
_lgeos = lgeos
|
|
99
|
+
|
|
97
100
|
def empty(self):
|
|
101
|
+
# TODO: defer cleanup to the implementation. We shouldn't be
|
|
102
|
+
# explicitly calling a lgeos method here.
|
|
98
103
|
if not (self._owned or self._is_empty):
|
|
99
|
-
|
|
100
|
-
lgeos.GEOSGeom_destroy(self.__geom__)
|
|
104
|
+
self._lgeos.GEOSGeom_destroy(self.__geom__)
|
|
101
105
|
self.__geom__ = EMPTY
|
|
102
106
|
|
|
103
107
|
def __del__(self):
|
|
@@ -574,7 +578,6 @@ class HeterogeneousGeometrySequence(GeometrySequence):
|
|
|
574
578
|
g._owned = True
|
|
575
579
|
return g
|
|
576
580
|
|
|
577
|
-
|
|
578
581
|
# Test runner
|
|
579
582
|
def _test():
|
|
580
583
|
import doctest
|
|
@@ -2,6 +2,7 @@ from unittest import TestSuite
|
|
|
2
2
|
|
|
3
3
|
import test_doctests, test_prepared, test_equality, test_geomseq, test_xy
|
|
4
4
|
import test_collection, test_emptiness, test_singularity, test_validation
|
|
5
|
+
import test_mapping
|
|
5
6
|
|
|
6
7
|
def test_suite():
|
|
7
8
|
suite = TestSuite()
|
|
@@ -14,5 +15,6 @@ def test_suite():
|
|
|
14
15
|
suite.addTest(test_collection.test_suite())
|
|
15
16
|
suite.addTest(test_singularity.test_suite())
|
|
16
17
|
suite.addTest(test_validation.test_suite())
|
|
18
|
+
suite.addTest(test_mapping.test_suite())
|
|
17
19
|
return suite
|
|
18
20
|
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import unittest
|
|
2
|
+
from shapely.geometry import Point, mapping
|
|
3
|
+
|
|
4
|
+
class MappingTestCase(unittest.TestCase):
|
|
5
|
+
def test_point(self):
|
|
6
|
+
m = mapping(Point(0, 0))
|
|
7
|
+
self.failUnlessEqual(m['type'], 'Point')
|
|
8
|
+
self.failUnlessEqual(m['coordinates'], (0.0, 0.0))
|
|
9
|
+
|
|
10
|
+
def test_suite():
|
|
11
|
+
return unittest.TestLoader().loadTestsFromTestCase(MappingTestCase)
|
|
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
|
|
@@ -298,6 +298,8 @@ class LGEOS15(LGEOSBase):
|
|
|
298
298
|
):
|
|
299
299
|
pred.func.errcheck = errcheck_predicate
|
|
300
300
|
|
|
301
|
+
self.GEOSisValidReason.func.errcheck = errcheck_just_free
|
|
302
|
+
|
|
301
303
|
self.methods['area'] = self.GEOSArea
|
|
302
304
|
self.methods['boundary'] = self.GEOSBoundary
|
|
303
305
|
self.methods['buffer'] = self.GEOSBuffer
|
|
@@ -351,8 +353,6 @@ class LGEOS16LR(LGEOS16):
|
|
|
351
353
|
def __init__(self, dll):
|
|
352
354
|
super(LGEOS16LR, self).__init__(dll)
|
|
353
355
|
|
|
354
|
-
self.GEOSisValidReason.func.errcheck = errcheck_just_free
|
|
355
|
-
|
|
356
356
|
self.methods['project'] = self.GEOSProject
|
|
357
357
|
self.methods['project_normalized'] = self.GEOSProjectNormalized
|
|
358
358
|
self.methods['interpolate'] = self.GEOSInterpolate
|
|
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
|