shapely 1.0__py2.4.egg → 1.0b1__py2.4.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 +13 -44
- EGG-INFO/SOURCES.txt +0 -3
- shapely/geos.py +6 -22
- shapely/geos.pyc +0 -0
- shapely/iterops.py +7 -9
- shapely/iterops.pyc +0 -0
- shapely/predicates.py +8 -16
- shapely/predicates.pyc +0 -0
- shapely/topology.py +0 -4
- shapely/topology.pyc +0 -0
- shapely/wkb.py +3 -8
- shapely/wkb.pyc +0 -0
- shapely/wkt.py +2 -9
- shapely/wkt.pyc +0 -0
- shapely/geometry/__init__.py +0 -9
- shapely/geometry/__init__.pyc +0 -0
- shapely/geometry/base.py +0 -415
- shapely/geometry/base.pyc +0 -0
- shapely/geometry/collection.py +0 -24
- shapely/geometry/collection.pyc +0 -0
- shapely/geometry/geo.py +0 -35
- shapely/geometry/geo.pyc +0 -0
- shapely/geometry/linestring.py +0 -234
- shapely/geometry/linestring.pyc +0 -0
- shapely/geometry/multilinestring.py +0 -157
- shapely/geometry/multilinestring.pyc +0 -0
- shapely/geometry/multipoint.py +0 -187
- shapely/geometry/multipoint.pyc +0 -0
- shapely/geometry/multipolygon.py +0 -143
- shapely/geometry/multipolygon.pyc +0 -0
- shapely/geometry/point.py +0 -259
- shapely/geometry/point.pyc +0 -0
- shapely/geometry/polygon.py +0 -429
- shapely/geometry/polygon.pyc +0 -0
- /EGG-INFO/{not-zip-safe → zip-safe} +0 -0
EGG-INFO/PKG-INFO
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 1.0
|
|
2
2
|
Name: Shapely
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.0b1
|
|
4
4
|
Summary: Geospatial geometries, predicates, and operations
|
|
5
5
|
Home-page: http://trac.gispython.org/projects/PCL/wiki/Shapely
|
|
6
6
|
Author: Sean Gillies
|
|
@@ -9,8 +9,8 @@ License: BSD
|
|
|
9
9
|
Description: Shapely
|
|
10
10
|
=======
|
|
11
11
|
|
|
12
|
-
Shapely is a Python package for programming with
|
|
13
|
-
|
|
12
|
+
Shapely is a Python package for programming with geospatial geometries. It is
|
|
13
|
+
based on GEOS (http://geos.refractions.net). Shapely 1.0 is ignorant about
|
|
14
14
|
coordinate and reference systems. Projection responsibility is left to specific
|
|
15
15
|
applications. For more information, see:
|
|
16
16
|
|
|
@@ -20,22 +20,18 @@ Description: Shapely
|
|
|
20
20
|
Shapely requires Python 2.4+. (I've also begun to port it to Python 3.0:
|
|
21
21
|
http://zcologia.com/news/564/shapely-for-python-3-0/.)
|
|
22
22
|
|
|
23
|
-
|
|
24
23
|
Dependencies
|
|
25
24
|
------------
|
|
26
25
|
|
|
27
|
-
* libgeos_c (2.2.3
|
|
26
|
+
* libgeos_c (2.2.3, also reported to work with 3.0 after small modifications.)
|
|
28
27
|
* Python ctypes_ (standard in Python 2.5+)
|
|
29
28
|
|
|
30
29
|
.. _ctypes: http://pypi.python.org/pypi/ctypes/
|
|
31
30
|
|
|
32
|
-
|
|
33
31
|
Installation
|
|
34
32
|
------------
|
|
35
33
|
|
|
36
|
-
|
|
37
|
-
GEOS DLL. Other users should acquire libgeos_c by any means, make sure that it
|
|
38
|
-
is on the system library path, and install from the Python package index::
|
|
34
|
+
Shapely can be installed from the Python package index::
|
|
39
35
|
|
|
40
36
|
$ sudo easy_install Shapely
|
|
41
37
|
|
|
@@ -43,29 +39,26 @@ Description: Shapely
|
|
|
43
39
|
|
|
44
40
|
$ sudo python setup.py install
|
|
45
41
|
|
|
46
|
-
or by using the development buildout
|
|
42
|
+
or by using the development buildout, which also provides libgeos_c::
|
|
47
43
|
|
|
48
44
|
$ svn co http://svn.gispython.org/svn/gispy/buildout/shapely.buildout/trunk shapely.buildout
|
|
49
45
|
$ cd shapely.buildout
|
|
50
46
|
$ python bootstrap.py
|
|
51
47
|
$ ./bin/buildout
|
|
52
48
|
|
|
53
|
-
|
|
54
49
|
Usage
|
|
55
50
|
-----
|
|
56
51
|
|
|
57
|
-
|
|
52
|
+
Buffer a point::
|
|
58
53
|
|
|
59
54
|
>>> from shapely.geometry import Point
|
|
60
55
|
>>> point = Point(-106.0, 40.0) # longitude, latitude
|
|
61
56
|
>>> point.buffer(10.0)
|
|
62
57
|
<shapely.geometry.polygon.Polygon object at ...>
|
|
63
58
|
|
|
64
|
-
See
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
examples of the geometry APIs.
|
|
68
|
-
|
|
59
|
+
See Operations.txt and Predicates.txt under tests/ for more examples of the
|
|
60
|
+
spatial operations and predicates provided by Shapely. Also see Point.txt,
|
|
61
|
+
LineString.txt, etc for examples of the geometry APIs.
|
|
69
62
|
|
|
70
63
|
Numpy integration
|
|
71
64
|
-----------------
|
|
@@ -87,7 +80,6 @@ Description: Shapely
|
|
|
87
80
|
>>> line.wkt
|
|
88
81
|
'LINESTRING (1.0000000000000000 2.0000000000000000, 3.0000000000000000 4.0000000000000000)'
|
|
89
82
|
|
|
90
|
-
|
|
91
83
|
Python Geo Interface
|
|
92
84
|
--------------------
|
|
93
85
|
|
|
@@ -115,7 +107,6 @@ Description: Shapely
|
|
|
115
107
|
See http://trac.gispython.org/projects/PCL/wiki/PythonGeoInterface for more
|
|
116
108
|
details on the interface.
|
|
117
109
|
|
|
118
|
-
|
|
119
110
|
Testing
|
|
120
111
|
-------
|
|
121
112
|
|
|
@@ -125,11 +116,7 @@ Description: Shapely
|
|
|
125
116
|
$ python point.py
|
|
126
117
|
|
|
127
118
|
There are also two test runners under tests/. test_doctests.py requires
|
|
128
|
-
zope.testing. runalldoctests.py does not.
|
|
129
|
-
tests is::
|
|
130
|
-
|
|
131
|
-
$ python setup.py test
|
|
132
|
-
|
|
119
|
+
zope.testing. runalldoctests.py does not.
|
|
133
120
|
|
|
134
121
|
Support
|
|
135
122
|
-------
|
|
@@ -137,34 +124,16 @@ Description: Shapely
|
|
|
137
124
|
For current information about this project, see the wiki_.
|
|
138
125
|
|
|
139
126
|
.. _wiki: http://trac.gispython.org/projects/PCL/wiki/Shapely
|
|
140
|
-
.. _manual: http://gispython.org/
|
|
127
|
+
.. _manual: http://trac.gispython.org/projects/PCL/wiki/ShapelyManual
|
|
141
128
|
|
|
142
129
|
If you have questions, please consider joining our community list:
|
|
143
130
|
|
|
144
131
|
http://trac.gispython.org/projects/PCL/wiki/CommunityList
|
|
145
132
|
|
|
146
133
|
|
|
147
|
-
Credits
|
|
148
|
-
-------
|
|
149
|
-
|
|
150
|
-
* Sean Gillies (Pleiades)
|
|
151
|
-
* Howard Butler (Hobu, Inc.)
|
|
152
|
-
* Kai Lautaportti (Hexagon IT)
|
|
153
|
-
* Fr |eaigue| d |eaigue| ric Junod (Camptocamp SA)
|
|
154
|
-
* Eric Lemoine (Camptocamp SA)
|
|
155
|
-
* Justin Bronn (GeoDjango) for ctypes inspiration
|
|
156
|
-
* Artem Pavlenko (Mapnik) for help with GEOS DLLs
|
|
157
|
-
|
|
158
|
-
.. |eaigue| unicode:: U+00E9
|
|
159
|
-
:trim:
|
|
160
|
-
|
|
161
|
-
Major portions of this work were supported by a grant (to Pleiades) from the
|
|
162
|
-
U.S. National Endowment for the Humanities (http://www.neh.gov).
|
|
163
|
-
|
|
164
|
-
|
|
165
134
|
Keywords: geometry topology
|
|
166
135
|
Platform: UNKNOWN
|
|
167
|
-
Classifier: Development Status ::
|
|
136
|
+
Classifier: Development Status :: 4 - Beta
|
|
168
137
|
Classifier: Intended Audience :: Developers
|
|
169
138
|
Classifier: Intended Audience :: Science/Research
|
|
170
139
|
Classifier: License :: OSI Approved :: BSD License
|
EGG-INFO/SOURCES.txt
CHANGED
|
@@ -4,7 +4,6 @@ HISTORY.txt
|
|
|
4
4
|
LICENSE.txt
|
|
5
5
|
README.txt
|
|
6
6
|
setup.py
|
|
7
|
-
setup_windows.py
|
|
8
7
|
Shapely.egg-info/PKG-INFO
|
|
9
8
|
Shapely.egg-info/SOURCES.txt
|
|
10
9
|
Shapely.egg-info/dependency_links.txt
|
|
@@ -12,8 +11,6 @@ Shapely.egg-info/requires.txt
|
|
|
12
11
|
Shapely.egg-info/top_level.txt
|
|
13
12
|
examples/geoms.py
|
|
14
13
|
examples/world.py
|
|
15
|
-
manual/manual.txt
|
|
16
|
-
manual/style.css
|
|
17
14
|
shapely/__init__.py
|
|
18
15
|
shapely/geos.py
|
|
19
16
|
shapely/iterops.py
|
shapely/geos.py
CHANGED
|
@@ -3,31 +3,21 @@ Exports the libgeos_c shared lib, GEOS-specific exceptions, and utilities.
|
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
5
|
import atexit
|
|
6
|
-
from ctypes import
|
|
6
|
+
from ctypes import CDLL, CFUNCTYPE, c_char_p
|
|
7
7
|
from ctypes.util import find_library
|
|
8
|
-
import os
|
|
9
8
|
import sys
|
|
10
9
|
|
|
11
|
-
import shapely
|
|
12
|
-
|
|
13
10
|
if sys.platform == 'win32':
|
|
14
11
|
try:
|
|
15
|
-
|
|
16
|
-
original_path = os.environ['PATH']
|
|
17
|
-
os.environ['PATH'] = "%s;%s" % (local_dlls, original_path)
|
|
18
|
-
lgeos = CDLL("geos.dll")
|
|
12
|
+
lgeos = CDLL('libgeos_c.dll')
|
|
19
13
|
except (ImportError, WindowsError):
|
|
14
|
+
# Try GEOS DLL from the Windows PostGIS installer for
|
|
15
|
+
# PostgreSQL 8.2 before failing
|
|
16
|
+
lgeos = CDLL('libgeos_c-1.dll')
|
|
17
|
+
except:
|
|
20
18
|
raise
|
|
21
|
-
def free(m):
|
|
22
|
-
try:
|
|
23
|
-
cdll.msvcrt.free(m)
|
|
24
|
-
except WindowsError:
|
|
25
|
-
# XXX: See http://trac.gispython.org/projects/PCL/ticket/149
|
|
26
|
-
pass
|
|
27
|
-
|
|
28
19
|
elif sys.platform == 'darwin':
|
|
29
20
|
lgeos = CDLL(find_library('geos_c'))
|
|
30
|
-
free = CDLL(find_library('libc')).free
|
|
31
21
|
else:
|
|
32
22
|
# Try the major versioned name first, falling back on the unversioned name.
|
|
33
23
|
try:
|
|
@@ -36,12 +26,6 @@ else:
|
|
|
36
26
|
lgeos = CDLL('libgeos_c.so')
|
|
37
27
|
except:
|
|
38
28
|
raise
|
|
39
|
-
free = CDLL('libc.so.6').free
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
class allocated_c_char_p(c_char_p):
|
|
43
|
-
pass
|
|
44
|
-
|
|
45
29
|
|
|
46
30
|
# Exceptions
|
|
47
31
|
|
shapely/geos.pyc
CHANGED
|
Binary file
|
shapely/iterops.py
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"""
|
|
3
3
|
|
|
4
4
|
from ctypes import c_char_p, c_size_t
|
|
5
|
-
from shapely.geos import lgeos
|
|
5
|
+
from shapely.geos import lgeos
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
def geos_from_geometry(geom):
|
|
@@ -28,22 +28,20 @@ class BinaryPredicateIterator(object):
|
|
|
28
28
|
return self
|
|
29
29
|
|
|
30
30
|
def __call__(self, geom, iterator, value=True):
|
|
31
|
-
|
|
32
|
-
raise ValueError, "Null geometry supports no operations"
|
|
31
|
+
geos_geom = geos_from_geometry(geom)
|
|
33
32
|
for item in iterator:
|
|
34
33
|
try:
|
|
35
|
-
|
|
34
|
+
geom, ob = item
|
|
36
35
|
except TypeError:
|
|
37
|
-
|
|
38
|
-
ob =
|
|
39
|
-
|
|
40
|
-
raise ValueError, "Null geometry supports no operations"
|
|
41
|
-
retval = self.fn(geom._geom, this_geom._geom)
|
|
36
|
+
geom = item
|
|
37
|
+
ob = geom
|
|
38
|
+
retval = self.fn(geos_geom, geos_from_geometry(geom))
|
|
42
39
|
if retval == 2:
|
|
43
40
|
raise PredicateError, "Failed to evaluate %s" % repr(self.fn)
|
|
44
41
|
elif bool(retval) == value:
|
|
45
42
|
yield ob
|
|
46
43
|
|
|
44
|
+
|
|
47
45
|
# utilities
|
|
48
46
|
disjoint = BinaryPredicateIterator(lgeos.GEOSDisjoint)
|
|
49
47
|
touches = BinaryPredicateIterator(lgeos.GEOSTouches)
|
shapely/iterops.pyc
CHANGED
|
Binary file
|
shapely/predicates.py
CHANGED
|
@@ -16,20 +16,16 @@ class BinaryPredicate(object):
|
|
|
16
16
|
|
|
17
17
|
def __init__(self, fn):
|
|
18
18
|
self.fn = fn
|
|
19
|
-
def errcheck(result, func, argtuple):
|
|
20
|
-
if result == 2:
|
|
21
|
-
raise PredicateError, "Failed to evaluate %s" % repr(self.fn)
|
|
22
|
-
return result
|
|
23
|
-
self.fn.errcheck = errcheck
|
|
24
19
|
|
|
25
20
|
def __get__(self, obj, objtype=None):
|
|
26
21
|
self.context = obj
|
|
27
22
|
return self
|
|
28
23
|
|
|
29
24
|
def __call__(self, other):
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
25
|
+
retval = self.fn(self.context._geom, other._geom)
|
|
26
|
+
if retval == 2:
|
|
27
|
+
raise PredicateError, "Failed to evaluate %s" % repr(self.fn)
|
|
28
|
+
return bool(retval)
|
|
33
29
|
|
|
34
30
|
|
|
35
31
|
# A data descriptor
|
|
@@ -42,16 +38,12 @@ class UnaryPredicate(object):
|
|
|
42
38
|
|
|
43
39
|
def __init__(self, fn):
|
|
44
40
|
self.fn = fn
|
|
45
|
-
def errcheck(result, func, argtuple):
|
|
46
|
-
if result == 2:
|
|
47
|
-
raise PredicateError, "Failed to evaluate %s" % repr(self.fn)
|
|
48
|
-
return result
|
|
49
|
-
self.fn.errcheck = errcheck
|
|
50
41
|
|
|
51
42
|
def __get__(self, obj, objtype=None):
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
43
|
+
retval = self.fn(obj._geom)
|
|
44
|
+
if retval == 2:
|
|
45
|
+
raise PredicateError, "Failed to evaluate %s" % repr(self.fn)
|
|
46
|
+
return bool(retval)
|
|
55
47
|
|
|
56
48
|
def __set__(self, obj, value=None):
|
|
57
49
|
raise AttributeError, "Attribute is read-only"
|
shapely/predicates.pyc
CHANGED
|
Binary file
|
shapely/topology.py
CHANGED
|
@@ -26,8 +26,6 @@ class BinaryTopologicalOp(object):
|
|
|
26
26
|
return self
|
|
27
27
|
|
|
28
28
|
def __call__(self, other):
|
|
29
|
-
if self.context._geom is None or other._geom is None:
|
|
30
|
-
raise ValueError, "Null geometry supports no operations"
|
|
31
29
|
product = self.fn(self.context._geom, other._geom)
|
|
32
30
|
if not product:
|
|
33
31
|
# Check validity of geometries
|
|
@@ -57,8 +55,6 @@ class UnaryTopologicalOp(object):
|
|
|
57
55
|
self.factory = factory
|
|
58
56
|
|
|
59
57
|
def __get__(self, obj, objtype=None):
|
|
60
|
-
if obj._geom is None:
|
|
61
|
-
raise ValueError, "Null geometry supports no operations"
|
|
62
58
|
return self.factory(self.fn(obj._geom))
|
|
63
59
|
|
|
64
60
|
def __set__(self, obj, value=None):
|
shapely/topology.pyc
CHANGED
|
Binary file
|
shapely/wkb.py
CHANGED
|
@@ -4,7 +4,7 @@ Load/dump geometries using the well-known binary (WKB) format.
|
|
|
4
4
|
|
|
5
5
|
from ctypes import byref, c_int, c_size_t, c_char_p, string_at
|
|
6
6
|
|
|
7
|
-
from shapely.geos import lgeos,
|
|
7
|
+
from shapely.geos import lgeos, ReadingError
|
|
8
8
|
from shapely.geometry.base import geom_factory
|
|
9
9
|
|
|
10
10
|
|
|
@@ -25,14 +25,9 @@ def load(fp):
|
|
|
25
25
|
|
|
26
26
|
def dumps(ob):
|
|
27
27
|
"""Dump a WKB representation of a geometry to a byte string."""
|
|
28
|
-
func = lgeos.GEOSGeomToWKB_buf
|
|
29
28
|
size = c_int()
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
free(result)
|
|
33
|
-
return retval
|
|
34
|
-
func.errcheck = errcheck
|
|
35
|
-
return func(ob._geom, byref(size))
|
|
29
|
+
bytes = lgeos.GEOSGeomToWKB_buf(ob._geom, byref(size))
|
|
30
|
+
return string_at(bytes, size.value)
|
|
36
31
|
|
|
37
32
|
def dump(ob, fp):
|
|
38
33
|
"""Dump a geometry to an open file."""
|
shapely/wkb.pyc
CHANGED
|
Binary file
|
shapely/wkt.py
CHANGED
|
@@ -4,7 +4,7 @@ Load/dump geometries using the well-known text (WKT) format.
|
|
|
4
4
|
|
|
5
5
|
from ctypes import byref, c_int, c_size_t, c_char_p, string_at
|
|
6
6
|
|
|
7
|
-
from shapely.geos import lgeos,
|
|
7
|
+
from shapely.geos import lgeos, ReadingError
|
|
8
8
|
from shapely.geometry.base import geom_factory
|
|
9
9
|
|
|
10
10
|
|
|
@@ -25,14 +25,7 @@ def load(fp):
|
|
|
25
25
|
|
|
26
26
|
def dumps(ob):
|
|
27
27
|
"""Dump a WKB representation of a geometry to a byte string."""
|
|
28
|
-
|
|
29
|
-
def errcheck(result, func, argtuple):
|
|
30
|
-
retval = result.value
|
|
31
|
-
free(result)
|
|
32
|
-
return retval
|
|
33
|
-
func.restype = allocated_c_char_p
|
|
34
|
-
func.errcheck = errcheck
|
|
35
|
-
return lgeos.GEOSGeomToWKT(ob._geom)
|
|
28
|
+
return string_at(lgeos.GEOSGeomToWKT(ob._geom))
|
|
36
29
|
|
|
37
30
|
def dump(ob, fp):
|
|
38
31
|
"""Dump a geometry to an open file."""
|
shapely/wkt.pyc
CHANGED
|
Binary file
|
shapely/geometry/__init__.py
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
from geo import asShape
|
|
2
|
-
from point import Point, asPoint
|
|
3
|
-
from linestring import LineString, asLineString
|
|
4
|
-
from polygon import Polygon, asPolygon
|
|
5
|
-
from multipoint import MultiPoint, asMultiPoint
|
|
6
|
-
from multilinestring import MultiLineString, asMultiLineString
|
|
7
|
-
from multipolygon import MultiPolygon, asMultiPolygon
|
|
8
|
-
from collection import GeometryCollection
|
|
9
|
-
|
shapely/geometry/__init__.pyc
DELETED
|
Binary file
|