shapely 1.0.15__tar.gz → 1.2b1__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.15 → Shapely-1.2b1}/CHANGES.txt +39 -6
- {Shapely-1.0.15 → Shapely-1.2b1}/CREDITS.txt +2 -2
- Shapely-1.2b1/MANIFEST.in +3 -0
- Shapely-1.2b1/PKG-INFO +166 -0
- Shapely-1.2b1/README.txt +148 -0
- Shapely-1.2b1/Shapely.egg-info/PKG-INFO +166 -0
- Shapely-1.2b1/Shapely.egg-info/SOURCES.txt +65 -0
- Shapely-1.2b1/examples/dissolve.py +52 -0
- Shapely-1.2b1/examples/intersect.py +80 -0
- Shapely-1.2b1/setup.cfg +15 -0
- Shapely-1.2b1/setup.py +49 -0
- Shapely-1.2b1/shapely/__init__.py +1 -0
- Shapely-1.2b1/shapely/coords.py +165 -0
- {Shapely-1.0.15 → Shapely-1.2b1}/shapely/ctypes_declarations.py +79 -18
- {Shapely-1.0.15 → Shapely-1.2b1}/shapely/geometry/__init__.py +12 -0
- Shapely-1.2b1/shapely/geometry/base.py +541 -0
- {Shapely-1.0.15 → Shapely-1.2b1}/shapely/geometry/collection.py +9 -5
- {Shapely-1.0.15 → Shapely-1.2b1}/shapely/geometry/geo.py +4 -4
- {Shapely-1.0.15 → Shapely-1.2b1}/shapely/geometry/linestring.py +57 -30
- {Shapely-1.0.15 → Shapely-1.2b1}/shapely/geometry/multilinestring.py +18 -36
- {Shapely-1.0.15 → Shapely-1.2b1}/shapely/geometry/multipoint.py +31 -38
- {Shapely-1.0.15 → Shapely-1.2b1}/shapely/geometry/multipolygon.py +31 -45
- {Shapely-1.0.15 → Shapely-1.2b1}/shapely/geometry/point.py +37 -46
- {Shapely-1.0.15 → Shapely-1.2b1}/shapely/geometry/polygon.py +61 -35
- {Shapely-1.0.15 → Shapely-1.2b1}/shapely/geometry/proxy.py +1 -2
- Shapely-1.2b1/shapely/geoms.py +77 -0
- Shapely-1.2b1/shapely/geos.py +348 -0
- Shapely-1.2b1/shapely/impl.py +82 -0
- {Shapely-1.0.15 → Shapely-1.2b1}/shapely/iterops.py +6 -5
- Shapely-1.2b1/shapely/linref.py +26 -0
- Shapely-1.2b1/shapely/ops.py +80 -0
- Shapely-1.2b1/shapely/predicates.py +24 -0
- Shapely-1.2b1/shapely/prepared.py +54 -0
- {Shapely-1.0.15 → Shapely-1.2b1/shapely}/tests/Operations.txt +16 -0
- Shapely-1.2b1/shapely/tests/__init__.py +13 -0
- {Shapely-1.0.15 → Shapely-1.2b1/shapely}/tests/attribute-chains.txt +12 -4
- {Shapely-1.0.15 → Shapely-1.2b1/shapely}/tests/invalid_intersection.txt +3 -3
- Shapely-1.2b1/shapely/tests/linear-referencing.txt +58 -0
- Shapely-1.2b1/shapely/tests/linemerge.txt +61 -0
- Shapely-1.2b1/shapely/tests/test_doctests.py +35 -0
- Shapely-1.2b1/shapely/tests/test_equality.py +30 -0
- Shapely-1.2b1/shapely/tests/test_geomseq.py +14 -0
- Shapely-1.2b1/shapely/tests/test_prepared.py +15 -0
- Shapely-1.2b1/shapely/tests/test_xy.py +14 -0
- Shapely-1.2b1/shapely/tests/threading_test.py +37 -0
- Shapely-1.2b1/shapely/topology.py +62 -0
- Shapely-1.2b1/shapely/wkb.py +39 -0
- {Shapely-1.0.15 → Shapely-1.2b1}/shapely/wkt.py +7 -13
- Shapely-1.0.15/._CHANGES.txt +0 -0
- Shapely-1.0.15/._CREDITS.txt +0 -0
- Shapely-1.0.15/._HISTORY.txt +0 -0
- Shapely-1.0.15/._LICENSE.txt +0 -0
- Shapely-1.0.15/._MANIFEST.in +0 -0
- Shapely-1.0.15/._README.txt +0 -0
- Shapely-1.0.15/GEOS-C-API.txt +0 -55
- Shapely-1.0.15/HISTORY.txt +0 -24
- Shapely-1.0.15/MANIFEST.in +0 -2
- Shapely-1.0.15/PKG-INFO +0 -176
- Shapely-1.0.15/README.txt +0 -158
- Shapely-1.0.15/Shapely.egg-info/PKG-INFO +0 -176
- Shapely-1.0.15/Shapely.egg-info/SOURCES.txt +0 -54
- Shapely-1.0.15/Shapely.egg-info/requires.txt +0 -1
- Shapely-1.0.15/examples/._geoms.py +0 -0
- Shapely-1.0.15/examples/._world.py +0 -0
- Shapely-1.0.15/examples/geoms.py +0 -51
- Shapely-1.0.15/examples/world.py +0 -21
- Shapely-1.0.15/manual/manual.txt +0 -875
- Shapely-1.0.15/setup.cfg +0 -5
- Shapely-1.0.15/setup.py +0 -36
- Shapely-1.0.15/shapely/.___init__.py +0 -0
- Shapely-1.0.15/shapely/._ctypes_declarations.py +0 -0
- Shapely-1.0.15/shapely/._iterops.py +0 -0
- Shapely-1.0.15/shapely/._ops.py +0 -0
- Shapely-1.0.15/shapely/._predicates.py +0 -0
- Shapely-1.0.15/shapely/._topology.py +0 -0
- Shapely-1.0.15/shapely/._wkb.py +0 -0
- Shapely-1.0.15/shapely/__init__.py +0 -1
- Shapely-1.0.15/shapely/geometry/._base.py +0 -0
- Shapely-1.0.15/shapely/geometry/._linestring.py +0 -0
- Shapely-1.0.15/shapely/geometry/base.py +0 -508
- Shapely-1.0.15/shapely/geos.py +0 -126
- Shapely-1.0.15/shapely/ops.py +0 -29
- Shapely-1.0.15/shapely/predicates.py +0 -65
- Shapely-1.0.15/shapely/topology.py +0 -74
- Shapely-1.0.15/shapely/wkb.py +0 -42
- Shapely-1.0.15/tests/._Array.txt +0 -0
- Shapely-1.0.15/tests/._GeoInterface.txt +0 -0
- Shapely-1.0.15/tests/._Persist.txt +0 -0
- Shapely-1.0.15/tests/._Point.txt +0 -0
- Shapely-1.0.15/tests/._Predicates.txt +0 -0
- Shapely-1.0.15/tests/._binascii_hex.txt +0 -0
- {Shapely-1.0.15 → Shapely-1.2b1}/LICENSE.txt +0 -0
- {Shapely-1.0.15 → Shapely-1.2b1}/Shapely.egg-info/dependency_links.txt +0 -0
- {Shapely-1.0.15 → Shapely-1.2b1}/Shapely.egg-info/top_level.txt +0 -0
- {Shapely-1.0.15 → Shapely-1.2b1/shapely}/tests/Array.txt +0 -0
- {Shapely-1.0.15 → Shapely-1.2b1/shapely}/tests/GeoInterface.txt +0 -0
- {Shapely-1.0.15 → Shapely-1.2b1/shapely}/tests/IterOps.txt +0 -0
- {Shapely-1.0.15 → Shapely-1.2b1/shapely}/tests/LineString.txt +0 -0
- {Shapely-1.0.15 → Shapely-1.2b1/shapely}/tests/MultiLineString.txt +0 -0
- {Shapely-1.0.15 → Shapely-1.2b1/shapely}/tests/MultiPoint.txt +0 -0
- {Shapely-1.0.15 → Shapely-1.2b1/shapely}/tests/MultiPolygon.txt +0 -0
- {Shapely-1.0.15 → Shapely-1.2b1/shapely}/tests/Persist.txt +0 -0
- {Shapely-1.0.15 → Shapely-1.2b1/shapely}/tests/Point.txt +0 -0
- {Shapely-1.0.15 → Shapely-1.2b1/shapely}/tests/Polygon.txt +0 -0
- {Shapely-1.0.15 → Shapely-1.2b1/shapely}/tests/Predicates.txt +0 -0
- {Shapely-1.0.15 → Shapely-1.2b1/shapely}/tests/binascii_hex.txt +0 -0
- {Shapely-1.0.15 → Shapely-1.2b1/shapely}/tests/dimensions.txt +0 -0
- {Shapely-1.0.15 → Shapely-1.2b1/shapely}/tests/polygonize.txt +0 -0
- {Shapely-1.0.15 → Shapely-1.2b1/shapely}/tests/wkt_locale.txt +0 -0
|
@@ -1,15 +1,28 @@
|
|
|
1
1
|
All tickets are children of http://trac.gispython.org/lab/ticket.
|
|
2
2
|
|
|
3
|
-
1.
|
|
4
|
-
|
|
3
|
+
1.2b1 (2010-02-18)
|
|
4
|
+
------------------
|
|
5
|
+
- Update the README. Remove cruft from setup.py. Add some version 1.2 metadata
|
|
6
|
+
regarding required Python version (>=2.5,<3) and external dependency
|
|
7
|
+
(libgeos_c >= 3.1).
|
|
8
|
+
|
|
9
|
+
1.2a6 (2010-02-09)
|
|
10
|
+
------------------
|
|
11
|
+
- Add accessor for separate arrays of X and Y values (#210).
|
|
12
|
+
|
|
13
|
+
TODO: fill gap here
|
|
14
|
+
|
|
15
|
+
1.2a1 (2010-01-20)
|
|
16
|
+
------------------
|
|
5
17
|
- Proper prototyping of WKB writer, and avoidance of errors on 64-bit systems
|
|
6
18
|
(#191).
|
|
7
|
-
|
|
8
|
-
1.0.13 (2009-09-29)
|
|
9
|
-
-------------------
|
|
10
19
|
- Prototype libgeos_c functions in a way that lets py2exe apps import shapely
|
|
11
20
|
(#189).
|
|
12
|
-
|
|
21
|
+
|
|
22
|
+
=========================
|
|
23
|
+
1.2 Branched (2009-09-19)
|
|
24
|
+
=========================
|
|
25
|
+
|
|
13
26
|
1.0.12 (2009-04-09)
|
|
14
27
|
-------------------
|
|
15
28
|
- Fix for references held by topology and predicate descriptors.
|
|
@@ -65,3 +78,23 @@ All tickets are children of http://trac.gispython.org/lab/ticket.
|
|
|
65
78
|
1.0.2 (2008-02-26)
|
|
66
79
|
------------------
|
|
67
80
|
- Fix loss of dimensionality in polygon rings (#155).
|
|
81
|
+
|
|
82
|
+
1.0.1 (2008-02-08)
|
|
83
|
+
------------------
|
|
84
|
+
- Allow chaining expressions involving coordinate sequences and geometry parts
|
|
85
|
+
(#151).
|
|
86
|
+
- Protect against abnormal use of coordinate accessors (#152).
|
|
87
|
+
- Coordinate sequences now implement the numpy array protocol (#153).
|
|
88
|
+
|
|
89
|
+
1.0 (2008-01-18)
|
|
90
|
+
----------------
|
|
91
|
+
- Final release.
|
|
92
|
+
|
|
93
|
+
1.0 RC2 (2008-01-16)
|
|
94
|
+
--------------------
|
|
95
|
+
- Added temporary solution for #149.
|
|
96
|
+
|
|
97
|
+
1.0 RC1 (2008-01-14)
|
|
98
|
+
--------------------
|
|
99
|
+
- First release candidate
|
|
100
|
+
|
|
@@ -5,5 +5,5 @@ Frédéric Junod (Camptocamp SA)
|
|
|
5
5
|
Eric Lemoine (Camptocamp SA)
|
|
6
6
|
Justin Bronn (GeoDjango) for ctypes inspiration
|
|
7
7
|
|
|
8
|
-
Some of this work was supported by a grant from the U.S. National Endowment
|
|
9
|
-
|
|
8
|
+
Some of this work was supported by a grant from the U.S. National Endowment for
|
|
9
|
+
the Humanities (http://www.neh.gov).
|
Shapely-1.2b1/PKG-INFO
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
Metadata-Version: 1.0
|
|
2
|
+
Name: Shapely
|
|
3
|
+
Version: 1.2b1
|
|
4
|
+
Summary: Planar geometries, predicates, and operations
|
|
5
|
+
Home-page: http://trac.gispython.org/lab/wiki/Shapely
|
|
6
|
+
Author: Sean Gillies
|
|
7
|
+
Author-email: sean.gillies@gmail.com
|
|
8
|
+
License: BSD
|
|
9
|
+
Description:
|
|
10
|
+
Shapely
|
|
11
|
+
=======
|
|
12
|
+
|
|
13
|
+
.. image:: http://trac.gispython.org/lab/raw-attachment/wiki/Examples/dissolve.png
|
|
14
|
+
:width: 400
|
|
15
|
+
:height: 400
|
|
16
|
+
|
|
17
|
+
.. image:: http://trac.gispython.org/lab/raw-attachment/wiki/Examples/intersect.png
|
|
18
|
+
:width: 400
|
|
19
|
+
:height: 400
|
|
20
|
+
|
|
21
|
+
Shapely is a BSD-licensed Python package for manipulation and analysis of
|
|
22
|
+
planar geometries. It is not concerned with data formats or coordinate
|
|
23
|
+
systems. It is based on the widely deployed GEOS_ (the engine of PostGIS_) and
|
|
24
|
+
JTS_ (from which GEOS is ported) libraries. This C dependency is traded for the
|
|
25
|
+
ability to analyze geometries with blazing speed.
|
|
26
|
+
|
|
27
|
+
In a nutshell: Shapely lets you do PostGIS-ish stuff outside the context of a
|
|
28
|
+
database using idiomatic Python. For more details, see:
|
|
29
|
+
|
|
30
|
+
* Shapely wiki_
|
|
31
|
+
* Shapely manual_
|
|
32
|
+
* Shapely `example apps`_
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
Dependencies
|
|
36
|
+
------------
|
|
37
|
+
|
|
38
|
+
Shapely 1.2 depends on:
|
|
39
|
+
|
|
40
|
+
* Python >=2.5,<3
|
|
41
|
+
* libgeos_c >=3.1 (3.0 and below have not been tested, YMMV)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
Installation
|
|
45
|
+
------------
|
|
46
|
+
|
|
47
|
+
Windows users should use the executable installer, which contains the required
|
|
48
|
+
GEOS DLL. Other users should acquire libgeos_c by any means, make sure that it
|
|
49
|
+
is on the system library path, and install from the Python package index::
|
|
50
|
+
|
|
51
|
+
$ pip install Shapely
|
|
52
|
+
|
|
53
|
+
or from a source distribution with the setup script::
|
|
54
|
+
|
|
55
|
+
$ python setup.py install
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
Usage
|
|
59
|
+
-----
|
|
60
|
+
|
|
61
|
+
Here is the canonical example of building an approximately circular patch by
|
|
62
|
+
buffering a point::
|
|
63
|
+
|
|
64
|
+
>>> from shapely.geometry import Point
|
|
65
|
+
>>> patch = Point(0.0, 0.0).buffer(10.0)
|
|
66
|
+
>>> patch
|
|
67
|
+
<shapely.geometry.polygon.Polygon object at 0x...>
|
|
68
|
+
>>> patch.area
|
|
69
|
+
313.65484905459385
|
|
70
|
+
|
|
71
|
+
See the manual_ for comprehensive usage snippets and the dissolve.py and
|
|
72
|
+
intersect.py `example apps`_.
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
Numpy integration
|
|
76
|
+
-----------------
|
|
77
|
+
|
|
78
|
+
All linear geometries, such as the rings of a polygon, provide the Numpy array
|
|
79
|
+
interface::
|
|
80
|
+
|
|
81
|
+
>>> from numpy import asarray
|
|
82
|
+
>>> ag = asarray(patch.exterior)
|
|
83
|
+
>>> ag
|
|
84
|
+
array([[ 1.00000000e+01, 0.00000000e+00],
|
|
85
|
+
[ 9.95184727e+00, -9.80171403e-01],
|
|
86
|
+
[ 9.80785280e+00, -1.95090322e+00],
|
|
87
|
+
...
|
|
88
|
+
[ 1.00000000e+01, 0.00000000e+00]])
|
|
89
|
+
|
|
90
|
+
That yields a numpy array of [x, y] arrays. This is not exactly what one wants
|
|
91
|
+
for plotting shapes with Matplotlib, so Shapely 1.2 adds a `xy` geometry
|
|
92
|
+
property for getting separate arrays of coordinate x and y values::
|
|
93
|
+
|
|
94
|
+
>>> x, y = patch.exterior.xy
|
|
95
|
+
>>> ax = asarray(x)
|
|
96
|
+
>>> ax
|
|
97
|
+
array([ 1.00000000e+01, 9.95184727e+00, 9.80785280e+00, ...])
|
|
98
|
+
|
|
99
|
+
Numpy arrays can also be adapted to Shapely linestrings::
|
|
100
|
+
|
|
101
|
+
>>> from shapely.geometry import asLineString
|
|
102
|
+
>>> asLineString(ag).length
|
|
103
|
+
62.806623139095073
|
|
104
|
+
>>> asLineString(ag).wkt
|
|
105
|
+
'LINESTRING (10.0000000000000000 0.0000000000000000, ...)'
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
Testing
|
|
109
|
+
-------
|
|
110
|
+
|
|
111
|
+
Shapely uses a Zope-stye suite of unittests and doctests, excercised like::
|
|
112
|
+
|
|
113
|
+
$ python setup.py test
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
Support
|
|
117
|
+
-------
|
|
118
|
+
|
|
119
|
+
For current information about this project, see the wiki_.
|
|
120
|
+
|
|
121
|
+
If you have questions, please consider joining our community list:
|
|
122
|
+
|
|
123
|
+
http://trac.gispython.org/projects/PCL/wiki/CommunityList
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
Credits
|
|
127
|
+
-------
|
|
128
|
+
|
|
129
|
+
Shapely is written by:
|
|
130
|
+
|
|
131
|
+
* Sean Gillies (Pleiades)
|
|
132
|
+
* Aron Bierbaum
|
|
133
|
+
* Howard Butler (Hobu, Inc.)
|
|
134
|
+
* Kai Lautaportti (Hexagon IT)
|
|
135
|
+
* Fr |eaigue| d |eaigue| ric Junod (Camptocamp SA)
|
|
136
|
+
* Eric Lemoine (Camptocamp SA)
|
|
137
|
+
|
|
138
|
+
with additional help from:
|
|
139
|
+
|
|
140
|
+
* Justin Bronn (GeoDjango) for ctypes inspiration
|
|
141
|
+
* Martin Davis (JTS)
|
|
142
|
+
* Sandro Santilli, Mateusz Loskot, Paul Ramsey, et al (GEOS Project)
|
|
143
|
+
|
|
144
|
+
Major portions of this work were supported by a grant (for Pleiades_) from the
|
|
145
|
+
U.S. National Endowment for the Humanities (http://www.neh.gov).
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
.. _JTS: http://www.vividsolutions.com/jts/jtshome.htm
|
|
149
|
+
.. _PostGIS: http://postgis.org
|
|
150
|
+
.. _GEOS: http://trac.osgeo.org/geos/
|
|
151
|
+
.. _example apps: http://trac.gispython.org/lab/wiki/Examples
|
|
152
|
+
.. _wiki: http://trac.gispython.org/projects/PCL/wiki/Shapely
|
|
153
|
+
.. _manual: http://gispython.org/shapely/manual.html
|
|
154
|
+
.. |eaigue| unicode:: U+00E9
|
|
155
|
+
:trim:
|
|
156
|
+
.. _Pleiades: http://pleiades.stoa.org
|
|
157
|
+
|
|
158
|
+
Keywords: geometry topology gis
|
|
159
|
+
Platform: UNKNOWN
|
|
160
|
+
Classifier: Development Status :: 4 - Beta
|
|
161
|
+
Classifier: Intended Audience :: Developers
|
|
162
|
+
Classifier: Intended Audience :: Science/Research
|
|
163
|
+
Classifier: License :: OSI Approved :: BSD License
|
|
164
|
+
Classifier: Operating System :: OS Independent
|
|
165
|
+
Classifier: Programming Language :: Python
|
|
166
|
+
Classifier: Topic :: Scientific/Engineering :: GIS
|
Shapely-1.2b1/README.txt
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
|
|
2
|
+
Shapely
|
|
3
|
+
=======
|
|
4
|
+
|
|
5
|
+
.. image:: http://trac.gispython.org/lab/raw-attachment/wiki/Examples/dissolve.png
|
|
6
|
+
:width: 400
|
|
7
|
+
:height: 400
|
|
8
|
+
|
|
9
|
+
.. image:: http://trac.gispython.org/lab/raw-attachment/wiki/Examples/intersect.png
|
|
10
|
+
:width: 400
|
|
11
|
+
:height: 400
|
|
12
|
+
|
|
13
|
+
Shapely is a BSD-licensed Python package for manipulation and analysis of
|
|
14
|
+
planar geometries. It is not concerned with data formats or coordinate
|
|
15
|
+
systems. It is based on the widely deployed GEOS_ (the engine of PostGIS_) and
|
|
16
|
+
JTS_ (from which GEOS is ported) libraries. This C dependency is traded for the
|
|
17
|
+
ability to analyze geometries with blazing speed.
|
|
18
|
+
|
|
19
|
+
In a nutshell: Shapely lets you do PostGIS-ish stuff outside the context of a
|
|
20
|
+
database using idiomatic Python. For more details, see:
|
|
21
|
+
|
|
22
|
+
* Shapely wiki_
|
|
23
|
+
* Shapely manual_
|
|
24
|
+
* Shapely `example apps`_
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
Dependencies
|
|
28
|
+
------------
|
|
29
|
+
|
|
30
|
+
Shapely 1.2 depends on:
|
|
31
|
+
|
|
32
|
+
* Python >=2.5,<3
|
|
33
|
+
* libgeos_c >=3.1 (3.0 and below have not been tested, YMMV)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
Installation
|
|
37
|
+
------------
|
|
38
|
+
|
|
39
|
+
Windows users should use the executable installer, which contains the required
|
|
40
|
+
GEOS DLL. Other users should acquire libgeos_c by any means, make sure that it
|
|
41
|
+
is on the system library path, and install from the Python package index::
|
|
42
|
+
|
|
43
|
+
$ pip install Shapely
|
|
44
|
+
|
|
45
|
+
or from a source distribution with the setup script::
|
|
46
|
+
|
|
47
|
+
$ python setup.py install
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
Usage
|
|
51
|
+
-----
|
|
52
|
+
|
|
53
|
+
Here is the canonical example of building an approximately circular patch by
|
|
54
|
+
buffering a point::
|
|
55
|
+
|
|
56
|
+
>>> from shapely.geometry import Point
|
|
57
|
+
>>> patch = Point(0.0, 0.0).buffer(10.0)
|
|
58
|
+
>>> patch
|
|
59
|
+
<shapely.geometry.polygon.Polygon object at 0x...>
|
|
60
|
+
>>> patch.area
|
|
61
|
+
313.65484905459385
|
|
62
|
+
|
|
63
|
+
See the manual_ for comprehensive usage snippets and the dissolve.py and
|
|
64
|
+
intersect.py `example apps`_.
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
Numpy integration
|
|
68
|
+
-----------------
|
|
69
|
+
|
|
70
|
+
All linear geometries, such as the rings of a polygon, provide the Numpy array
|
|
71
|
+
interface::
|
|
72
|
+
|
|
73
|
+
>>> from numpy import asarray
|
|
74
|
+
>>> ag = asarray(patch.exterior)
|
|
75
|
+
>>> ag
|
|
76
|
+
array([[ 1.00000000e+01, 0.00000000e+00],
|
|
77
|
+
[ 9.95184727e+00, -9.80171403e-01],
|
|
78
|
+
[ 9.80785280e+00, -1.95090322e+00],
|
|
79
|
+
...
|
|
80
|
+
[ 1.00000000e+01, 0.00000000e+00]])
|
|
81
|
+
|
|
82
|
+
That yields a numpy array of [x, y] arrays. This is not exactly what one wants
|
|
83
|
+
for plotting shapes with Matplotlib, so Shapely 1.2 adds a `xy` geometry
|
|
84
|
+
property for getting separate arrays of coordinate x and y values::
|
|
85
|
+
|
|
86
|
+
>>> x, y = patch.exterior.xy
|
|
87
|
+
>>> ax = asarray(x)
|
|
88
|
+
>>> ax
|
|
89
|
+
array([ 1.00000000e+01, 9.95184727e+00, 9.80785280e+00, ...])
|
|
90
|
+
|
|
91
|
+
Numpy arrays can also be adapted to Shapely linestrings::
|
|
92
|
+
|
|
93
|
+
>>> from shapely.geometry import asLineString
|
|
94
|
+
>>> asLineString(ag).length
|
|
95
|
+
62.806623139095073
|
|
96
|
+
>>> asLineString(ag).wkt
|
|
97
|
+
'LINESTRING (10.0000000000000000 0.0000000000000000, ...)'
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
Testing
|
|
101
|
+
-------
|
|
102
|
+
|
|
103
|
+
Shapely uses a Zope-stye suite of unittests and doctests, excercised like::
|
|
104
|
+
|
|
105
|
+
$ python setup.py test
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
Support
|
|
109
|
+
-------
|
|
110
|
+
|
|
111
|
+
For current information about this project, see the wiki_.
|
|
112
|
+
|
|
113
|
+
If you have questions, please consider joining our community list:
|
|
114
|
+
|
|
115
|
+
http://trac.gispython.org/projects/PCL/wiki/CommunityList
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
Credits
|
|
119
|
+
-------
|
|
120
|
+
|
|
121
|
+
Shapely is written by:
|
|
122
|
+
|
|
123
|
+
* Sean Gillies (Pleiades)
|
|
124
|
+
* Aron Bierbaum
|
|
125
|
+
* Howard Butler (Hobu, Inc.)
|
|
126
|
+
* Kai Lautaportti (Hexagon IT)
|
|
127
|
+
* Fr |eaigue| d |eaigue| ric Junod (Camptocamp SA)
|
|
128
|
+
* Eric Lemoine (Camptocamp SA)
|
|
129
|
+
|
|
130
|
+
with additional help from:
|
|
131
|
+
|
|
132
|
+
* Justin Bronn (GeoDjango) for ctypes inspiration
|
|
133
|
+
* Martin Davis (JTS)
|
|
134
|
+
* Sandro Santilli, Mateusz Loskot, Paul Ramsey, et al (GEOS Project)
|
|
135
|
+
|
|
136
|
+
Major portions of this work were supported by a grant (for Pleiades_) from the
|
|
137
|
+
U.S. National Endowment for the Humanities (http://www.neh.gov).
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
.. _JTS: http://www.vividsolutions.com/jts/jtshome.htm
|
|
141
|
+
.. _PostGIS: http://postgis.org
|
|
142
|
+
.. _GEOS: http://trac.osgeo.org/geos/
|
|
143
|
+
.. _example apps: http://trac.gispython.org/lab/wiki/Examples
|
|
144
|
+
.. _wiki: http://trac.gispython.org/projects/PCL/wiki/Shapely
|
|
145
|
+
.. _manual: http://gispython.org/shapely/manual.html
|
|
146
|
+
.. |eaigue| unicode:: U+00E9
|
|
147
|
+
:trim:
|
|
148
|
+
.. _Pleiades: http://pleiades.stoa.org
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
Metadata-Version: 1.0
|
|
2
|
+
Name: Shapely
|
|
3
|
+
Version: 1.2b1
|
|
4
|
+
Summary: Planar geometries, predicates, and operations
|
|
5
|
+
Home-page: http://trac.gispython.org/lab/wiki/Shapely
|
|
6
|
+
Author: Sean Gillies
|
|
7
|
+
Author-email: sean.gillies@gmail.com
|
|
8
|
+
License: BSD
|
|
9
|
+
Description:
|
|
10
|
+
Shapely
|
|
11
|
+
=======
|
|
12
|
+
|
|
13
|
+
.. image:: http://trac.gispython.org/lab/raw-attachment/wiki/Examples/dissolve.png
|
|
14
|
+
:width: 400
|
|
15
|
+
:height: 400
|
|
16
|
+
|
|
17
|
+
.. image:: http://trac.gispython.org/lab/raw-attachment/wiki/Examples/intersect.png
|
|
18
|
+
:width: 400
|
|
19
|
+
:height: 400
|
|
20
|
+
|
|
21
|
+
Shapely is a BSD-licensed Python package for manipulation and analysis of
|
|
22
|
+
planar geometries. It is not concerned with data formats or coordinate
|
|
23
|
+
systems. It is based on the widely deployed GEOS_ (the engine of PostGIS_) and
|
|
24
|
+
JTS_ (from which GEOS is ported) libraries. This C dependency is traded for the
|
|
25
|
+
ability to analyze geometries with blazing speed.
|
|
26
|
+
|
|
27
|
+
In a nutshell: Shapely lets you do PostGIS-ish stuff outside the context of a
|
|
28
|
+
database using idiomatic Python. For more details, see:
|
|
29
|
+
|
|
30
|
+
* Shapely wiki_
|
|
31
|
+
* Shapely manual_
|
|
32
|
+
* Shapely `example apps`_
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
Dependencies
|
|
36
|
+
------------
|
|
37
|
+
|
|
38
|
+
Shapely 1.2 depends on:
|
|
39
|
+
|
|
40
|
+
* Python >=2.5,<3
|
|
41
|
+
* libgeos_c >=3.1 (3.0 and below have not been tested, YMMV)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
Installation
|
|
45
|
+
------------
|
|
46
|
+
|
|
47
|
+
Windows users should use the executable installer, which contains the required
|
|
48
|
+
GEOS DLL. Other users should acquire libgeos_c by any means, make sure that it
|
|
49
|
+
is on the system library path, and install from the Python package index::
|
|
50
|
+
|
|
51
|
+
$ pip install Shapely
|
|
52
|
+
|
|
53
|
+
or from a source distribution with the setup script::
|
|
54
|
+
|
|
55
|
+
$ python setup.py install
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
Usage
|
|
59
|
+
-----
|
|
60
|
+
|
|
61
|
+
Here is the canonical example of building an approximately circular patch by
|
|
62
|
+
buffering a point::
|
|
63
|
+
|
|
64
|
+
>>> from shapely.geometry import Point
|
|
65
|
+
>>> patch = Point(0.0, 0.0).buffer(10.0)
|
|
66
|
+
>>> patch
|
|
67
|
+
<shapely.geometry.polygon.Polygon object at 0x...>
|
|
68
|
+
>>> patch.area
|
|
69
|
+
313.65484905459385
|
|
70
|
+
|
|
71
|
+
See the manual_ for comprehensive usage snippets and the dissolve.py and
|
|
72
|
+
intersect.py `example apps`_.
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
Numpy integration
|
|
76
|
+
-----------------
|
|
77
|
+
|
|
78
|
+
All linear geometries, such as the rings of a polygon, provide the Numpy array
|
|
79
|
+
interface::
|
|
80
|
+
|
|
81
|
+
>>> from numpy import asarray
|
|
82
|
+
>>> ag = asarray(patch.exterior)
|
|
83
|
+
>>> ag
|
|
84
|
+
array([[ 1.00000000e+01, 0.00000000e+00],
|
|
85
|
+
[ 9.95184727e+00, -9.80171403e-01],
|
|
86
|
+
[ 9.80785280e+00, -1.95090322e+00],
|
|
87
|
+
...
|
|
88
|
+
[ 1.00000000e+01, 0.00000000e+00]])
|
|
89
|
+
|
|
90
|
+
That yields a numpy array of [x, y] arrays. This is not exactly what one wants
|
|
91
|
+
for plotting shapes with Matplotlib, so Shapely 1.2 adds a `xy` geometry
|
|
92
|
+
property for getting separate arrays of coordinate x and y values::
|
|
93
|
+
|
|
94
|
+
>>> x, y = patch.exterior.xy
|
|
95
|
+
>>> ax = asarray(x)
|
|
96
|
+
>>> ax
|
|
97
|
+
array([ 1.00000000e+01, 9.95184727e+00, 9.80785280e+00, ...])
|
|
98
|
+
|
|
99
|
+
Numpy arrays can also be adapted to Shapely linestrings::
|
|
100
|
+
|
|
101
|
+
>>> from shapely.geometry import asLineString
|
|
102
|
+
>>> asLineString(ag).length
|
|
103
|
+
62.806623139095073
|
|
104
|
+
>>> asLineString(ag).wkt
|
|
105
|
+
'LINESTRING (10.0000000000000000 0.0000000000000000, ...)'
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
Testing
|
|
109
|
+
-------
|
|
110
|
+
|
|
111
|
+
Shapely uses a Zope-stye suite of unittests and doctests, excercised like::
|
|
112
|
+
|
|
113
|
+
$ python setup.py test
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
Support
|
|
117
|
+
-------
|
|
118
|
+
|
|
119
|
+
For current information about this project, see the wiki_.
|
|
120
|
+
|
|
121
|
+
If you have questions, please consider joining our community list:
|
|
122
|
+
|
|
123
|
+
http://trac.gispython.org/projects/PCL/wiki/CommunityList
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
Credits
|
|
127
|
+
-------
|
|
128
|
+
|
|
129
|
+
Shapely is written by:
|
|
130
|
+
|
|
131
|
+
* Sean Gillies (Pleiades)
|
|
132
|
+
* Aron Bierbaum
|
|
133
|
+
* Howard Butler (Hobu, Inc.)
|
|
134
|
+
* Kai Lautaportti (Hexagon IT)
|
|
135
|
+
* Fr |eaigue| d |eaigue| ric Junod (Camptocamp SA)
|
|
136
|
+
* Eric Lemoine (Camptocamp SA)
|
|
137
|
+
|
|
138
|
+
with additional help from:
|
|
139
|
+
|
|
140
|
+
* Justin Bronn (GeoDjango) for ctypes inspiration
|
|
141
|
+
* Martin Davis (JTS)
|
|
142
|
+
* Sandro Santilli, Mateusz Loskot, Paul Ramsey, et al (GEOS Project)
|
|
143
|
+
|
|
144
|
+
Major portions of this work were supported by a grant (for Pleiades_) from the
|
|
145
|
+
U.S. National Endowment for the Humanities (http://www.neh.gov).
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
.. _JTS: http://www.vividsolutions.com/jts/jtshome.htm
|
|
149
|
+
.. _PostGIS: http://postgis.org
|
|
150
|
+
.. _GEOS: http://trac.osgeo.org/geos/
|
|
151
|
+
.. _example apps: http://trac.gispython.org/lab/wiki/Examples
|
|
152
|
+
.. _wiki: http://trac.gispython.org/projects/PCL/wiki/Shapely
|
|
153
|
+
.. _manual: http://gispython.org/shapely/manual.html
|
|
154
|
+
.. |eaigue| unicode:: U+00E9
|
|
155
|
+
:trim:
|
|
156
|
+
.. _Pleiades: http://pleiades.stoa.org
|
|
157
|
+
|
|
158
|
+
Keywords: geometry topology gis
|
|
159
|
+
Platform: UNKNOWN
|
|
160
|
+
Classifier: Development Status :: 4 - Beta
|
|
161
|
+
Classifier: Intended Audience :: Developers
|
|
162
|
+
Classifier: Intended Audience :: Science/Research
|
|
163
|
+
Classifier: License :: OSI Approved :: BSD License
|
|
164
|
+
Classifier: Operating System :: OS Independent
|
|
165
|
+
Classifier: Programming Language :: Python
|
|
166
|
+
Classifier: Topic :: Scientific/Engineering :: GIS
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
CHANGES.txt
|
|
2
|
+
CREDITS.txt
|
|
3
|
+
LICENSE.txt
|
|
4
|
+
MANIFEST.in
|
|
5
|
+
README.txt
|
|
6
|
+
setup.cfg
|
|
7
|
+
setup.py
|
|
8
|
+
Shapely.egg-info/PKG-INFO
|
|
9
|
+
Shapely.egg-info/SOURCES.txt
|
|
10
|
+
Shapely.egg-info/dependency_links.txt
|
|
11
|
+
Shapely.egg-info/top_level.txt
|
|
12
|
+
examples/dissolve.py
|
|
13
|
+
examples/intersect.py
|
|
14
|
+
shapely/__init__.py
|
|
15
|
+
shapely/coords.py
|
|
16
|
+
shapely/ctypes_declarations.py
|
|
17
|
+
shapely/geoms.py
|
|
18
|
+
shapely/geos.py
|
|
19
|
+
shapely/impl.py
|
|
20
|
+
shapely/iterops.py
|
|
21
|
+
shapely/linref.py
|
|
22
|
+
shapely/ops.py
|
|
23
|
+
shapely/predicates.py
|
|
24
|
+
shapely/prepared.py
|
|
25
|
+
shapely/topology.py
|
|
26
|
+
shapely/wkb.py
|
|
27
|
+
shapely/wkt.py
|
|
28
|
+
shapely/geometry/__init__.py
|
|
29
|
+
shapely/geometry/base.py
|
|
30
|
+
shapely/geometry/collection.py
|
|
31
|
+
shapely/geometry/geo.py
|
|
32
|
+
shapely/geometry/linestring.py
|
|
33
|
+
shapely/geometry/multilinestring.py
|
|
34
|
+
shapely/geometry/multipoint.py
|
|
35
|
+
shapely/geometry/multipolygon.py
|
|
36
|
+
shapely/geometry/point.py
|
|
37
|
+
shapely/geometry/polygon.py
|
|
38
|
+
shapely/geometry/proxy.py
|
|
39
|
+
shapely/tests/Array.txt
|
|
40
|
+
shapely/tests/GeoInterface.txt
|
|
41
|
+
shapely/tests/IterOps.txt
|
|
42
|
+
shapely/tests/LineString.txt
|
|
43
|
+
shapely/tests/MultiLineString.txt
|
|
44
|
+
shapely/tests/MultiPoint.txt
|
|
45
|
+
shapely/tests/MultiPolygon.txt
|
|
46
|
+
shapely/tests/Operations.txt
|
|
47
|
+
shapely/tests/Persist.txt
|
|
48
|
+
shapely/tests/Point.txt
|
|
49
|
+
shapely/tests/Polygon.txt
|
|
50
|
+
shapely/tests/Predicates.txt
|
|
51
|
+
shapely/tests/__init__.py
|
|
52
|
+
shapely/tests/attribute-chains.txt
|
|
53
|
+
shapely/tests/binascii_hex.txt
|
|
54
|
+
shapely/tests/dimensions.txt
|
|
55
|
+
shapely/tests/invalid_intersection.txt
|
|
56
|
+
shapely/tests/linear-referencing.txt
|
|
57
|
+
shapely/tests/linemerge.txt
|
|
58
|
+
shapely/tests/polygonize.txt
|
|
59
|
+
shapely/tests/test_doctests.py
|
|
60
|
+
shapely/tests/test_equality.py
|
|
61
|
+
shapely/tests/test_geomseq.py
|
|
62
|
+
shapely/tests/test_prepared.py
|
|
63
|
+
shapely/tests/test_xy.py
|
|
64
|
+
shapely/tests/threading_test.py
|
|
65
|
+
shapely/tests/wkt_locale.txt
|
|
@@ -0,0 +1,52 @@
|
|
|
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
|
+
# Illustrate the results using matplotlib's pylab interface
|
|
27
|
+
pylab.figure(num=None, figsize=(4, 4), dpi=180)
|
|
28
|
+
|
|
29
|
+
for patch in patches.geoms:
|
|
30
|
+
assert patch.geom_type in ['Polygon']
|
|
31
|
+
assert patch.is_valid
|
|
32
|
+
|
|
33
|
+
# Fill and outline each patch
|
|
34
|
+
x, y = patch.exterior.xy
|
|
35
|
+
pylab.fill(x, y, color='#cccccc', aa=True)
|
|
36
|
+
pylab.plot(x, y, color='#666666', aa=True, lw=1.0)
|
|
37
|
+
|
|
38
|
+
# Do the same for the holes of the patch
|
|
39
|
+
for hole in patch.interiors:
|
|
40
|
+
x, y = hole.xy
|
|
41
|
+
pylab.fill(x, y, color='#ffffff', aa=True)
|
|
42
|
+
pylab.plot(x, y, color='#999999', aa=True, lw=1.0)
|
|
43
|
+
|
|
44
|
+
# Plot the original points
|
|
45
|
+
pylab.plot([p.x for p in points], [p.y for p in points], 'b,', alpha=0.75)
|
|
46
|
+
|
|
47
|
+
# Write the number of patches and the total patch area to the figure
|
|
48
|
+
pylab.text(-25, 25,
|
|
49
|
+
"Patches: %d, total area: %.2f" % (len(patches.geoms), patches.area))
|
|
50
|
+
|
|
51
|
+
pylab.savefig('dissolve.png')
|
|
52
|
+
|