mirror of
https://github.com/wassname/geopandas.git
synced 2026-09-11 12:10:59 +08:00
Update from docs branch
This commit is contained in:
+394
-1
@@ -1,8 +1,401 @@
|
||||
Documentation
|
||||
=============
|
||||
|
||||
Coming soon...
|
||||
GeoPandas implements two main data structures, a ``GeoSeries`` and a
|
||||
``GeoDataFrame``. These are subclasses of pandas ``Series`` and
|
||||
``DataFrame``, respectively.
|
||||
|
||||
GeoSeries
|
||||
---------
|
||||
|
||||
A ``GeoSeries`` contains a sequence of geometries.
|
||||
|
||||
The ``GeoSeries`` class implements nearly all of the attributes and
|
||||
methods of Shapely objects. When applied to a ``GeoSeries``, they
|
||||
will apply elementwise to all geometries in the series. Binary
|
||||
operations can be applied between two ``GeoSeries``, in which case the
|
||||
operation is carried out elementwise. The two series will be aligned
|
||||
by matching indices. Binary operations can also be applied to a
|
||||
single geometry, in which case the operation is carried out for each
|
||||
element of the series with that geometry. In either case, a
|
||||
``Series`` or a ``GeoSeries`` will be returned, as appropriate.
|
||||
|
||||
The following Shapely methods and attributes are available on
|
||||
``GeoSeries`` objects:
|
||||
|
||||
.. attribute:: GeoSeries.area
|
||||
|
||||
Returns a ``Series`` containing the area of each geometry in the ``GeoSeries``.
|
||||
|
||||
.. attribute:: GeoSeries.bounds
|
||||
|
||||
Returns a ``DataFrame`` with columns ``minx``, ``miny``, ``maxx``,
|
||||
``maxy`` values containing the bounds for each geometry.
|
||||
NOTE: This behavior may change in future versions.
|
||||
|
||||
.. attribute:: GeoSeries.length
|
||||
|
||||
Returns a ``Series`` containing the length of each geometry.
|
||||
|
||||
.. attribute:: GeoSeries.geom_type
|
||||
|
||||
Returns a ``Series`` of strings specifying the `Geometry Type` of
|
||||
each object.
|
||||
|
||||
.. method:: GeoSeries.distance(other)
|
||||
|
||||
Returns a ``Series`` containing the minimum distance to the `other`
|
||||
``GeoSeries`` (elementwise) or geometric object.
|
||||
|
||||
.. method:: GeoSeries.representative_point()
|
||||
|
||||
Returns a ``GeoSeries`` of (cheaply computed) points that are
|
||||
guaranteed to be within each geometry.
|
||||
|
||||
.. attribute:: GeoSeries.exterior
|
||||
|
||||
Returns a ``GeoSeries`` of LinearRings representing the outer
|
||||
boundary of each polygon in the GeoSeries. (Applies to GeoSeries
|
||||
containing only Polygons).
|
||||
|
||||
.. attribute:: GeoSeries.interiors
|
||||
|
||||
Returns a ``GeoSeries`` of InteriorRingSequences representing the
|
||||
inner rings of each polygon in the GeoSeries. (Applies to GeoSeries
|
||||
containing only Polygons).
|
||||
|
||||
`Unary Predicates`
|
||||
|
||||
.. attribute:: GeoSeries.is_empty
|
||||
|
||||
Returns a ``Series`` of ``dtype('bool')`` with value ``True`` for
|
||||
empty geometries.
|
||||
|
||||
.. attribute:: GeoSeries.is_ring
|
||||
|
||||
Returns a ``Series`` of ``dtype('bool')`` with value ``True`` for
|
||||
features that are closed.
|
||||
|
||||
.. attribute:: GeoSeries.is_simple
|
||||
|
||||
Returns a ``Series`` of ``dtype('bool')`` with value ``True`` for
|
||||
geometries that do not cross themselves (meaningful only for
|
||||
`LineStrings` and `LinearRings`).
|
||||
|
||||
.. attribute:: GeoSeries.is_valid
|
||||
|
||||
Returns a ``Series`` of ``dtype('bool')`` with value ``True`` for
|
||||
geometries that are valid.
|
||||
|
||||
`Binary Predicates`
|
||||
|
||||
.. method:: GeoSeries.almost_equals(other[, decimal=6])
|
||||
|
||||
Returns a ``Series`` of ``dtype('bool')`` with value ``True`` if
|
||||
each object is approximately equal to the `other` at all
|
||||
points to specified `decimal` place precision. (See also :meth:`equals`)
|
||||
|
||||
.. method:: GeoSeries.contains(other)
|
||||
|
||||
Returns a ``Series`` of ``dtype('bool')`` with value ``True`` if
|
||||
each object's `interior` contains the `boundary` and
|
||||
`interior` of the other object and their boundaries do not touch at all.
|
||||
|
||||
.. method:: GeoSeries.crosses(other)
|
||||
|
||||
Returns a ``Series`` of ``dtype('bool')`` with value ``True`` if
|
||||
the `interior` of each object intersects the `interior` of
|
||||
the other but does not contain it, and the dimension of the intersection is
|
||||
less than the dimension of the one or the other.
|
||||
|
||||
.. method:: GeoSeries.disjoint(other)
|
||||
|
||||
Returns a ``Series`` of ``dtype('bool')`` with value ``True`` if
|
||||
the `boundary` and `interior` of each object does not
|
||||
intersect at all with those of the other.
|
||||
|
||||
.. method:: GeoSeries.equals(other)
|
||||
|
||||
Returns a ``Series`` of ``dtype('bool')`` with value ``True`` if
|
||||
if the set-theoretic `boundary`, `interior`, and `exterior`
|
||||
of each object coincides with those of the other.
|
||||
|
||||
.. method:: GeoSeries.intersects(other)
|
||||
|
||||
Returns a ``Series`` of ``dtype('bool')`` with value ``True`` if
|
||||
if the `boundary` and `interior` of each object intersects in
|
||||
any way with those of the other.
|
||||
|
||||
.. method:: GeoSeries.touches(other)
|
||||
|
||||
Returns a ``Series`` of ``dtype('bool')`` with value ``True`` if
|
||||
the objects have at least one point in common and their
|
||||
interiors do not intersect with any part of the other.
|
||||
|
||||
.. method:: GeoSeries.within(other)
|
||||
|
||||
Returns a ``Series`` of ``dtype('bool')`` with value ``True`` if
|
||||
each object's `boundary` and `interior` intersect only
|
||||
with the `interior` of the other (not its `boundary` or `exterior`).
|
||||
(Inverse of :meth:`contains`)
|
||||
|
||||
`Set-theoretic Methods`
|
||||
|
||||
.. attribute:: GeoSeries.boundary
|
||||
|
||||
Returns a ``GeoSeries`` of lower dimensional objects representing
|
||||
each geometries's set-theoretic `boundary`.
|
||||
|
||||
.. attribute:: GeoSeries.centroid
|
||||
|
||||
Returns a ``GeoSeries`` of points for each geometric centroid.
|
||||
|
||||
.. method:: GeoSeries.difference(other)
|
||||
|
||||
Returns a ``GeoSeries`` of the points in each geometry that
|
||||
are not in the *other* object.
|
||||
|
||||
.. method:: GeoSeries.intersection(other)
|
||||
|
||||
Returns a ``GeoSeries`` of the intersection of each object with the `other`
|
||||
geometric object.
|
||||
|
||||
.. method:: GeoSeries.symmetric_difference(other)
|
||||
|
||||
Returns a ``GeoSeries`` of the points in each object not in the `other`
|
||||
geometric object, and the points in the `other` not in this object.
|
||||
|
||||
.. method:: GeoSeries.union(other)
|
||||
|
||||
Returns a ``GeoSeries`` of the union of points from each object and the
|
||||
`other` geometric object.
|
||||
|
||||
`Constructive Methods`
|
||||
|
||||
.. method:: GeoSeries.buffer(distance, resolution=16)
|
||||
|
||||
Returns a ``GeoSeries`` of geometries representing all points within a given `distance`
|
||||
of each geometric object.
|
||||
|
||||
.. attribute:: GeoSeries.convex_hull
|
||||
|
||||
Returns a ``GeoSeries`` of geometries representing the smallest
|
||||
convex `Polygon` containing all the points in each object unless the
|
||||
number of points in the object is less than three. For two points,
|
||||
the convex hull collapses to a `LineString`; for 1, a `Point`.
|
||||
|
||||
.. attribute:: GeoSeries.envelope
|
||||
|
||||
Returns a ``GeoSeries`` of geometries representing the point or
|
||||
smallest rectangular polygon (with sides parallel to the coordinate
|
||||
axes) that contains each object.
|
||||
|
||||
.. method:: GeoSeries.simplify(tolerance, preserve_topology=True)
|
||||
|
||||
Returns a ``GeoSeries`` containing a simplified representation of
|
||||
each object.
|
||||
|
||||
`Aggregating methods`
|
||||
|
||||
.. attribute:: GeoSeries.unary_union
|
||||
|
||||
Return a geometry containing the union of all geometries in the ``GeoSeries``.
|
||||
|
||||
Additionally, the following methods are implemented:
|
||||
|
||||
.. method:: GeoSeries.from_file()
|
||||
|
||||
Load a ``GeoSeries`` from a file from any format recognized by
|
||||
`fiona`_.
|
||||
|
||||
.. method:: GeoSeries.plot(colormap='Set1')
|
||||
|
||||
Generate a plot of the geometries in the ``GeoSeries``.
|
||||
``colormap`` can be any recognized by matplotlib, but discrete
|
||||
colormaps such as ``Accent``, ``Dark2``, ``Paired``, ``Pastel1``,
|
||||
``Pastel2``, ``Set1``, ``Set2``, or ``Set3`` are recommended.
|
||||
|
||||
Methods of pandas ``Series`` objects are also available, although not
|
||||
all are applicable to geometric objects and some may return a
|
||||
``Series`` rather than a ``GeoSeries`` result. The methods
|
||||
``copy()``, ``align()``, ``isnull()`` and ``fillna()`` have been
|
||||
implemented specifically for ``GeoSeries`` and are expected to work
|
||||
correctly.
|
||||
|
||||
GeoDataFrame
|
||||
------------
|
||||
|
||||
A ``GeoDataFrame`` is a tablular data structure that contains a column
|
||||
called ``geometry`` which contains a `GeoSeries``.
|
||||
|
||||
Currently only the following methods are implemented for a ``GeoDataFrame``:
|
||||
|
||||
.. method:: GeoDataFrame.from_file()
|
||||
|
||||
Load a ``GeoDataFrame`` from a file from any format recognized by
|
||||
`fiona`_.
|
||||
|
||||
.. method:: GeoDataFrame.plot()
|
||||
|
||||
Generate a plot of the geometries in the ``GeoDataFrame``.
|
||||
Currently calls ``GeoSeries.plot()`` on the ``geometry`` column,
|
||||
though in the future this will be able to color the geometries by
|
||||
data values from another column.
|
||||
|
||||
All pandas ``DataFrame`` methods are also available, although they may
|
||||
not operate in a meaningful way on the ``geometry`` column and may not
|
||||
return a ``GeoDataFrame`` result even when it would be appropriate to
|
||||
do so.
|
||||
|
||||
Examples
|
||||
--------
|
||||
|
||||
.. sourcecode:: python
|
||||
|
||||
>>> p1 = Polygon([(0, 0), (1, 0), (1, 1)])
|
||||
>>> p2 = Polygon([(0, 0), (1, 0), (1, 1), (0, 1)])
|
||||
>>> p3 = Polygon([(2, 0), (3, 0), (3, 1), (2, 1)])
|
||||
>>> g = GeoSeries([p1, p2, p3])
|
||||
>>> g
|
||||
0 POLYGON ((0.0000000000000000 0.000000000000000...
|
||||
1 POLYGON ((0.0000000000000000 0.000000000000000...
|
||||
2 POLYGON ((2.0000000000000000 0.000000000000000...
|
||||
dtype: object
|
||||
|
||||
.. image:: _static/test.png
|
||||
|
||||
Some geographic operations return normal pandas object. The ``area`` property of a ``GeoSeries`` will return a ``pandas.Series`` containing the area of each item in the ``GeoSeries``:
|
||||
|
||||
.. sourcecode:: python
|
||||
|
||||
>>> print g.area
|
||||
0 0.5
|
||||
1 1.0
|
||||
2 1.0
|
||||
dtype: float64
|
||||
|
||||
Other operations return GeoPandas objects:
|
||||
|
||||
.. sourcecode:: python
|
||||
|
||||
>>> g.buffer(0.5)
|
||||
Out[15]:
|
||||
0 POLYGON ((-0.3535533905932737 0.35355339059327...
|
||||
1 POLYGON ((-0.5000000000000000 0.00000000000000...
|
||||
2 POLYGON ((1.5000000000000000 0.000000000000000...
|
||||
dtype: object
|
||||
|
||||
.. image:: _static/test_buffer.png
|
||||
|
||||
GeoPandas objects also know how to plot themselves. GeoPandas uses `descartes`_ to generate a `matplotlib`_ plot. To generate a plot of our GeoSeries, use:
|
||||
|
||||
.. sourcecode:: python
|
||||
|
||||
>>> g.plot()
|
||||
|
||||
GeoPandas also implements alternate constructors that can read any data format recognized by `fiona`_. To read a `file containing the boroughs of New York City`_:
|
||||
|
||||
.. sourcecode:: python
|
||||
|
||||
>>> boros = GeoDataFrame.from_file('nybb.shp')
|
||||
>>> boros.set_index('BoroCode', inplace=True)
|
||||
>>> boros.sort()
|
||||
>>> boros
|
||||
BoroName Shape_Area Shape_Leng \
|
||||
BoroCode
|
||||
1 Manhattan 6.364422e+08 358532.956418
|
||||
2 Bronx 1.186804e+09 464517.890553
|
||||
3 Brooklyn 1.959432e+09 726568.946340
|
||||
4 Queens 3.049947e+09 861038.479299
|
||||
5 Staten Island 1.623853e+09 330385.036974
|
||||
|
||||
geometry
|
||||
BoroCode
|
||||
1 (POLYGON ((981219.0557861328125000 188655.3157...
|
||||
2 (POLYGON ((1012821.8057861328125000 229228.264...
|
||||
3 (POLYGON ((1021176.4790039062500000 151374.796...
|
||||
4 (POLYGON ((1029606.0765991210937500 156073.814...
|
||||
5 (POLYGON ((970217.0223999023437500 145643.3322...
|
||||
|
||||
.. image:: _static/nyc.png
|
||||
|
||||
.. sourcecode:: python
|
||||
|
||||
>>> boros['geometry'].convex_hull
|
||||
0 POLYGON ((915517.6877458114176989 120121.88125...
|
||||
1 POLYGON ((1000721.5317993164062500 136681.7761...
|
||||
2 POLYGON ((988872.8212280273437500 146772.03179...
|
||||
3 POLYGON ((977855.4451904296875000 188082.32238...
|
||||
4 POLYGON ((1017949.9776000976562500 225426.8845...
|
||||
dtype: object
|
||||
|
||||
.. image:: _static/nyc_hull.png
|
||||
|
||||
To demonstrate a more complex operation, we'll generate a
|
||||
``GeoSeries`` containing 2000 random points:
|
||||
|
||||
.. sourcecode:: python
|
||||
|
||||
>>> from shapely.geometry import Point
|
||||
>>> xmin, xmax, ymin, ymax = 900000, 1080000, 120000, 280000
|
||||
>>> xc = (xmax - xmin) * np.random.random(2000) + xmin
|
||||
>>> yc = (ymax - ymin) * np.random.random(2000) + ymin
|
||||
>>> pts = GeoSeries([Point(x, y) for x, y in zip(xc, yc)])
|
||||
|
||||
Now draw a circle with fixed radius around each point:
|
||||
|
||||
.. sourcecode:: python
|
||||
|
||||
>>> circles = pts.buffer(2000)
|
||||
|
||||
We can collapse these circles into a single shapely MultiPolygon
|
||||
geometry with
|
||||
|
||||
.. sourcecode:: python
|
||||
|
||||
>>> mp = circles.unary_union
|
||||
|
||||
To extract the part of this geometry contained in each borough, we can
|
||||
just use:
|
||||
|
||||
.. sourcecode:: python
|
||||
|
||||
>>> holes = boros['geometry'].intersection(mp)
|
||||
|
||||
.. image:: _static/holes.png
|
||||
|
||||
and to get the area outside of the holes:
|
||||
|
||||
.. sourcecode:: python
|
||||
|
||||
>>> boros_with_holes = boros['geometry'].difference(mp)
|
||||
|
||||
.. image:: _static/boros_with_holes.png
|
||||
|
||||
Note that this can be simplified a bit, since ``geometry`` is
|
||||
available as an attribute on a ``GeoDataFrame``, and the
|
||||
``intersection`` and ``difference`` methods are implemented with the
|
||||
"&" and "-" operators, respectively. For example, the latter could
|
||||
have been expressed simply as ``boros.geometry - mp``.
|
||||
|
||||
It's easy to do things like calculate the fractional area in each
|
||||
borough that are in the holes:
|
||||
|
||||
.. sourcecode:: python
|
||||
|
||||
>>> holes.area / boros.geometry.area
|
||||
BoroCode
|
||||
1 0.602015
|
||||
2 0.523457
|
||||
3 0.585901
|
||||
4 0.577020
|
||||
5 0.559507
|
||||
dtype: float64
|
||||
|
||||
.. _Descartes: https://pypi.python.org/pypi/descartes
|
||||
.. _matplotlib: http://matplotlib.org
|
||||
.. _fiona: http://toblerity.github.io/fiona
|
||||
.. _file containing the boroughs of New York City: http://www.nyc.gov/html/dcp/download/bytes/nybb_13a.zip
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
@@ -13,6 +13,16 @@ operations are performed by `shapely`_. Geopandas further depends on
|
||||
.. _Descartes: https://pypi.python.org/pypi/descartes
|
||||
.. _matplotlib: http://matplotlib.org
|
||||
|
||||
Description
|
||||
-----------
|
||||
|
||||
The goal of GeoPandas is to make working with geospatial data in
|
||||
python easier. It combines the capabilities of pandas and shapely,
|
||||
providing geospatial operations in pandas and a high-level interface
|
||||
to multiple geometries to shapely. GeoPandas enables you to easily do
|
||||
operations in python that would otherwise require a spatial database
|
||||
such as PostGIS.
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
|
||||
+29
-1
@@ -1,9 +1,37 @@
|
||||
Installation
|
||||
============
|
||||
|
||||
GeoPandas is pre-alpha software. Please install the latest source from `GitHub`_.
|
||||
GeoPandas is pre-alpha software. Please install the latest source
|
||||
from `GitHub`_ and use the setup script::
|
||||
|
||||
python setup.py install
|
||||
|
||||
Dependencies
|
||||
------------
|
||||
|
||||
- `numpy`_
|
||||
- `pandas`_
|
||||
- `shapely`_
|
||||
- `fiona`_
|
||||
- `descartes`_
|
||||
- `matplotlib`_
|
||||
|
||||
Testing
|
||||
-------
|
||||
|
||||
To run the current set of tests from the source directory, run::
|
||||
|
||||
nosetests -v
|
||||
|
||||
from a command line.
|
||||
|
||||
.. _GitHub: https://github.com/kjordahl/geopandas
|
||||
.. _numpy: http://www.numpy.org
|
||||
.. _pandas: http://pandas.pydata.org
|
||||
.. _shapely: http://toblerity.github.io/shapely
|
||||
.. _fiona: http://toblerity.github.io/fiona
|
||||
.. _Descartes: https://pypi.python.org/pypi/descartes
|
||||
.. _matplotlib: http://matplotlib.org
|
||||
|
||||
|
||||
.. toctree::
|
||||
|
||||
@@ -47,11 +47,428 @@
|
||||
|
||||
<div class="section" id="documentation">
|
||||
<h1>Documentation<a class="headerlink" href="#documentation" title="Permalink to this headline">¶</a></h1>
|
||||
<p>Coming soon...</p>
|
||||
<p>GeoPandas implements two main data structures, a <tt class="docutils literal"><span class="pre">GeoSeries</span></tt> and a
|
||||
<tt class="docutils literal"><span class="pre">GeoDataFrame</span></tt>. These are subclasses of pandas <tt class="docutils literal"><span class="pre">Series</span></tt> and
|
||||
<tt class="docutils literal"><span class="pre">DataFrame</span></tt>, respectively.</p>
|
||||
<div class="section" id="geoseries">
|
||||
<h2>GeoSeries<a class="headerlink" href="#geoseries" title="Permalink to this headline">¶</a></h2>
|
||||
<p>A <tt class="docutils literal"><span class="pre">GeoSeries</span></tt> contains a sequence of geometries.</p>
|
||||
<p>The <tt class="docutils literal"><span class="pre">GeoSeries</span></tt> class implements nearly all of the attributes and
|
||||
methods of Shapely objects. When applied to a <tt class="docutils literal"><span class="pre">GeoSeries</span></tt>, they
|
||||
will apply elementwise to all geometries in the series. Binary
|
||||
operations can be applied between two <tt class="docutils literal"><span class="pre">GeoSeries</span></tt>, in which case the
|
||||
operation is carried out elementwise. The two series will be aligned
|
||||
by matching indices. Binary operations can also be applied to a
|
||||
single geometry, in which case the operation is carried out for each
|
||||
element of the series with that geometry. In either case, a
|
||||
<tt class="docutils literal"><span class="pre">Series</span></tt> or a <tt class="docutils literal"><span class="pre">GeoSeries</span></tt> will be returned, as appropriate.</p>
|
||||
<p>The following Shapely methods and attributes are available on
|
||||
<tt class="docutils literal"><span class="pre">GeoSeries</span></tt> objects:</p>
|
||||
<dl class="attribute">
|
||||
<dt id="GeoSeries.area">
|
||||
<tt class="descclassname">GeoSeries.</tt><tt class="descname">area</tt><a class="headerlink" href="#GeoSeries.area" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Returns a <tt class="docutils literal"><span class="pre">Series</span></tt> containing the area of each geometry in the <tt class="docutils literal"><span class="pre">GeoSeries</span></tt>.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="attribute">
|
||||
<dt id="GeoSeries.bounds">
|
||||
<tt class="descclassname">GeoSeries.</tt><tt class="descname">bounds</tt><a class="headerlink" href="#GeoSeries.bounds" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Returns a <tt class="docutils literal"><span class="pre">DataFrame</span></tt> with columns <tt class="docutils literal"><span class="pre">minx</span></tt>, <tt class="docutils literal"><span class="pre">miny</span></tt>, <tt class="docutils literal"><span class="pre">maxx</span></tt>,
|
||||
<tt class="docutils literal"><span class="pre">maxy</span></tt> values containing the bounds for each geometry.
|
||||
NOTE: This behavior may change in future versions.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="attribute">
|
||||
<dt id="GeoSeries.length">
|
||||
<tt class="descclassname">GeoSeries.</tt><tt class="descname">length</tt><a class="headerlink" href="#GeoSeries.length" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Returns a <tt class="docutils literal"><span class="pre">Series</span></tt> containing the length of each geometry.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="attribute">
|
||||
<dt id="GeoSeries.geom_type">
|
||||
<tt class="descclassname">GeoSeries.</tt><tt class="descname">geom_type</tt><a class="headerlink" href="#GeoSeries.geom_type" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Returns a <tt class="docutils literal"><span class="pre">Series</span></tt> of strings specifying the <cite>Geometry Type</cite> of
|
||||
each object.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="method">
|
||||
<dt id="GeoSeries.distance">
|
||||
<tt class="descclassname">GeoSeries.</tt><tt class="descname">distance</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#GeoSeries.distance" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Returns a <tt class="docutils literal"><span class="pre">Series</span></tt> containing the minimum distance to the <cite>other</cite>
|
||||
<tt class="docutils literal"><span class="pre">GeoSeries</span></tt> (elementwise) or geometric object.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="method">
|
||||
<dt id="GeoSeries.representative_point">
|
||||
<tt class="descclassname">GeoSeries.</tt><tt class="descname">representative_point</tt><big>(</big><big>)</big><a class="headerlink" href="#GeoSeries.representative_point" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Returns a <tt class="docutils literal"><span class="pre">GeoSeries</span></tt> of (cheaply computed) points that are
|
||||
guaranteed to be within each geometry.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="attribute">
|
||||
<dt id="GeoSeries.exterior">
|
||||
<tt class="descclassname">GeoSeries.</tt><tt class="descname">exterior</tt><a class="headerlink" href="#GeoSeries.exterior" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Returns a <tt class="docutils literal"><span class="pre">GeoSeries</span></tt> of LinearRings representing the outer
|
||||
boundary of each polygon in the GeoSeries. (Applies to GeoSeries
|
||||
containing only Polygons).</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="attribute">
|
||||
<dt id="GeoSeries.interiors">
|
||||
<tt class="descclassname">GeoSeries.</tt><tt class="descname">interiors</tt><a class="headerlink" href="#GeoSeries.interiors" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Returns a <tt class="docutils literal"><span class="pre">GeoSeries</span></tt> of InteriorRingSequences representing the
|
||||
inner rings of each polygon in the GeoSeries. (Applies to GeoSeries
|
||||
containing only Polygons).</p>
|
||||
</dd></dl>
|
||||
|
||||
<p><cite>Unary Predicates</cite></p>
|
||||
<dl class="attribute">
|
||||
<dt id="GeoSeries.is_empty">
|
||||
<tt class="descclassname">GeoSeries.</tt><tt class="descname">is_empty</tt><a class="headerlink" href="#GeoSeries.is_empty" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Returns a <tt class="docutils literal"><span class="pre">Series</span></tt> of <tt class="docutils literal"><span class="pre">dtype('bool')</span></tt> with value <tt class="docutils literal"><span class="pre">True</span></tt> for
|
||||
empty geometries.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="attribute">
|
||||
<dt id="GeoSeries.is_ring">
|
||||
<tt class="descclassname">GeoSeries.</tt><tt class="descname">is_ring</tt><a class="headerlink" href="#GeoSeries.is_ring" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Returns a <tt class="docutils literal"><span class="pre">Series</span></tt> of <tt class="docutils literal"><span class="pre">dtype('bool')</span></tt> with value <tt class="docutils literal"><span class="pre">True</span></tt> for
|
||||
features that are closed.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="attribute">
|
||||
<dt id="GeoSeries.is_simple">
|
||||
<tt class="descclassname">GeoSeries.</tt><tt class="descname">is_simple</tt><a class="headerlink" href="#GeoSeries.is_simple" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Returns a <tt class="docutils literal"><span class="pre">Series</span></tt> of <tt class="docutils literal"><span class="pre">dtype('bool')</span></tt> with value <tt class="docutils literal"><span class="pre">True</span></tt> for
|
||||
geometries that do not cross themselves (meaningful only for
|
||||
<cite>LineStrings</cite> and <cite>LinearRings</cite>).</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="attribute">
|
||||
<dt id="GeoSeries.is_valid">
|
||||
<tt class="descclassname">GeoSeries.</tt><tt class="descname">is_valid</tt><a class="headerlink" href="#GeoSeries.is_valid" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Returns a <tt class="docutils literal"><span class="pre">Series</span></tt> of <tt class="docutils literal"><span class="pre">dtype('bool')</span></tt> with value <tt class="docutils literal"><span class="pre">True</span></tt> for
|
||||
geometries that are valid.</p>
|
||||
</dd></dl>
|
||||
|
||||
<p><cite>Binary Predicates</cite></p>
|
||||
<dl class="method">
|
||||
<dt id="GeoSeries.almost_equals">
|
||||
<tt class="descclassname">GeoSeries.</tt><tt class="descname">almost_equals</tt><big>(</big><em>other</em><span class="optional">[</span>, <em>decimal=6</em><span class="optional">]</span><big>)</big><a class="headerlink" href="#GeoSeries.almost_equals" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Returns a <tt class="docutils literal"><span class="pre">Series</span></tt> of <tt class="docutils literal"><span class="pre">dtype('bool')</span></tt> with value <tt class="docutils literal"><span class="pre">True</span></tt> if
|
||||
each object is approximately equal to the <cite>other</cite> at all
|
||||
points to specified <cite>decimal</cite> place precision. (See also <a class="reference internal" href="#GeoSeries.equals" title="GeoSeries.equals"><tt class="xref py py-meth docutils literal"><span class="pre">equals()</span></tt></a>)</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="method">
|
||||
<dt id="GeoSeries.contains">
|
||||
<tt class="descclassname">GeoSeries.</tt><tt class="descname">contains</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#GeoSeries.contains" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Returns a <tt class="docutils literal"><span class="pre">Series</span></tt> of <tt class="docutils literal"><span class="pre">dtype('bool')</span></tt> with value <tt class="docutils literal"><span class="pre">True</span></tt> if
|
||||
each object’s <cite>interior</cite> contains the <cite>boundary</cite> and
|
||||
<cite>interior</cite> of the other object and their boundaries do not touch at all.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="method">
|
||||
<dt id="GeoSeries.crosses">
|
||||
<tt class="descclassname">GeoSeries.</tt><tt class="descname">crosses</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#GeoSeries.crosses" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Returns a <tt class="docutils literal"><span class="pre">Series</span></tt> of <tt class="docutils literal"><span class="pre">dtype('bool')</span></tt> with value <tt class="docutils literal"><span class="pre">True</span></tt> if
|
||||
the <cite>interior</cite> of each object intersects the <cite>interior</cite> of
|
||||
the other but does not contain it, and the dimension of the intersection is
|
||||
less than the dimension of the one or the other.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="method">
|
||||
<dt id="GeoSeries.disjoint">
|
||||
<tt class="descclassname">GeoSeries.</tt><tt class="descname">disjoint</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#GeoSeries.disjoint" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Returns a <tt class="docutils literal"><span class="pre">Series</span></tt> of <tt class="docutils literal"><span class="pre">dtype('bool')</span></tt> with value <tt class="docutils literal"><span class="pre">True</span></tt> if
|
||||
the <cite>boundary</cite> and <cite>interior</cite> of each object does not
|
||||
intersect at all with those of the other.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="method">
|
||||
<dt id="GeoSeries.equals">
|
||||
<tt class="descclassname">GeoSeries.</tt><tt class="descname">equals</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#GeoSeries.equals" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Returns a <tt class="docutils literal"><span class="pre">Series</span></tt> of <tt class="docutils literal"><span class="pre">dtype('bool')</span></tt> with value <tt class="docutils literal"><span class="pre">True</span></tt> if
|
||||
if the set-theoretic <cite>boundary</cite>, <cite>interior</cite>, and <cite>exterior</cite>
|
||||
of each object coincides with those of the other.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="method">
|
||||
<dt id="GeoSeries.intersects">
|
||||
<tt class="descclassname">GeoSeries.</tt><tt class="descname">intersects</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#GeoSeries.intersects" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Returns a <tt class="docutils literal"><span class="pre">Series</span></tt> of <tt class="docutils literal"><span class="pre">dtype('bool')</span></tt> with value <tt class="docutils literal"><span class="pre">True</span></tt> if
|
||||
if the <cite>boundary</cite> and <cite>interior</cite> of each object intersects in
|
||||
any way with those of the other.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="method">
|
||||
<dt id="GeoSeries.touches">
|
||||
<tt class="descclassname">GeoSeries.</tt><tt class="descname">touches</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#GeoSeries.touches" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Returns a <tt class="docutils literal"><span class="pre">Series</span></tt> of <tt class="docutils literal"><span class="pre">dtype('bool')</span></tt> with value <tt class="docutils literal"><span class="pre">True</span></tt> if
|
||||
the objects have at least one point in common and their
|
||||
interiors do not intersect with any part of the other.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="method">
|
||||
<dt id="GeoSeries.within">
|
||||
<tt class="descclassname">GeoSeries.</tt><tt class="descname">within</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#GeoSeries.within" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Returns a <tt class="docutils literal"><span class="pre">Series</span></tt> of <tt class="docutils literal"><span class="pre">dtype('bool')</span></tt> with value <tt class="docutils literal"><span class="pre">True</span></tt> if
|
||||
each object’s <cite>boundary</cite> and <cite>interior</cite> intersect only
|
||||
with the <cite>interior</cite> of the other (not its <cite>boundary</cite> or <cite>exterior</cite>).
|
||||
(Inverse of <a class="reference internal" href="#GeoSeries.contains" title="GeoSeries.contains"><tt class="xref py py-meth docutils literal"><span class="pre">contains()</span></tt></a>)</p>
|
||||
</dd></dl>
|
||||
|
||||
<p><cite>Set-theoretic Methods</cite></p>
|
||||
<dl class="attribute">
|
||||
<dt id="GeoSeries.boundary">
|
||||
<tt class="descclassname">GeoSeries.</tt><tt class="descname">boundary</tt><a class="headerlink" href="#GeoSeries.boundary" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Returns a <tt class="docutils literal"><span class="pre">GeoSeries</span></tt> of lower dimensional objects representing
|
||||
each geometries’s set-theoretic <cite>boundary</cite>.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="attribute">
|
||||
<dt id="GeoSeries.centroid">
|
||||
<tt class="descclassname">GeoSeries.</tt><tt class="descname">centroid</tt><a class="headerlink" href="#GeoSeries.centroid" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Returns a <tt class="docutils literal"><span class="pre">GeoSeries</span></tt> of points for each geometric centroid.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="method">
|
||||
<dt id="GeoSeries.difference">
|
||||
<tt class="descclassname">GeoSeries.</tt><tt class="descname">difference</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#GeoSeries.difference" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Returns a <tt class="docutils literal"><span class="pre">GeoSeries</span></tt> of the points in each geometry that
|
||||
are not in the <em>other</em> object.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="method">
|
||||
<dt id="GeoSeries.intersection">
|
||||
<tt class="descclassname">GeoSeries.</tt><tt class="descname">intersection</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#GeoSeries.intersection" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Returns a <tt class="docutils literal"><span class="pre">GeoSeries</span></tt> of the intersection of each object with the <cite>other</cite>
|
||||
geometric object.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="method">
|
||||
<dt id="GeoSeries.symmetric_difference">
|
||||
<tt class="descclassname">GeoSeries.</tt><tt class="descname">symmetric_difference</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#GeoSeries.symmetric_difference" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Returns a <tt class="docutils literal"><span class="pre">GeoSeries</span></tt> of the points in each object not in the <cite>other</cite>
|
||||
geometric object, and the points in the <cite>other</cite> not in this object.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="method">
|
||||
<dt id="GeoSeries.union">
|
||||
<tt class="descclassname">GeoSeries.</tt><tt class="descname">union</tt><big>(</big><em>other</em><big>)</big><a class="headerlink" href="#GeoSeries.union" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Returns a <tt class="docutils literal"><span class="pre">GeoSeries</span></tt> of the union of points from each object and the
|
||||
<cite>other</cite> geometric object.</p>
|
||||
</dd></dl>
|
||||
|
||||
<p><cite>Constructive Methods</cite></p>
|
||||
<dl class="method">
|
||||
<dt id="GeoSeries.buffer">
|
||||
<tt class="descclassname">GeoSeries.</tt><tt class="descname">buffer</tt><big>(</big><em>distance</em>, <em>resolution=16</em><big>)</big><a class="headerlink" href="#GeoSeries.buffer" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Returns a <tt class="docutils literal"><span class="pre">GeoSeries</span></tt> of geometries representing all points within a given <cite>distance</cite>
|
||||
of each geometric object.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="attribute">
|
||||
<dt id="GeoSeries.convex_hull">
|
||||
<tt class="descclassname">GeoSeries.</tt><tt class="descname">convex_hull</tt><a class="headerlink" href="#GeoSeries.convex_hull" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Returns a <tt class="docutils literal"><span class="pre">GeoSeries</span></tt> of geometries representing the smallest
|
||||
convex <cite>Polygon</cite> containing all the points in each object unless the
|
||||
number of points in the object is less than three. For two points,
|
||||
the convex hull collapses to a <cite>LineString</cite>; for 1, a <cite>Point</cite>.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="attribute">
|
||||
<dt id="GeoSeries.envelope">
|
||||
<tt class="descclassname">GeoSeries.</tt><tt class="descname">envelope</tt><a class="headerlink" href="#GeoSeries.envelope" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Returns a <tt class="docutils literal"><span class="pre">GeoSeries</span></tt> of geometries representing the point or
|
||||
smallest rectangular polygon (with sides parallel to the coordinate
|
||||
axes) that contains each object.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="method">
|
||||
<dt id="GeoSeries.simplify">
|
||||
<tt class="descclassname">GeoSeries.</tt><tt class="descname">simplify</tt><big>(</big><em>tolerance</em>, <em>preserve_topology=True</em><big>)</big><a class="headerlink" href="#GeoSeries.simplify" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Returns a <tt class="docutils literal"><span class="pre">GeoSeries</span></tt> containing a simplified representation of
|
||||
each object.</p>
|
||||
</dd></dl>
|
||||
|
||||
<p><cite>Aggregating methods</cite></p>
|
||||
<dl class="attribute">
|
||||
<dt id="GeoSeries.unary_union">
|
||||
<tt class="descclassname">GeoSeries.</tt><tt class="descname">unary_union</tt><a class="headerlink" href="#GeoSeries.unary_union" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Return a geometry containing the union of all geometries in the <tt class="docutils literal"><span class="pre">GeoSeries</span></tt>.</p>
|
||||
</dd></dl>
|
||||
|
||||
<p>Additionally, the following methods are implemented:</p>
|
||||
<dl class="method">
|
||||
<dt id="GeoSeries.from_file">
|
||||
<tt class="descclassname">GeoSeries.</tt><tt class="descname">from_file</tt><big>(</big><big>)</big><a class="headerlink" href="#GeoSeries.from_file" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Load a <tt class="docutils literal"><span class="pre">GeoSeries</span></tt> from a file from any format recognized by
|
||||
<a class="reference external" href="http://toblerity.github.io/fiona">fiona</a>.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="method">
|
||||
<dt id="GeoSeries.plot">
|
||||
<tt class="descclassname">GeoSeries.</tt><tt class="descname">plot</tt><big>(</big><em>colormap='Set1'</em><big>)</big><a class="headerlink" href="#GeoSeries.plot" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Generate a plot of the geometries in the <tt class="docutils literal"><span class="pre">GeoSeries</span></tt>.
|
||||
<tt class="docutils literal"><span class="pre">colormap</span></tt> can be any recognized by matplotlib, but discrete
|
||||
colormaps such as <tt class="docutils literal"><span class="pre">Accent</span></tt>, <tt class="docutils literal"><span class="pre">Dark2</span></tt>, <tt class="docutils literal"><span class="pre">Paired</span></tt>, <tt class="docutils literal"><span class="pre">Pastel1</span></tt>,
|
||||
<tt class="docutils literal"><span class="pre">Pastel2</span></tt>, <tt class="docutils literal"><span class="pre">Set1</span></tt>, <tt class="docutils literal"><span class="pre">Set2</span></tt>, or <tt class="docutils literal"><span class="pre">Set3</span></tt> are recommended.</p>
|
||||
</dd></dl>
|
||||
|
||||
<p>Methods of pandas <tt class="docutils literal"><span class="pre">Series</span></tt> objects are also available, although not
|
||||
all are applicable to geometric objects and some may return a
|
||||
<tt class="docutils literal"><span class="pre">Series</span></tt> rather than a <tt class="docutils literal"><span class="pre">GeoSeries</span></tt> result. The methods
|
||||
<tt class="docutils literal"><span class="pre">copy()</span></tt>, <tt class="docutils literal"><span class="pre">align()</span></tt>, <tt class="docutils literal"><span class="pre">isnull()</span></tt> and <tt class="docutils literal"><span class="pre">fillna()</span></tt> have been
|
||||
implemented specifically for <tt class="docutils literal"><span class="pre">GeoSeries</span></tt> and are expected to work
|
||||
correctly.</p>
|
||||
</div>
|
||||
<div class="section" id="geodataframe">
|
||||
<h2>GeoDataFrame<a class="headerlink" href="#geodataframe" title="Permalink to this headline">¶</a></h2>
|
||||
<p>A <tt class="docutils literal"><span class="pre">GeoDataFrame</span></tt> is a tablular data structure that contains a column
|
||||
called <tt class="docutils literal"><span class="pre">geometry</span></tt> which contains a <cite>GeoSeries`</cite>.</p>
|
||||
<p>Currently only the following methods are implemented for a <tt class="docutils literal"><span class="pre">GeoDataFrame</span></tt>:</p>
|
||||
<dl class="method">
|
||||
<dt id="GeoDataFrame.from_file">
|
||||
<tt class="descclassname">GeoDataFrame.</tt><tt class="descname">from_file</tt><big>(</big><big>)</big><a class="headerlink" href="#GeoDataFrame.from_file" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Load a <tt class="docutils literal"><span class="pre">GeoDataFrame</span></tt> from a file from any format recognized by
|
||||
<a class="reference external" href="http://toblerity.github.io/fiona">fiona</a>.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="method">
|
||||
<dt id="GeoDataFrame.plot">
|
||||
<tt class="descclassname">GeoDataFrame.</tt><tt class="descname">plot</tt><big>(</big><big>)</big><a class="headerlink" href="#GeoDataFrame.plot" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Generate a plot of the geometries in the <tt class="docutils literal"><span class="pre">GeoDataFrame</span></tt>.
|
||||
Currently calls <tt class="docutils literal"><span class="pre">GeoSeries.plot()</span></tt> on the <tt class="docutils literal"><span class="pre">geometry</span></tt> column,
|
||||
though in the future this will be able to color the geometries by
|
||||
data values from another column.</p>
|
||||
</dd></dl>
|
||||
|
||||
<p>All pandas <tt class="docutils literal"><span class="pre">DataFrame</span></tt> methods are also available, although they may
|
||||
not operate in a meaningful way on the <tt class="docutils literal"><span class="pre">geometry</span></tt> column and may not
|
||||
return a <tt class="docutils literal"><span class="pre">GeoDataFrame</span></tt> result even when it would be appropriate to
|
||||
do so.</p>
|
||||
</div>
|
||||
<div class="section" id="examples">
|
||||
<h2>Examples<a class="headerlink" href="#examples" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">p1</span> <span class="o">=</span> <span class="n">Polygon</span><span class="p">([(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">)])</span>
|
||||
<span class="gp">>>> </span><span class="n">p2</span> <span class="o">=</span> <span class="n">Polygon</span><span class="p">([(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">)])</span>
|
||||
<span class="gp">>>> </span><span class="n">p3</span> <span class="o">=</span> <span class="n">Polygon</span><span class="p">([(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">1</span><span class="p">)])</span>
|
||||
<span class="gp">>>> </span><span class="n">g</span> <span class="o">=</span> <span class="n">GeoSeries</span><span class="p">([</span><span class="n">p1</span><span class="p">,</span> <span class="n">p2</span><span class="p">,</span> <span class="n">p3</span><span class="p">])</span>
|
||||
<span class="gp">>>> </span><span class="n">g</span>
|
||||
<span class="go">0 POLYGON ((0.0000000000000000 0.000000000000000...</span>
|
||||
<span class="go">1 POLYGON ((0.0000000000000000 0.000000000000000...</span>
|
||||
<span class="go">2 POLYGON ((2.0000000000000000 0.000000000000000...</span>
|
||||
<span class="go">dtype: object</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<img alt="_images/test.png" src="_images/test.png" />
|
||||
<p>Some geographic operations return normal pandas object. The <tt class="docutils literal"><span class="pre">area</span></tt> property of a <tt class="docutils literal"><span class="pre">GeoSeries</span></tt> will return a <tt class="docutils literal"><span class="pre">pandas.Series</span></tt> containing the area of each item in the <tt class="docutils literal"><span class="pre">GeoSeries</span></tt>:</p>
|
||||
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="k">print</span> <span class="n">g</span><span class="o">.</span><span class="n">area</span>
|
||||
<span class="go">0 0.5</span>
|
||||
<span class="go">1 1.0</span>
|
||||
<span class="go">2 1.0</span>
|
||||
<span class="go">dtype: float64</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>Other operations return GeoPandas objects:</p>
|
||||
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">g</span><span class="o">.</span><span class="n">buffer</span><span class="p">(</span><span class="mf">0.5</span><span class="p">)</span>
|
||||
<span class="go">Out[15]:</span>
|
||||
<span class="go">0 POLYGON ((-0.3535533905932737 0.35355339059327...</span>
|
||||
<span class="go">1 POLYGON ((-0.5000000000000000 0.00000000000000...</span>
|
||||
<span class="go">2 POLYGON ((1.5000000000000000 0.000000000000000...</span>
|
||||
<span class="go">dtype: object</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<img alt="_images/test_buffer.png" src="_images/test_buffer.png" />
|
||||
<p>GeoPandas objects also know how to plot themselves. GeoPandas uses <a class="reference external" href="https://pypi.python.org/pypi/descartes">descartes</a> to generate a <a class="reference external" href="http://matplotlib.org">matplotlib</a> plot. To generate a plot of our GeoSeries, use:</p>
|
||||
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">g</span><span class="o">.</span><span class="n">plot</span><span class="p">()</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>GeoPandas also implements alternate constructors that can read any data format recognized by <a class="reference external" href="http://toblerity.github.io/fiona">fiona</a>. To read a <a class="reference external" href="http://www.nyc.gov/html/dcp/download/bytes/nybb_13a.zip">file containing the boroughs of New York City</a>:</p>
|
||||
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">boros</span> <span class="o">=</span> <span class="n">GeoDataFrame</span><span class="o">.</span><span class="n">from_file</span><span class="p">(</span><span class="s">'nybb.shp'</span><span class="p">)</span>
|
||||
<span class="gp">>>> </span><span class="n">boros</span><span class="o">.</span><span class="n">set_index</span><span class="p">(</span><span class="s">'BoroCode'</span><span class="p">,</span> <span class="n">inplace</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
|
||||
<span class="gp">>>> </span><span class="n">boros</span><span class="o">.</span><span class="n">sort</span><span class="p">()</span>
|
||||
<span class="gp">>>> </span><span class="n">boros</span>
|
||||
<span class="go"> BoroName Shape_Area Shape_Leng \</span>
|
||||
<span class="go">BoroCode</span>
|
||||
<span class="go">1 Manhattan 6.364422e+08 358532.956418</span>
|
||||
<span class="go">2 Bronx 1.186804e+09 464517.890553</span>
|
||||
<span class="go">3 Brooklyn 1.959432e+09 726568.946340</span>
|
||||
<span class="go">4 Queens 3.049947e+09 861038.479299</span>
|
||||
<span class="go">5 Staten Island 1.623853e+09 330385.036974</span>
|
||||
|
||||
<span class="go"> geometry</span>
|
||||
<span class="go">BoroCode</span>
|
||||
<span class="go">1 (POLYGON ((981219.0557861328125000 188655.3157...</span>
|
||||
<span class="go">2 (POLYGON ((1012821.8057861328125000 229228.264...</span>
|
||||
<span class="go">3 (POLYGON ((1021176.4790039062500000 151374.796...</span>
|
||||
<span class="go">4 (POLYGON ((1029606.0765991210937500 156073.814...</span>
|
||||
<span class="go">5 (POLYGON ((970217.0223999023437500 145643.3322...</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<img alt="_images/nyc.png" src="_images/nyc.png" />
|
||||
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">boros</span><span class="p">[</span><span class="s">'geometry'</span><span class="p">]</span><span class="o">.</span><span class="n">convex_hull</span>
|
||||
<span class="go">0 POLYGON ((915517.6877458114176989 120121.88125...</span>
|
||||
<span class="go">1 POLYGON ((1000721.5317993164062500 136681.7761...</span>
|
||||
<span class="go">2 POLYGON ((988872.8212280273437500 146772.03179...</span>
|
||||
<span class="go">3 POLYGON ((977855.4451904296875000 188082.32238...</span>
|
||||
<span class="go">4 POLYGON ((1017949.9776000976562500 225426.8845...</span>
|
||||
<span class="go">dtype: object</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<img alt="_images/nyc_hull.png" src="_images/nyc_hull.png" />
|
||||
<p>To demonstrate a more complex operation, we’ll generate a
|
||||
<tt class="docutils literal"><span class="pre">GeoSeries</span></tt> containing 2000 random points:</p>
|
||||
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">shapely.geometry</span> <span class="kn">import</span> <span class="n">Point</span>
|
||||
<span class="gp">>>> </span><span class="n">xmin</span><span class="p">,</span> <span class="n">xmax</span><span class="p">,</span> <span class="n">ymin</span><span class="p">,</span> <span class="n">ymax</span> <span class="o">=</span> <span class="mi">900000</span><span class="p">,</span> <span class="mi">1080000</span><span class="p">,</span> <span class="mi">120000</span><span class="p">,</span> <span class="mi">280000</span>
|
||||
<span class="gp">>>> </span><span class="n">xc</span> <span class="o">=</span> <span class="p">(</span><span class="n">xmax</span> <span class="o">-</span> <span class="n">xmin</span><span class="p">)</span> <span class="o">*</span> <span class="n">np</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">random</span><span class="p">(</span><span class="mi">2000</span><span class="p">)</span> <span class="o">+</span> <span class="n">xmin</span>
|
||||
<span class="gp">>>> </span><span class="n">yc</span> <span class="o">=</span> <span class="p">(</span><span class="n">ymax</span> <span class="o">-</span> <span class="n">ymin</span><span class="p">)</span> <span class="o">*</span> <span class="n">np</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">random</span><span class="p">(</span><span class="mi">2000</span><span class="p">)</span> <span class="o">+</span> <span class="n">ymin</span>
|
||||
<span class="gp">>>> </span><span class="n">pts</span> <span class="o">=</span> <span class="n">GeoSeries</span><span class="p">([</span><span class="n">Point</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">)</span> <span class="k">for</span> <span class="n">x</span><span class="p">,</span> <span class="n">y</span> <span class="ow">in</span> <span class="nb">zip</span><span class="p">(</span><span class="n">xc</span><span class="p">,</span> <span class="n">yc</span><span class="p">)])</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>Now draw a circle with fixed radius around each point:</p>
|
||||
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">circles</span> <span class="o">=</span> <span class="n">pts</span><span class="o">.</span><span class="n">buffer</span><span class="p">(</span><span class="mi">2000</span><span class="p">)</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>We can collapse these circles into a single shapely MultiPolygon
|
||||
geometry with</p>
|
||||
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">mp</span> <span class="o">=</span> <span class="n">circles</span><span class="o">.</span><span class="n">unary_union</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>To extract the part of this geometry contained in each borough, we can
|
||||
just use:</p>
|
||||
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">holes</span> <span class="o">=</span> <span class="n">boros</span><span class="p">[</span><span class="s">'geometry'</span><span class="p">]</span><span class="o">.</span><span class="n">intersection</span><span class="p">(</span><span class="n">mp</span><span class="p">)</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<img alt="_images/holes.png" src="_images/holes.png" />
|
||||
<p>and to get the area outside of the holes:</p>
|
||||
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">boros_with_holes</span> <span class="o">=</span> <span class="n">boros</span><span class="p">[</span><span class="s">'geometry'</span><span class="p">]</span><span class="o">.</span><span class="n">difference</span><span class="p">(</span><span class="n">mp</span><span class="p">)</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<img alt="_images/boros_with_holes.png" src="_images/boros_with_holes.png" />
|
||||
<p>Note that this can be simplified a bit, since <tt class="docutils literal"><span class="pre">geometry</span></tt> is
|
||||
available as an attribute on a <tt class="docutils literal"><span class="pre">GeoDataFrame</span></tt>, and the
|
||||
<tt class="docutils literal"><span class="pre">intersection</span></tt> and <tt class="docutils literal"><span class="pre">difference</span></tt> methods are implemented with the
|
||||
“&” and “-” operators, respectively. For example, the latter could
|
||||
have been expressed simply as <tt class="docutils literal"><span class="pre">boros.geometry</span> <span class="pre">-</span> <span class="pre">mp</span></tt>.</p>
|
||||
<p>It’s easy to do things like calculate the fractional area in each
|
||||
borough that are in the holes:</p>
|
||||
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">holes</span><span class="o">.</span><span class="n">area</span> <span class="o">/</span> <span class="n">boros</span><span class="o">.</span><span class="n">geometry</span><span class="o">.</span><span class="n">area</span>
|
||||
<span class="go">BoroCode</span>
|
||||
<span class="go">1 0.602015</span>
|
||||
<span class="go">2 0.523457</span>
|
||||
<span class="go">3 0.585901</span>
|
||||
<span class="go">4 0.577020</span>
|
||||
<span class="go">5 0.559507</span>
|
||||
<span class="go">dtype: float64</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="toctree-wrapper compound">
|
||||
<ul class="simple">
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -60,6 +477,18 @@
|
||||
</div>
|
||||
<div class="sphinxsidebar">
|
||||
<div class="sphinxsidebarwrapper">
|
||||
<h3><a href="index.html">Table Of Contents</a></h3>
|
||||
<ul>
|
||||
<li><a class="reference internal" href="#">Documentation</a><ul>
|
||||
<li><a class="reference internal" href="#geoseries">GeoSeries</a></li>
|
||||
<li><a class="reference internal" href="#geodataframe">GeoDataFrame</a></li>
|
||||
<li><a class="reference internal" href="#examples">Examples</a><ul>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div id="searchbox" style="display: none">
|
||||
<h3>Quick search</h3>
|
||||
<form class="search" action="search.html" method="get">
|
||||
|
||||
+265
@@ -51,8 +51,273 @@
|
||||
<h1 id="index">Index</h1>
|
||||
|
||||
<div class="genindex-jumpbox">
|
||||
<a href="#A"><strong>A</strong></a>
|
||||
| <a href="#B"><strong>B</strong></a>
|
||||
| <a href="#C"><strong>C</strong></a>
|
||||
| <a href="#D"><strong>D</strong></a>
|
||||
| <a href="#E"><strong>E</strong></a>
|
||||
| <a href="#F"><strong>F</strong></a>
|
||||
| <a href="#G"><strong>G</strong></a>
|
||||
| <a href="#I"><strong>I</strong></a>
|
||||
| <a href="#L"><strong>L</strong></a>
|
||||
| <a href="#P"><strong>P</strong></a>
|
||||
| <a href="#R"><strong>R</strong></a>
|
||||
| <a href="#S"><strong>S</strong></a>
|
||||
| <a href="#T"><strong>T</strong></a>
|
||||
| <a href="#U"><strong>U</strong></a>
|
||||
| <a href="#W"><strong>W</strong></a>
|
||||
|
||||
</div>
|
||||
<h2 id="A">A</h2>
|
||||
<table style="width: 100%" class="indextable genindextable"><tr>
|
||||
<td style="width: 33%" valign="top"><dl>
|
||||
|
||||
<dt><a href="docs.html#GeoSeries.almost_equals">almost_equals() (GeoSeries method)</a>
|
||||
</dt>
|
||||
|
||||
</dl></td>
|
||||
<td style="width: 33%" valign="top"><dl>
|
||||
|
||||
<dt><a href="docs.html#GeoSeries.area">area (GeoSeries attribute)</a>
|
||||
</dt>
|
||||
|
||||
</dl></td>
|
||||
</tr></table>
|
||||
|
||||
<h2 id="B">B</h2>
|
||||
<table style="width: 100%" class="indextable genindextable"><tr>
|
||||
<td style="width: 33%" valign="top"><dl>
|
||||
|
||||
<dt><a href="docs.html#GeoSeries.boundary">boundary (GeoSeries attribute)</a>
|
||||
</dt>
|
||||
|
||||
|
||||
<dt><a href="docs.html#GeoSeries.bounds">bounds (GeoSeries attribute)</a>
|
||||
</dt>
|
||||
|
||||
</dl></td>
|
||||
<td style="width: 33%" valign="top"><dl>
|
||||
|
||||
<dt><a href="docs.html#GeoSeries.buffer">buffer() (GeoSeries method)</a>
|
||||
</dt>
|
||||
|
||||
</dl></td>
|
||||
</tr></table>
|
||||
|
||||
<h2 id="C">C</h2>
|
||||
<table style="width: 100%" class="indextable genindextable"><tr>
|
||||
<td style="width: 33%" valign="top"><dl>
|
||||
|
||||
<dt><a href="docs.html#GeoSeries.centroid">centroid (GeoSeries attribute)</a>
|
||||
</dt>
|
||||
|
||||
|
||||
<dt><a href="docs.html#GeoSeries.contains">contains() (GeoSeries method)</a>
|
||||
</dt>
|
||||
|
||||
</dl></td>
|
||||
<td style="width: 33%" valign="top"><dl>
|
||||
|
||||
<dt><a href="docs.html#GeoSeries.convex_hull">convex_hull (GeoSeries attribute)</a>
|
||||
</dt>
|
||||
|
||||
|
||||
<dt><a href="docs.html#GeoSeries.crosses">crosses() (GeoSeries method)</a>
|
||||
</dt>
|
||||
|
||||
</dl></td>
|
||||
</tr></table>
|
||||
|
||||
<h2 id="D">D</h2>
|
||||
<table style="width: 100%" class="indextable genindextable"><tr>
|
||||
<td style="width: 33%" valign="top"><dl>
|
||||
|
||||
<dt><a href="docs.html#GeoSeries.difference">difference() (GeoSeries method)</a>
|
||||
</dt>
|
||||
|
||||
|
||||
<dt><a href="docs.html#GeoSeries.disjoint">disjoint() (GeoSeries method)</a>
|
||||
</dt>
|
||||
|
||||
</dl></td>
|
||||
<td style="width: 33%" valign="top"><dl>
|
||||
|
||||
<dt><a href="docs.html#GeoSeries.distance">distance() (GeoSeries method)</a>
|
||||
</dt>
|
||||
|
||||
</dl></td>
|
||||
</tr></table>
|
||||
|
||||
<h2 id="E">E</h2>
|
||||
<table style="width: 100%" class="indextable genindextable"><tr>
|
||||
<td style="width: 33%" valign="top"><dl>
|
||||
|
||||
<dt><a href="docs.html#GeoSeries.envelope">envelope (GeoSeries attribute)</a>
|
||||
</dt>
|
||||
|
||||
|
||||
<dt><a href="docs.html#GeoSeries.equals">equals() (GeoSeries method)</a>
|
||||
</dt>
|
||||
|
||||
</dl></td>
|
||||
<td style="width: 33%" valign="top"><dl>
|
||||
|
||||
<dt><a href="docs.html#GeoSeries.exterior">exterior (GeoSeries attribute)</a>
|
||||
</dt>
|
||||
|
||||
</dl></td>
|
||||
</tr></table>
|
||||
|
||||
<h2 id="F">F</h2>
|
||||
<table style="width: 100%" class="indextable genindextable"><tr>
|
||||
<td style="width: 33%" valign="top"><dl>
|
||||
|
||||
<dt><a href="docs.html#GeoDataFrame.from_file">from_file() (GeoDataFrame method)</a>
|
||||
</dt>
|
||||
|
||||
<dd><dl>
|
||||
|
||||
<dt><a href="docs.html#GeoSeries.from_file">(GeoSeries method)</a>
|
||||
</dt>
|
||||
|
||||
</dl></dd>
|
||||
</dl></td>
|
||||
</tr></table>
|
||||
|
||||
<h2 id="G">G</h2>
|
||||
<table style="width: 100%" class="indextable genindextable"><tr>
|
||||
<td style="width: 33%" valign="top"><dl>
|
||||
|
||||
<dt><a href="docs.html#GeoSeries.geom_type">geom_type (GeoSeries attribute)</a>
|
||||
</dt>
|
||||
|
||||
</dl></td>
|
||||
</tr></table>
|
||||
|
||||
<h2 id="I">I</h2>
|
||||
<table style="width: 100%" class="indextable genindextable"><tr>
|
||||
<td style="width: 33%" valign="top"><dl>
|
||||
|
||||
<dt><a href="docs.html#GeoSeries.interiors">interiors (GeoSeries attribute)</a>
|
||||
</dt>
|
||||
|
||||
|
||||
<dt><a href="docs.html#GeoSeries.intersection">intersection() (GeoSeries method)</a>
|
||||
</dt>
|
||||
|
||||
|
||||
<dt><a href="docs.html#GeoSeries.intersects">intersects() (GeoSeries method)</a>
|
||||
</dt>
|
||||
|
||||
|
||||
<dt><a href="docs.html#GeoSeries.is_empty">is_empty (GeoSeries attribute)</a>
|
||||
</dt>
|
||||
|
||||
</dl></td>
|
||||
<td style="width: 33%" valign="top"><dl>
|
||||
|
||||
<dt><a href="docs.html#GeoSeries.is_ring">is_ring (GeoSeries attribute)</a>
|
||||
</dt>
|
||||
|
||||
|
||||
<dt><a href="docs.html#GeoSeries.is_simple">is_simple (GeoSeries attribute)</a>
|
||||
</dt>
|
||||
|
||||
|
||||
<dt><a href="docs.html#GeoSeries.is_valid">is_valid (GeoSeries attribute)</a>
|
||||
</dt>
|
||||
|
||||
</dl></td>
|
||||
</tr></table>
|
||||
|
||||
<h2 id="L">L</h2>
|
||||
<table style="width: 100%" class="indextable genindextable"><tr>
|
||||
<td style="width: 33%" valign="top"><dl>
|
||||
|
||||
<dt><a href="docs.html#GeoSeries.length">length (GeoSeries attribute)</a>
|
||||
</dt>
|
||||
|
||||
</dl></td>
|
||||
</tr></table>
|
||||
|
||||
<h2 id="P">P</h2>
|
||||
<table style="width: 100%" class="indextable genindextable"><tr>
|
||||
<td style="width: 33%" valign="top"><dl>
|
||||
|
||||
<dt><a href="docs.html#GeoDataFrame.plot">plot() (GeoDataFrame method)</a>
|
||||
</dt>
|
||||
|
||||
<dd><dl>
|
||||
|
||||
<dt><a href="docs.html#GeoSeries.plot">(GeoSeries method)</a>
|
||||
</dt>
|
||||
|
||||
</dl></dd>
|
||||
</dl></td>
|
||||
</tr></table>
|
||||
|
||||
<h2 id="R">R</h2>
|
||||
<table style="width: 100%" class="indextable genindextable"><tr>
|
||||
<td style="width: 33%" valign="top"><dl>
|
||||
|
||||
<dt><a href="docs.html#GeoSeries.representative_point">representative_point() (GeoSeries method)</a>
|
||||
</dt>
|
||||
|
||||
</dl></td>
|
||||
</tr></table>
|
||||
|
||||
<h2 id="S">S</h2>
|
||||
<table style="width: 100%" class="indextable genindextable"><tr>
|
||||
<td style="width: 33%" valign="top"><dl>
|
||||
|
||||
<dt><a href="docs.html#GeoSeries.simplify">simplify() (GeoSeries method)</a>
|
||||
</dt>
|
||||
|
||||
</dl></td>
|
||||
<td style="width: 33%" valign="top"><dl>
|
||||
|
||||
<dt><a href="docs.html#GeoSeries.symmetric_difference">symmetric_difference() (GeoSeries method)</a>
|
||||
</dt>
|
||||
|
||||
</dl></td>
|
||||
</tr></table>
|
||||
|
||||
<h2 id="T">T</h2>
|
||||
<table style="width: 100%" class="indextable genindextable"><tr>
|
||||
<td style="width: 33%" valign="top"><dl>
|
||||
|
||||
<dt><a href="docs.html#GeoSeries.touches">touches() (GeoSeries method)</a>
|
||||
</dt>
|
||||
|
||||
</dl></td>
|
||||
</tr></table>
|
||||
|
||||
<h2 id="U">U</h2>
|
||||
<table style="width: 100%" class="indextable genindextable"><tr>
|
||||
<td style="width: 33%" valign="top"><dl>
|
||||
|
||||
<dt><a href="docs.html#GeoSeries.unary_union">unary_union (GeoSeries attribute)</a>
|
||||
</dt>
|
||||
|
||||
</dl></td>
|
||||
<td style="width: 33%" valign="top"><dl>
|
||||
|
||||
<dt><a href="docs.html#GeoSeries.union">union() (GeoSeries method)</a>
|
||||
</dt>
|
||||
|
||||
</dl></td>
|
||||
</tr></table>
|
||||
|
||||
<h2 id="W">W</h2>
|
||||
<table style="width: 100%" class="indextable genindextable"><tr>
|
||||
<td style="width: 33%" valign="top"><dl>
|
||||
|
||||
<dt><a href="docs.html#GeoSeries.within">within() (GeoSeries method)</a>
|
||||
</dt>
|
||||
|
||||
</dl></td>
|
||||
</tr></table>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
+19
@@ -52,10 +52,19 @@ data in python easier. GeoPandas extends the datatypes used by
|
||||
<a class="reference external" href="http://pandas.pydata.org">pandas</a> to allow spatial operations on geometric types. Geometric
|
||||
operations are performed by <a class="reference external" href="http://toblerity.github.io/shapely">shapely</a>. Geopandas further depends on
|
||||
<a class="reference external" href="http://toblerity.github.io/fiona">fiona</a> for file access and <a class="reference external" href="https://pypi.python.org/pypi/descartes">descartes</a> and <a class="reference external" href="http://matplotlib.org">matplotlib</a> for plotting.</p>
|
||||
<div class="section" id="description">
|
||||
<h2>Description<a class="headerlink" href="#description" title="Permalink to this headline">¶</a></h2>
|
||||
<p>The goal of GeoPandas is to make working with geospatial data in
|
||||
python easier. It combines the capabilities of pandas and shapely,
|
||||
providing geospatial operations in pandas and a high-level interface
|
||||
to multiple geometries to shapely. GeoPandas enables you to easily do
|
||||
operations in python that would otherwise require a spatial database
|
||||
such as PostGIS.</p>
|
||||
<div class="toctree-wrapper compound">
|
||||
<ul class="simple">
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -64,6 +73,16 @@ operations are performed by <a class="reference external" href="http://toblerity
|
||||
</div>
|
||||
<div class="sphinxsidebar">
|
||||
<div class="sphinxsidebarwrapper">
|
||||
<h3><a href="#">Table Of Contents</a></h3>
|
||||
<ul>
|
||||
<li><a class="reference internal" href="#">GeoPandas</a><ul>
|
||||
<li><a class="reference internal" href="#description">Description</a><ul>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div id="searchbox" style="display: none">
|
||||
<h3>Quick search</h3>
|
||||
<form class="search" action="search.html" method="get">
|
||||
|
||||
+34
-1
@@ -47,11 +47,33 @@
|
||||
|
||||
<div class="section" id="installation">
|
||||
<h1>Installation<a class="headerlink" href="#installation" title="Permalink to this headline">¶</a></h1>
|
||||
<p>GeoPandas is pre-alpha software. Please install the latest source from <a class="reference external" href="https://github.com/kjordahl/geopandas">GitHub</a>.</p>
|
||||
<p>GeoPandas is pre-alpha software. Please install the latest source
|
||||
from <a class="reference external" href="https://github.com/kjordahl/geopandas">GitHub</a> and use the setup script:</p>
|
||||
<div class="highlight-python"><pre>python setup.py install</pre>
|
||||
</div>
|
||||
<div class="section" id="dependencies">
|
||||
<h2>Dependencies<a class="headerlink" href="#dependencies" title="Permalink to this headline">¶</a></h2>
|
||||
<ul class="simple">
|
||||
<li><a class="reference external" href="http://www.numpy.org">numpy</a></li>
|
||||
<li><a class="reference external" href="http://pandas.pydata.org">pandas</a></li>
|
||||
<li><a class="reference external" href="http://toblerity.github.io/shapely">shapely</a></li>
|
||||
<li><a class="reference external" href="http://toblerity.github.io/fiona">fiona</a></li>
|
||||
<li><a class="reference external" href="https://pypi.python.org/pypi/descartes">descartes</a></li>
|
||||
<li><a class="reference external" href="http://matplotlib.org">matplotlib</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="testing">
|
||||
<h2>Testing<a class="headerlink" href="#testing" title="Permalink to this headline">¶</a></h2>
|
||||
<p>To run the current set of tests from the source directory, run:</p>
|
||||
<div class="highlight-python"><div class="highlight"><pre><span class="n">nosetests</span> <span class="o">-</span><span class="n">v</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>from a command line.</p>
|
||||
<div class="toctree-wrapper compound">
|
||||
<ul class="simple">
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -60,6 +82,17 @@
|
||||
</div>
|
||||
<div class="sphinxsidebar">
|
||||
<div class="sphinxsidebarwrapper">
|
||||
<h3><a href="index.html">Table Of Contents</a></h3>
|
||||
<ul>
|
||||
<li><a class="reference internal" href="#">Installation</a><ul>
|
||||
<li><a class="reference internal" href="#dependencies">Dependencies</a></li>
|
||||
<li><a class="reference internal" href="#testing">Testing</a><ul>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div id="searchbox" style="display: none">
|
||||
<h3>Quick search</h3>
|
||||
<form class="search" action="search.html" method="get">
|
||||
|
||||
BIN
Binary file not shown.
+1
-1
@@ -1 +1 @@
|
||||
Search.setIndex({objects:{},terms:{oper:3,pre:2,softwar:2,modul:[],soon:[0,1],indic:[],datatyp:3,shape:3,file:3,tabl:[],fiona:3,instal:2,open:3,panda:3,index:[],depend:3,perform:3,come:[0,1],make:3,access:3,spatial:3,document:0,type:3,easier:3,from:2,sourc:[3,2],extend:3,plot:3,python:3,pleas:2,search:[],matplotlib:3,descart:3,alpha:2,data:3,about:1,github:2,geospati:3,work:3,project:3,geometr:3,allow:3,further:3,geopanda:[3,2],page:[],latest:2},objtypes:{},titles:["Documentation","About","Installation","GeoPandas"],objnames:{},filenames:["docs","about","install","index"]})
|
||||
Search.setIndex({objects:{GeoSeries:{intersects:[0,1,1,""],symmetric_difference:[0,1,1,""],within:[0,1,1,""],is_simple:[0,0,1,""],exterior:[0,0,1,""],disjoint:[0,1,1,""],convex_hull:[0,0,1,""],plot:[0,1,1,""],touches:[0,1,1,""],difference:[0,1,1,""],area:[0,0,1,""],union:[0,1,1,""],contains:[0,1,1,""],representative_point:[0,1,1,""],is_valid:[0,0,1,""],centroid:[0,0,1,""],boundary:[0,0,1,""],unary_union:[0,0,1,""],buffer:[0,1,1,""],almost_equals:[0,1,1,""],envelope:[0,0,1,""],equals:[0,1,1,""],is_ring:[0,0,1,""],simplify:[0,1,1,""],is_empty:[0,0,1,""],intersection:[0,1,1,""],geom_type:[0,0,1,""],from_file:[0,1,1,""],distance:[0,1,1,""],crosses:[0,1,1,""],interiors:[0,0,1,""],bounds:[0,0,1,""],length:[0,0,1,""]},GeoDataFrame:{from_file:[0,1,1,""],plot:[0,1,1,""]}},terms:{represent:0,all:0,follow:0,depend:[3,2],decim:0,sourc:[3,2],string:0,unary_union:0,nybb_13a:[],is_r:0,level:3,set_index:0,geograph:0,random:0,item:0,dimens:0,aggreg:0,download:[],further:3,panda:[0,2,3],even:0,abl:0,access:3,version:0,intersect:0,"new":0,method:0,borocod:0,themselv:0,gener:0,tobler:[],matplotlib:[0,2,3],coincid:0,sinc:0,valu:0,precis:0,nosetest:2,chang:0,dtype:0,approxim:0,instal:2,ymin:0,plot:[0,3],from:[0,2],zip:0,is_simpl:0,two:0,call:0,recommend:0,type:[0,3],more:0,sort:0,hole:0,setup:2,work:[0,3],can:0,preserve_topolog:0,staten:0,indic:0,high:3,minimum:0,nybb:0,xmin:0,multipl:3,goal:3,nyc_hul:[],rather:0,anoth:0,how:0,nyc:[],collaps:0,recogn:0,mai:0,fillna:0,data:[0,3],parallel:0,demonstr:0,"623853e":0,github:2,predic:0,combin:3,allow:3,"959432e":0,soon:1,tablular:0,outer:0,fix:0,html:[],main:0,easier:3,"return":0,thei:0,python:[3,2],now:0,isnul:0,easili:3,each:0,geopanda:[0,2,3],side:0,inplac:0,boros_with_hol:0,expect:0,our:0,extract:0,out:0,convex_hul:0,print:0,gov:[],linear:0,hull:0,pleas:2,envelop:0,given:0,york:0,element:0,postgi:3,org:[],"byte":[],could:0,thing:0,length:0,place:0,outsid:0,geometri:[0,3],oper:[0,3],softwar:2,carri:0,number:0,least:0,ring:0,open:3,avail:0,differ:0,script:2,accent:0,construct:0,citi:0,circl:0,copi:0,specifi:0,part:0,than:0,png:[],provid:3,structur:0,project:3,seri:0,pre:2,mini:0,comput:0,ani:0,minx:0,have:0,fiona:[0,2,3],borough:0,"364422e":0,maxx:0,latter:0,note:0,also:0,maxi:0,interiorringsequ:0,which:0,interior:0,singl:0,simplifi:0,unless:0,though:0,buffer:0,object:0,brooklyn:0,geoseri:0,discret:0,pair:0,alpha:2,"class":0,shape_area:0,boronam:0,datafram:0,cheapli:0,radiu:0,current:[0,2],onli:0,nearli:0,get:0,express:0,pypi:[],requir:3,multipolygon:0,shp:0,enabl:3,common:0,xmax:0,contain:0,set:[0,2],datatyp:3,linestr:0,see:0,result:0,close:0,correctli:0,databas:3,boundari:0,smallest:0,elementwis:0,between:0,"import":0,attribut:0,altern:0,extend:3,toler:0,come:1,float64:0,equal:0,bronx:0,load:0,simpli:0,point:0,color:0,from_fil:0,shape_leng:0,respect:0,geodatafram:0,union:0,numpi:2,three:0,been:0,is_valid:0,resolut:0,coordin:0,those:0,"case":0,almost_equ:0,align:0,properti:0,rectangular:0,calcul:0,behavior:0,pastel2:0,pastel1:0,"049947e":0,disjoint:0,exterior:0,perform:3,make:3,cross:0,binari:0,complex:0,set1:0,set2:0,set3:0,document:0,is_empti:0,http:[],capabl:3,implement:0,"186804e":0,lower:0,appropri:0,exampl:0,command:2,thi:0,test_buff:[],dimension:0,latest:2,unari:0,distanc:0,just:0,less:0,shape:[0,2,3],touch:0,easi:0,queen:0,theoret:0,other:0,appli:0,match:0,applic:0,around:0,format:0,read:0,know:0,bit:0,like:0,specif:0,either:0,"_static":[],www:[],some:0,boro:0,convex:0,symmetric_differ:0,guarante:0,normal:0,subclass:0,centroid:0,run:2,colormap:0,descart:[0,2,3],although:0,dcp:[],about:1,would:[0,3],column:0,island:0,geom_typ:0,addition:0,constructor:0,within:0,bound:0,invers:0,empti:0,ymax:0,wai:0,area:0,representative_point:0,interfac:3,inner:0,fraction:0,line:2,"true":0,geospati:3,otherwis:3,featur:0,repres:0,file:[0,3],doe:0,polygon:0,when:0,valid:0,bool:0,futur:0,spatial:3,test:2,you:3,manhattan:0,draw:0,sequenc:0,dark2:0,meaning:0,directori:2,descript:3,geometr:[0,3]},objtypes:{"0":"py:attribute","1":"py:method"},titles:["Documentation","About","Installation","GeoPandas"],objnames:{"0":["py","attribute","Python attribute"],"1":["py","method","Python method"]},filenames:["docs","about","install","index"]})
|
||||
Reference in New Issue
Block a user