shapely 1.0__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.0/CHANGES.txt +0 -0
- Shapely-1.0/CREDITS.txt +10 -0
- Shapely-1.0/HISTORY.txt +16 -0
- Shapely-1.0/LICENSE.txt +28 -0
- Shapely-1.0/PKG-INFO +173 -0
- Shapely-1.0/README.txt +155 -0
- Shapely-1.0/Shapely.egg-info/PKG-INFO +173 -0
- Shapely-1.0/Shapely.egg-info/SOURCES.txt +52 -0
- Shapely-1.0/Shapely.egg-info/dependency_links.txt +1 -0
- Shapely-1.0/Shapely.egg-info/requires.txt +2 -0
- Shapely-1.0/Shapely.egg-info/top_level.txt +1 -0
- Shapely-1.0/examples/geoms.py +51 -0
- Shapely-1.0/examples/world.py +21 -0
- Shapely-1.0/manual/manual.txt +847 -0
- Shapely-1.0/manual/style.css +231 -0
- Shapely-1.0/setup.cfg +5 -0
- Shapely-1.0/setup.py +38 -0
- Shapely-1.0/setup_windows.py +39 -0
- Shapely-1.0/shapely/__init__.py +1 -0
- Shapely-1.0/shapely/geometry/__init__.py +9 -0
- Shapely-1.0/shapely/geometry/base.py +415 -0
- Shapely-1.0/shapely/geometry/collection.py +24 -0
- Shapely-1.0/shapely/geometry/geo.py +35 -0
- Shapely-1.0/shapely/geometry/linestring.py +234 -0
- Shapely-1.0/shapely/geometry/multilinestring.py +157 -0
- Shapely-1.0/shapely/geometry/multipoint.py +187 -0
- Shapely-1.0/shapely/geometry/multipolygon.py +143 -0
- Shapely-1.0/shapely/geometry/point.py +259 -0
- Shapely-1.0/shapely/geometry/polygon.py +429 -0
- Shapely-1.0/shapely/geos.py +80 -0
- Shapely-1.0/shapely/iterops.py +56 -0
- Shapely-1.0/shapely/kml.py +0 -0
- Shapely-1.0/shapely/predicates.py +58 -0
- Shapely-1.0/shapely/topology.py +66 -0
- Shapely-1.0/shapely/wkb.py +40 -0
- Shapely-1.0/shapely/wkt.py +40 -0
- Shapely-1.0/tests/Array.txt +86 -0
- Shapely-1.0/tests/GeoInterface.txt +69 -0
- Shapely-1.0/tests/IterOps.txt +31 -0
- Shapely-1.0/tests/LineString.txt +124 -0
- Shapely-1.0/tests/MultiLineString.txt +64 -0
- Shapely-1.0/tests/MultiPoint.txt +85 -0
- Shapely-1.0/tests/MultiPolygon.txt +55 -0
- Shapely-1.0/tests/Operations.txt +72 -0
- Shapely-1.0/tests/Persist.txt +35 -0
- Shapely-1.0/tests/Point.txt +148 -0
- Shapely-1.0/tests/Polygon.txt +130 -0
- Shapely-1.0/tests/Predicates.txt +57 -0
- Shapely-1.0/tests/__init__.py +2 -0
- Shapely-1.0/tests/binascii_hex.txt +47 -0
- Shapely-1.0/tests/invalid_intersection.txt +29 -0
- Shapely-1.0/tests/rungrind.dist +4 -0
- Shapely-1.0/tests/test_doctests.py +34 -0
- Shapely-1.0/tests/valgrind-python.supp +240 -0
Shapely-1.0/CHANGES.txt
ADDED
|
File without changes
|
Shapely-1.0/CREDITS.txt
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
Sean Gillies (Pleiades)
|
|
2
|
+
Howard Butler (Hobu, Inc.)
|
|
3
|
+
Kai Lautaportti (Hexagon IT)
|
|
4
|
+
Frédéric Junod (Camptocamp SA)
|
|
5
|
+
Eric Lemoine (Camptocamp SA)
|
|
6
|
+
Justin Bronn (GeoDjango) for ctypes inspiration
|
|
7
|
+
Artem Pavlenko (Mapnik) for help with GEOS DLLs
|
|
8
|
+
|
|
9
|
+
Some of this work was supported by a grant from the U.S. National Endowment for
|
|
10
|
+
the Humanities (http://www.neh.gov).
|
Shapely-1.0/HISTORY.txt
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
All ticket numbers are rooted at http://trac.gispython.org/projects/PCL/ticket/
|
|
2
|
+
|
|
3
|
+
1.0: 18 January 2008
|
|
4
|
+
--------------------
|
|
5
|
+
- Final release.
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
1.0 RC2: 16 January 2008
|
|
9
|
+
------------------------
|
|
10
|
+
- Added temporary solution for #149.
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
1.0 RC1: 14 January 2008
|
|
14
|
+
------------------------
|
|
15
|
+
- First release candidate
|
|
16
|
+
|
Shapely-1.0/LICENSE.txt
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
|
|
2
|
+
Copyright (c) 2007, Sean C. Gillies
|
|
3
|
+
All rights reserved.
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
* Redistributions of source code must retain the above copyright
|
|
9
|
+
notice, this list of conditions and the following disclaimer.
|
|
10
|
+
* Redistributions in binary form must reproduce the above copyright
|
|
11
|
+
notice, this list of conditions and the following disclaimer in the
|
|
12
|
+
documentation and/or other materials provided with the distribution.
|
|
13
|
+
* Neither the name of Sean C. Gillies nor the names of
|
|
14
|
+
its contributors may be used to endorse or promote products derived from
|
|
15
|
+
this software without specific prior written permission.
|
|
16
|
+
|
|
17
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
18
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
19
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
20
|
+
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
21
|
+
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
22
|
+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
23
|
+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
24
|
+
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
25
|
+
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
26
|
+
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
27
|
+
POSSIBILITY OF SUCH DAMAGE.
|
|
28
|
+
|
Shapely-1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
Metadata-Version: 1.0
|
|
2
|
+
Name: Shapely
|
|
3
|
+
Version: 1.0
|
|
4
|
+
Summary: Geospatial geometries, predicates, and operations
|
|
5
|
+
Home-page: http://trac.gispython.org/projects/PCL/wiki/Shapely
|
|
6
|
+
Author: Sean Gillies
|
|
7
|
+
Author-email: sgillies@frii.com
|
|
8
|
+
License: BSD
|
|
9
|
+
Description: Shapely
|
|
10
|
+
=======
|
|
11
|
+
|
|
12
|
+
Shapely is a Python package for programming with 2D geospatial geometries. It
|
|
13
|
+
is based on GEOS (http://geos.refractions.net). Shapely 1.0 is ignorant about
|
|
14
|
+
coordinate and reference systems. Projection responsibility is left to specific
|
|
15
|
+
applications. For more information, see:
|
|
16
|
+
|
|
17
|
+
* Shapely wiki_
|
|
18
|
+
* Shapely manual_
|
|
19
|
+
|
|
20
|
+
Shapely requires Python 2.4+. (I've also begun to port it to Python 3.0:
|
|
21
|
+
http://zcologia.com/news/564/shapely-for-python-3-0/.)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
Dependencies
|
|
25
|
+
------------
|
|
26
|
+
|
|
27
|
+
* libgeos_c (2.2.3 or 3.0.0+)
|
|
28
|
+
* Python ctypes_ (standard in Python 2.5+)
|
|
29
|
+
|
|
30
|
+
.. _ctypes: http://pypi.python.org/pypi/ctypes/
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
Installation
|
|
34
|
+
------------
|
|
35
|
+
|
|
36
|
+
Windows users should use the executable installer, which contains the required
|
|
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::
|
|
39
|
+
|
|
40
|
+
$ sudo easy_install Shapely
|
|
41
|
+
|
|
42
|
+
with the setup script::
|
|
43
|
+
|
|
44
|
+
$ sudo python setup.py install
|
|
45
|
+
|
|
46
|
+
or by using the development buildout on Linux, which also provides libgeos_c::
|
|
47
|
+
|
|
48
|
+
$ svn co http://svn.gispython.org/svn/gispy/buildout/shapely.buildout/trunk shapely.buildout
|
|
49
|
+
$ cd shapely.buildout
|
|
50
|
+
$ python bootstrap.py
|
|
51
|
+
$ ./bin/buildout
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
Usage
|
|
55
|
+
-----
|
|
56
|
+
|
|
57
|
+
To buffer a point::
|
|
58
|
+
|
|
59
|
+
>>> from shapely.geometry import Point
|
|
60
|
+
>>> point = Point(-106.0, 40.0) # longitude, latitude
|
|
61
|
+
>>> point.buffer(10.0)
|
|
62
|
+
<shapely.geometry.polygon.Polygon object at ...>
|
|
63
|
+
|
|
64
|
+
See the manual_ for comprehensive examples of usage. See also Operations.txt
|
|
65
|
+
and Predicates.txt under tests/ for more examples of the spatial operations and
|
|
66
|
+
predicates provided by Shapely. See also Point.txt, LineString.txt, etc for
|
|
67
|
+
examples of the geometry APIs.
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
Numpy integration
|
|
71
|
+
-----------------
|
|
72
|
+
|
|
73
|
+
All Shapely geometry instances provide the Numpy array interface::
|
|
74
|
+
|
|
75
|
+
>>> from numpy import asarray
|
|
76
|
+
>>> a = asarray(point)
|
|
77
|
+
>>> a.size
|
|
78
|
+
3
|
|
79
|
+
>>> a.shape
|
|
80
|
+
(2,)
|
|
81
|
+
|
|
82
|
+
Numpy arrays can also be adapted to Shapely points and linestrings::
|
|
83
|
+
|
|
84
|
+
>>> from shapely.geometry import asLineString
|
|
85
|
+
>>> a = array([[1.0, 2.0], [3.0, 4.0]])
|
|
86
|
+
>>> line = asLineString(a)
|
|
87
|
+
>>> line.wkt
|
|
88
|
+
'LINESTRING (1.0000000000000000 2.0000000000000000, 3.0000000000000000 4.0000000000000000)'
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
Python Geo Interface
|
|
92
|
+
--------------------
|
|
93
|
+
|
|
94
|
+
Any object that provides the Python geo interface can be adapted to a Shapely
|
|
95
|
+
geometry with the asShape factory::
|
|
96
|
+
|
|
97
|
+
>>> d = {"type": "Point", "coordinates": (0.0, 0.0)}
|
|
98
|
+
>>> from shapely.geometry import asShape
|
|
99
|
+
>>> shape = asShape(d)
|
|
100
|
+
>>> shape.geom_type
|
|
101
|
+
'Point'
|
|
102
|
+
>>> tuple(shape.coords)
|
|
103
|
+
((0.0, 0.0),)
|
|
104
|
+
|
|
105
|
+
>>> class GeoThing(object):
|
|
106
|
+
... def __init__(self, d):
|
|
107
|
+
... self.__geo_interface__ = d
|
|
108
|
+
>>> thing = GeoThing({"type": "Point", "coordinates": (0.0, 0.0)})
|
|
109
|
+
>>> shape = asShape(thing)
|
|
110
|
+
>>> shape.geom_type
|
|
111
|
+
'Point'
|
|
112
|
+
>>> tuple(shape.coords)
|
|
113
|
+
((0.0, 0.0),)
|
|
114
|
+
|
|
115
|
+
See http://trac.gispython.org/projects/PCL/wiki/PythonGeoInterface for more
|
|
116
|
+
details on the interface.
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
Testing
|
|
120
|
+
-------
|
|
121
|
+
|
|
122
|
+
Several of the modules have docstring doctests::
|
|
123
|
+
|
|
124
|
+
$ cd shapely
|
|
125
|
+
$ python point.py
|
|
126
|
+
|
|
127
|
+
There are also two test runners under tests/. test_doctests.py requires
|
|
128
|
+
zope.testing. runalldoctests.py does not. Perhaps the easiest way to run the
|
|
129
|
+
tests is::
|
|
130
|
+
|
|
131
|
+
$ python setup.py test
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
Support
|
|
135
|
+
-------
|
|
136
|
+
|
|
137
|
+
For current information about this project, see the wiki_.
|
|
138
|
+
|
|
139
|
+
.. _wiki: http://trac.gispython.org/projects/PCL/wiki/Shapely
|
|
140
|
+
.. _manual: http://gispython.org/shapely/manual.html
|
|
141
|
+
|
|
142
|
+
If you have questions, please consider joining our community list:
|
|
143
|
+
|
|
144
|
+
http://trac.gispython.org/projects/PCL/wiki/CommunityList
|
|
145
|
+
|
|
146
|
+
|
|
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
|
+
Keywords: geometry topology
|
|
166
|
+
Platform: UNKNOWN
|
|
167
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
168
|
+
Classifier: Intended Audience :: Developers
|
|
169
|
+
Classifier: Intended Audience :: Science/Research
|
|
170
|
+
Classifier: License :: OSI Approved :: BSD License
|
|
171
|
+
Classifier: Operating System :: OS Independent
|
|
172
|
+
Classifier: Programming Language :: Python
|
|
173
|
+
Classifier: Topic :: Scientific/Engineering :: GIS
|
Shapely-1.0/README.txt
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
Shapely
|
|
2
|
+
=======
|
|
3
|
+
|
|
4
|
+
Shapely is a Python package for programming with 2D geospatial geometries. It
|
|
5
|
+
is based on GEOS (http://geos.refractions.net). Shapely 1.0 is ignorant about
|
|
6
|
+
coordinate and reference systems. Projection responsibility is left to specific
|
|
7
|
+
applications. For more information, see:
|
|
8
|
+
|
|
9
|
+
* Shapely wiki_
|
|
10
|
+
* Shapely manual_
|
|
11
|
+
|
|
12
|
+
Shapely requires Python 2.4+. (I've also begun to port it to Python 3.0:
|
|
13
|
+
http://zcologia.com/news/564/shapely-for-python-3-0/.)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
Dependencies
|
|
17
|
+
------------
|
|
18
|
+
|
|
19
|
+
* libgeos_c (2.2.3 or 3.0.0+)
|
|
20
|
+
* Python ctypes_ (standard in Python 2.5+)
|
|
21
|
+
|
|
22
|
+
.. _ctypes: http://pypi.python.org/pypi/ctypes/
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
Installation
|
|
26
|
+
------------
|
|
27
|
+
|
|
28
|
+
Windows users should use the executable installer, which contains the required
|
|
29
|
+
GEOS DLL. Other users should acquire libgeos_c by any means, make sure that it
|
|
30
|
+
is on the system library path, and install from the Python package index::
|
|
31
|
+
|
|
32
|
+
$ sudo easy_install Shapely
|
|
33
|
+
|
|
34
|
+
with the setup script::
|
|
35
|
+
|
|
36
|
+
$ sudo python setup.py install
|
|
37
|
+
|
|
38
|
+
or by using the development buildout on Linux, which also provides libgeos_c::
|
|
39
|
+
|
|
40
|
+
$ svn co http://svn.gispython.org/svn/gispy/buildout/shapely.buildout/trunk shapely.buildout
|
|
41
|
+
$ cd shapely.buildout
|
|
42
|
+
$ python bootstrap.py
|
|
43
|
+
$ ./bin/buildout
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
Usage
|
|
47
|
+
-----
|
|
48
|
+
|
|
49
|
+
To buffer a point::
|
|
50
|
+
|
|
51
|
+
>>> from shapely.geometry import Point
|
|
52
|
+
>>> point = Point(-106.0, 40.0) # longitude, latitude
|
|
53
|
+
>>> point.buffer(10.0)
|
|
54
|
+
<shapely.geometry.polygon.Polygon object at ...>
|
|
55
|
+
|
|
56
|
+
See the manual_ for comprehensive examples of usage. See also Operations.txt
|
|
57
|
+
and Predicates.txt under tests/ for more examples of the spatial operations and
|
|
58
|
+
predicates provided by Shapely. See also Point.txt, LineString.txt, etc for
|
|
59
|
+
examples of the geometry APIs.
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
Numpy integration
|
|
63
|
+
-----------------
|
|
64
|
+
|
|
65
|
+
All Shapely geometry instances provide the Numpy array interface::
|
|
66
|
+
|
|
67
|
+
>>> from numpy import asarray
|
|
68
|
+
>>> a = asarray(point)
|
|
69
|
+
>>> a.size
|
|
70
|
+
3
|
|
71
|
+
>>> a.shape
|
|
72
|
+
(2,)
|
|
73
|
+
|
|
74
|
+
Numpy arrays can also be adapted to Shapely points and linestrings::
|
|
75
|
+
|
|
76
|
+
>>> from shapely.geometry import asLineString
|
|
77
|
+
>>> a = array([[1.0, 2.0], [3.0, 4.0]])
|
|
78
|
+
>>> line = asLineString(a)
|
|
79
|
+
>>> line.wkt
|
|
80
|
+
'LINESTRING (1.0000000000000000 2.0000000000000000, 3.0000000000000000 4.0000000000000000)'
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
Python Geo Interface
|
|
84
|
+
--------------------
|
|
85
|
+
|
|
86
|
+
Any object that provides the Python geo interface can be adapted to a Shapely
|
|
87
|
+
geometry with the asShape factory::
|
|
88
|
+
|
|
89
|
+
>>> d = {"type": "Point", "coordinates": (0.0, 0.0)}
|
|
90
|
+
>>> from shapely.geometry import asShape
|
|
91
|
+
>>> shape = asShape(d)
|
|
92
|
+
>>> shape.geom_type
|
|
93
|
+
'Point'
|
|
94
|
+
>>> tuple(shape.coords)
|
|
95
|
+
((0.0, 0.0),)
|
|
96
|
+
|
|
97
|
+
>>> class GeoThing(object):
|
|
98
|
+
... def __init__(self, d):
|
|
99
|
+
... self.__geo_interface__ = d
|
|
100
|
+
>>> thing = GeoThing({"type": "Point", "coordinates": (0.0, 0.0)})
|
|
101
|
+
>>> shape = asShape(thing)
|
|
102
|
+
>>> shape.geom_type
|
|
103
|
+
'Point'
|
|
104
|
+
>>> tuple(shape.coords)
|
|
105
|
+
((0.0, 0.0),)
|
|
106
|
+
|
|
107
|
+
See http://trac.gispython.org/projects/PCL/wiki/PythonGeoInterface for more
|
|
108
|
+
details on the interface.
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
Testing
|
|
112
|
+
-------
|
|
113
|
+
|
|
114
|
+
Several of the modules have docstring doctests::
|
|
115
|
+
|
|
116
|
+
$ cd shapely
|
|
117
|
+
$ python point.py
|
|
118
|
+
|
|
119
|
+
There are also two test runners under tests/. test_doctests.py requires
|
|
120
|
+
zope.testing. runalldoctests.py does not. Perhaps the easiest way to run the
|
|
121
|
+
tests is::
|
|
122
|
+
|
|
123
|
+
$ python setup.py test
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
Support
|
|
127
|
+
-------
|
|
128
|
+
|
|
129
|
+
For current information about this project, see the wiki_.
|
|
130
|
+
|
|
131
|
+
.. _wiki: http://trac.gispython.org/projects/PCL/wiki/Shapely
|
|
132
|
+
.. _manual: http://gispython.org/shapely/manual.html
|
|
133
|
+
|
|
134
|
+
If you have questions, please consider joining our community list:
|
|
135
|
+
|
|
136
|
+
http://trac.gispython.org/projects/PCL/wiki/CommunityList
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
Credits
|
|
140
|
+
-------
|
|
141
|
+
|
|
142
|
+
* Sean Gillies (Pleiades)
|
|
143
|
+
* Howard Butler (Hobu, Inc.)
|
|
144
|
+
* Kai Lautaportti (Hexagon IT)
|
|
145
|
+
* Fr |eaigue| d |eaigue| ric Junod (Camptocamp SA)
|
|
146
|
+
* Eric Lemoine (Camptocamp SA)
|
|
147
|
+
* Justin Bronn (GeoDjango) for ctypes inspiration
|
|
148
|
+
* Artem Pavlenko (Mapnik) for help with GEOS DLLs
|
|
149
|
+
|
|
150
|
+
.. |eaigue| unicode:: U+00E9
|
|
151
|
+
:trim:
|
|
152
|
+
|
|
153
|
+
Major portions of this work were supported by a grant (to Pleiades) from the
|
|
154
|
+
U.S. National Endowment for the Humanities (http://www.neh.gov).
|
|
155
|
+
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
Metadata-Version: 1.0
|
|
2
|
+
Name: Shapely
|
|
3
|
+
Version: 1.0
|
|
4
|
+
Summary: Geospatial geometries, predicates, and operations
|
|
5
|
+
Home-page: http://trac.gispython.org/projects/PCL/wiki/Shapely
|
|
6
|
+
Author: Sean Gillies
|
|
7
|
+
Author-email: sgillies@frii.com
|
|
8
|
+
License: BSD
|
|
9
|
+
Description: Shapely
|
|
10
|
+
=======
|
|
11
|
+
|
|
12
|
+
Shapely is a Python package for programming with 2D geospatial geometries. It
|
|
13
|
+
is based on GEOS (http://geos.refractions.net). Shapely 1.0 is ignorant about
|
|
14
|
+
coordinate and reference systems. Projection responsibility is left to specific
|
|
15
|
+
applications. For more information, see:
|
|
16
|
+
|
|
17
|
+
* Shapely wiki_
|
|
18
|
+
* Shapely manual_
|
|
19
|
+
|
|
20
|
+
Shapely requires Python 2.4+. (I've also begun to port it to Python 3.0:
|
|
21
|
+
http://zcologia.com/news/564/shapely-for-python-3-0/.)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
Dependencies
|
|
25
|
+
------------
|
|
26
|
+
|
|
27
|
+
* libgeos_c (2.2.3 or 3.0.0+)
|
|
28
|
+
* Python ctypes_ (standard in Python 2.5+)
|
|
29
|
+
|
|
30
|
+
.. _ctypes: http://pypi.python.org/pypi/ctypes/
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
Installation
|
|
34
|
+
------------
|
|
35
|
+
|
|
36
|
+
Windows users should use the executable installer, which contains the required
|
|
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::
|
|
39
|
+
|
|
40
|
+
$ sudo easy_install Shapely
|
|
41
|
+
|
|
42
|
+
with the setup script::
|
|
43
|
+
|
|
44
|
+
$ sudo python setup.py install
|
|
45
|
+
|
|
46
|
+
or by using the development buildout on Linux, which also provides libgeos_c::
|
|
47
|
+
|
|
48
|
+
$ svn co http://svn.gispython.org/svn/gispy/buildout/shapely.buildout/trunk shapely.buildout
|
|
49
|
+
$ cd shapely.buildout
|
|
50
|
+
$ python bootstrap.py
|
|
51
|
+
$ ./bin/buildout
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
Usage
|
|
55
|
+
-----
|
|
56
|
+
|
|
57
|
+
To buffer a point::
|
|
58
|
+
|
|
59
|
+
>>> from shapely.geometry import Point
|
|
60
|
+
>>> point = Point(-106.0, 40.0) # longitude, latitude
|
|
61
|
+
>>> point.buffer(10.0)
|
|
62
|
+
<shapely.geometry.polygon.Polygon object at ...>
|
|
63
|
+
|
|
64
|
+
See the manual_ for comprehensive examples of usage. See also Operations.txt
|
|
65
|
+
and Predicates.txt under tests/ for more examples of the spatial operations and
|
|
66
|
+
predicates provided by Shapely. See also Point.txt, LineString.txt, etc for
|
|
67
|
+
examples of the geometry APIs.
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
Numpy integration
|
|
71
|
+
-----------------
|
|
72
|
+
|
|
73
|
+
All Shapely geometry instances provide the Numpy array interface::
|
|
74
|
+
|
|
75
|
+
>>> from numpy import asarray
|
|
76
|
+
>>> a = asarray(point)
|
|
77
|
+
>>> a.size
|
|
78
|
+
3
|
|
79
|
+
>>> a.shape
|
|
80
|
+
(2,)
|
|
81
|
+
|
|
82
|
+
Numpy arrays can also be adapted to Shapely points and linestrings::
|
|
83
|
+
|
|
84
|
+
>>> from shapely.geometry import asLineString
|
|
85
|
+
>>> a = array([[1.0, 2.0], [3.0, 4.0]])
|
|
86
|
+
>>> line = asLineString(a)
|
|
87
|
+
>>> line.wkt
|
|
88
|
+
'LINESTRING (1.0000000000000000 2.0000000000000000, 3.0000000000000000 4.0000000000000000)'
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
Python Geo Interface
|
|
92
|
+
--------------------
|
|
93
|
+
|
|
94
|
+
Any object that provides the Python geo interface can be adapted to a Shapely
|
|
95
|
+
geometry with the asShape factory::
|
|
96
|
+
|
|
97
|
+
>>> d = {"type": "Point", "coordinates": (0.0, 0.0)}
|
|
98
|
+
>>> from shapely.geometry import asShape
|
|
99
|
+
>>> shape = asShape(d)
|
|
100
|
+
>>> shape.geom_type
|
|
101
|
+
'Point'
|
|
102
|
+
>>> tuple(shape.coords)
|
|
103
|
+
((0.0, 0.0),)
|
|
104
|
+
|
|
105
|
+
>>> class GeoThing(object):
|
|
106
|
+
... def __init__(self, d):
|
|
107
|
+
... self.__geo_interface__ = d
|
|
108
|
+
>>> thing = GeoThing({"type": "Point", "coordinates": (0.0, 0.0)})
|
|
109
|
+
>>> shape = asShape(thing)
|
|
110
|
+
>>> shape.geom_type
|
|
111
|
+
'Point'
|
|
112
|
+
>>> tuple(shape.coords)
|
|
113
|
+
((0.0, 0.0),)
|
|
114
|
+
|
|
115
|
+
See http://trac.gispython.org/projects/PCL/wiki/PythonGeoInterface for more
|
|
116
|
+
details on the interface.
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
Testing
|
|
120
|
+
-------
|
|
121
|
+
|
|
122
|
+
Several of the modules have docstring doctests::
|
|
123
|
+
|
|
124
|
+
$ cd shapely
|
|
125
|
+
$ python point.py
|
|
126
|
+
|
|
127
|
+
There are also two test runners under tests/. test_doctests.py requires
|
|
128
|
+
zope.testing. runalldoctests.py does not. Perhaps the easiest way to run the
|
|
129
|
+
tests is::
|
|
130
|
+
|
|
131
|
+
$ python setup.py test
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
Support
|
|
135
|
+
-------
|
|
136
|
+
|
|
137
|
+
For current information about this project, see the wiki_.
|
|
138
|
+
|
|
139
|
+
.. _wiki: http://trac.gispython.org/projects/PCL/wiki/Shapely
|
|
140
|
+
.. _manual: http://gispython.org/shapely/manual.html
|
|
141
|
+
|
|
142
|
+
If you have questions, please consider joining our community list:
|
|
143
|
+
|
|
144
|
+
http://trac.gispython.org/projects/PCL/wiki/CommunityList
|
|
145
|
+
|
|
146
|
+
|
|
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
|
+
Keywords: geometry topology
|
|
166
|
+
Platform: UNKNOWN
|
|
167
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
168
|
+
Classifier: Intended Audience :: Developers
|
|
169
|
+
Classifier: Intended Audience :: Science/Research
|
|
170
|
+
Classifier: License :: OSI Approved :: BSD License
|
|
171
|
+
Classifier: Operating System :: OS Independent
|
|
172
|
+
Classifier: Programming Language :: Python
|
|
173
|
+
Classifier: Topic :: Scientific/Engineering :: GIS
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
CHANGES.txt
|
|
2
|
+
CREDITS.txt
|
|
3
|
+
HISTORY.txt
|
|
4
|
+
LICENSE.txt
|
|
5
|
+
README.txt
|
|
6
|
+
setup.py
|
|
7
|
+
setup_windows.py
|
|
8
|
+
Shapely.egg-info/PKG-INFO
|
|
9
|
+
Shapely.egg-info/SOURCES.txt
|
|
10
|
+
Shapely.egg-info/dependency_links.txt
|
|
11
|
+
Shapely.egg-info/requires.txt
|
|
12
|
+
Shapely.egg-info/top_level.txt
|
|
13
|
+
examples/geoms.py
|
|
14
|
+
examples/world.py
|
|
15
|
+
manual/manual.txt
|
|
16
|
+
manual/style.css
|
|
17
|
+
shapely/__init__.py
|
|
18
|
+
shapely/geos.py
|
|
19
|
+
shapely/iterops.py
|
|
20
|
+
shapely/kml.py
|
|
21
|
+
shapely/predicates.py
|
|
22
|
+
shapely/topology.py
|
|
23
|
+
shapely/wkb.py
|
|
24
|
+
shapely/wkt.py
|
|
25
|
+
shapely/geometry/__init__.py
|
|
26
|
+
shapely/geometry/base.py
|
|
27
|
+
shapely/geometry/collection.py
|
|
28
|
+
shapely/geometry/geo.py
|
|
29
|
+
shapely/geometry/linestring.py
|
|
30
|
+
shapely/geometry/multilinestring.py
|
|
31
|
+
shapely/geometry/multipoint.py
|
|
32
|
+
shapely/geometry/multipolygon.py
|
|
33
|
+
shapely/geometry/point.py
|
|
34
|
+
shapely/geometry/polygon.py
|
|
35
|
+
tests/Array.txt
|
|
36
|
+
tests/GeoInterface.txt
|
|
37
|
+
tests/IterOps.txt
|
|
38
|
+
tests/LineString.txt
|
|
39
|
+
tests/MultiLineString.txt
|
|
40
|
+
tests/MultiPoint.txt
|
|
41
|
+
tests/MultiPolygon.txt
|
|
42
|
+
tests/Operations.txt
|
|
43
|
+
tests/Persist.txt
|
|
44
|
+
tests/Point.txt
|
|
45
|
+
tests/Polygon.txt
|
|
46
|
+
tests/Predicates.txt
|
|
47
|
+
tests/__init__.py
|
|
48
|
+
tests/binascii_hex.txt
|
|
49
|
+
tests/invalid_intersection.txt
|
|
50
|
+
tests/rungrind.dist
|
|
51
|
+
tests/test_doctests.py
|
|
52
|
+
tests/valgrind-python.supp
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
shapely
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
from numpy import asarray
|
|
2
|
+
import pylab
|
|
3
|
+
from shapely.geometry import Point, LineString, Polygon
|
|
4
|
+
|
|
5
|
+
polygon = Polygon(((-1.0, -1.0), (-1.0, 1.0), (1.0, 1.0), (1.0, -1.0)))
|
|
6
|
+
|
|
7
|
+
point_r = Point(-1.5, 1.2)
|
|
8
|
+
point_g = Point(-1.0, 1.0)
|
|
9
|
+
point_b = Point(-0.5, 0.5)
|
|
10
|
+
|
|
11
|
+
line_r = LineString(((-0.5, 0.5), (0.5, 0.5)))
|
|
12
|
+
line_g = LineString(((1.0, -1.0), (1.8, 0.5)))
|
|
13
|
+
line_b = LineString(((-1.8, -1.2), (1.8, 0.5)))
|
|
14
|
+
|
|
15
|
+
def plot_point(g, o, l):
|
|
16
|
+
pylab.plot([g.x], [g.y], o, label=l)
|
|
17
|
+
|
|
18
|
+
def plot_line(g, o):
|
|
19
|
+
a = asarray(g)
|
|
20
|
+
pylab.plot(a[:,0], a[:,1], o)
|
|
21
|
+
|
|
22
|
+
def fill_polygon(g, o):
|
|
23
|
+
a = asarray(g.exterior)
|
|
24
|
+
pylab.fill(a[:,0], a[:,1], o, alpha=0.5)
|
|
25
|
+
|
|
26
|
+
def fill_multipolygon(g, o):
|
|
27
|
+
for g in g.geoms:
|
|
28
|
+
fill_polygon(g, o)
|
|
29
|
+
|
|
30
|
+
if __name__ == "__main__":
|
|
31
|
+
from numpy import asarray
|
|
32
|
+
import pylab
|
|
33
|
+
|
|
34
|
+
fig = pylab.figure(1, figsize=(4, 3), dpi=150)
|
|
35
|
+
#pylab.axis([-2.0, 2.0, -1.5, 1.5])
|
|
36
|
+
pylab.axis('tight')
|
|
37
|
+
|
|
38
|
+
a = asarray(polygon.exterior)
|
|
39
|
+
pylab.fill(a[:,0], a[:,1], 'c')
|
|
40
|
+
|
|
41
|
+
plot_point(point_r, 'ro', 'b')
|
|
42
|
+
plot_point(point_g, 'go', 'c')
|
|
43
|
+
plot_point(point_b, 'bo', 'd')
|
|
44
|
+
|
|
45
|
+
plot_line(line_r, 'r')
|
|
46
|
+
plot_line(line_g, 'g')
|
|
47
|
+
plot_line(line_b, 'b')
|
|
48
|
+
|
|
49
|
+
pylab.show()
|
|
50
|
+
|
|
51
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import ogr
|
|
2
|
+
import pylab
|
|
3
|
+
from numpy import asarray
|
|
4
|
+
|
|
5
|
+
from shapely.wkb import loads
|
|
6
|
+
|
|
7
|
+
source = ogr.Open("/var/gis/data/world/world_borders.shp")
|
|
8
|
+
borders = source.GetLayerByName("world_borders")
|
|
9
|
+
|
|
10
|
+
fig = pylab.figure(1, figsize=(4,2), dpi=300)
|
|
11
|
+
|
|
12
|
+
while 1:
|
|
13
|
+
feature = borders.GetNextFeature()
|
|
14
|
+
if not feature:
|
|
15
|
+
break
|
|
16
|
+
|
|
17
|
+
geom = loads(feature.GetGeometryRef().ExportToWkb())
|
|
18
|
+
a = asarray(geom)
|
|
19
|
+
pylab.plot(a[:,0], a[:,1])
|
|
20
|
+
|
|
21
|
+
pylab.show()
|