Skip to content
Commits on Source (7)
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
env/
build/
dist/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
# Unit test / coverage reports
htmlcov/
.tox/
.coverage
*.pyc
build
dist
doc/_build
geopandas.egg-info
geopandas/version.py
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
# Sphinx documentation
doc/_build/
# Jupyter Notebook
.ipynb_checkpoints
# projects
.spyderproject
.spyproject
.idea
.ropeproject
*.py~
doc/_static/world_*
.DS_Store
examples/nybb_*.zip
.cache/
doc/source/gallery
doc/source/savefig
doc/source/reference
geopandas.egg-info
geopandas/version.py
.asv
......@@ -2,63 +2,50 @@ language: python
sudo: false
cache: pip
addons:
apt:
packages:
- libgdal1h
- gdal-bin
- libgdal-dev
- libspatialindex-dev
matrix:
include:
# Only one test for these Python versions
- python: 3.4
env: PANDAS=0.18.1 MATPLOTLIB=1.4.3 SHAPELY=1.5.17
- python: 3.5
env: PANDAS=0.19.2 MATPLOTLIB=1.5.3
env: PANDAS=0.20.2 MATPLOTLIB=1.5.3
# Python 2.7 and 3.6 test all supported Pandas versions
- python: 2.7
env: PANDAS=0.16.2 MATPLOTLIB=1.4.3 SHAPELY=1.5.17
- python: 2.7
env: PANDAS=0.17.1 MATPLOTLIB=1.4.3 SHAPELY=1.5.17
- python: 2.7
env: PANDAS=0.18.1 MATPLOTLIB=1.5.3
- python: 2.7
env: PANDAS=0.19.2 MATPLOTLIB=1.5.3
env: PANDAS=0.19.2 MATPLOTLIB=1.5.3 SHAPELY=1.5
- python: 2.7
env: PANDAS=0.20.2 MATPLOTLIB=2.0.2
- python: 2.7
env: PANDAS=master MATPLOTLIB=master
env: PANDAS=0.23.2 MATPLOTLIB=2.1.2
- python: 2.7
env: PANDAS=master MATPLOTLIB=2.2.2
- python: 3.6
env: PANDAS=0.16.2 MATPLOTLIB=1.4.3 SHAPELY=1.5.17
- python: 3.6
env: PANDAS=0.17.1 MATPLOTLIB=1.4.3 SHAPELY=1.5.17
- python: 3.6
env: PANDAS=0.18.1 MATPLOTLIB=1.5.3
- python: 3.6
env: PANDAS=0.19.2 MATPLOTLIB=1.5.3
env: PANDAS=0.19.2 MATPLOTLIB=1.5.3 SHAPELY=1.5 CHANNEL=conda-forge
- python: 3.6
env: PANDAS=0.20.2 MATPLOTLIB=2.0.2
- python: 3.6
env: PANDAS=0.23.2 MATPLOTLIB=2.2.2
- python: 3.6
env: PANDAS=master MATPLOTLIB=master
before_install:
- pip install -U pip
install:
- pip install numpy
- if [[ $MATPLOTLIB == 'master' ]]; then pip install git+https://github.com/matplotlib/matplotlib.git; else pip install matplotlib==$MATPLOTLIB; fi
- if [ -n "$SHAPELY" ]; then pip install shapely==$SHAPELY; fi
- pip install -r requirements.txt
- pip install -r requirements.test.txt
- if [[ $PANDAS == 'master' ]]; then pip install git+https://github.com/pydata/pandas.git; else pip install pandas==$PANDAS; fi
# Install conda
- wget http://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -O miniconda.sh
- bash miniconda.sh -b -p $HOME/miniconda
- export PATH="$HOME/miniconda/bin:$PATH"
- conda config --set always_yes yes --set changeps1 no
- conda update conda
- if [ -n "$CHANNEL" ]; then conda config --add channels $CHANNEL; fi
# Install dependencies
- conda create -n test-geopandas -c conda-forge python=$TRAVIS_PYTHON_VERSION pytest matplotlib six psycopg2 sqlalchemy codecov pytest-cov mock
- source activate test-geopandas
- if [[ $MATPLOTLIB == 'master' ]]; then pip install git+https://github.com/matplotlib/matplotlib.git; fi
- if [ -n "$SHAPELY" ]; then conda install shapely=$SHAPELY; else conda install shapely; fi
- conda install pysal pyproj fiona descartes rtree
- if [[ $PANDAS != 'master' ]]; then conda install pandas==$PANDAS; fi
- if [[ $PANDAS == 'master' ]]; then conda install pandas cython; pip install git+https://github.com/pydata/pandas.git; fi
script:
- py.test geopandas --cov geopandas -v --cov-report term-missing
......
Changes
=======
Version 0.4.0 (July 15, 2017)
-----------------------------
Improvements:
* Improved `overlay` function (better performance, several incorrect behaviours fixed) (#429)
* Pass keywords to control legend behavior (`legend_kwds`) to `plot` (#434)
* Add basic support for reading remote datasets in `read_file` (#531)
* Pass kwargs for `buffer` operation on GeoSeries (#535)
* Expose all geopy services as options in geocoding (#550)
* Faster write speeds to GeoPackage (#605)
* Permit `read_file` filtering with a bounding box from a GeoDataFrame (#613)
* Set CRS on GeoDataFrame returned by `read_postgis` (#627)
* Permit setting markersize for Point GeoSeries plots with column values (#633)
* Started an example gallery (#463, #690, #717)
* Support for plotting MultiPoints (#683)
* Testing functionalty (e.g. `assert_geodataframe_equal`) is now publicly exposed (#707)
* Add `explode` method to GeoDataFrame (similar to the GeoSeries method) (#671)
* Set equal aspect on active axis on multi-axis figures (#718)
* Pass array of values to column argument in `plot` (#770)
Bug fixes :
* Ensure that colorbars are plotted on the correct axis (#523)
* Handle plotting empty GeoDataFrame (#571)
* Save z-dimension when writing files (#652)
* Handle reading empty shapefiles (#653)
* Correct dtype for empty result of spatial operations (#685)
* Fix empty `sjoin` handling for pandas>=0.23 (#762)
Version 0.3.0 (August 29, 2017)
-------------------------------
......@@ -41,7 +72,7 @@ Improvements:
* Addition of the ``sindex`` attribute, a Spatial Index using the optional
dependency ``rtree`` (``libspatialindex``) that can be used to speed up
certain operations such as overlays (#140, #141).
* Addition of the ``GeoSeries.ix`` coordinate indexer to slice a GeoSeries based
* Addition of the ``GeoSeries.cx`` coordinate indexer to slice a GeoSeries based
on a bounding box of the coordinates (#55).
* Improvements to plotting: ability to specify edge colors (#173), support for
the ``vmin``, ``vmax``, ``figsize``, ``linewidth`` keywords (#207), legends
......
GeoPandas [![build status](https://secure.travis-ci.org/geopandas/geopandas.png?branch=master)](https://travis-ci.org/geopandas/geopandas) [![Coverage Status](https://codecov.io/gh/geopandas/geopandas/branch/master/graph/badge.svg)](https://codecov.io/gh/geopandas/geopandas) [![Join the chat at https://gitter.im/geopandas/geopandas](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/geopandas/geopandas?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
GeoPandas [![build status](https://secure.travis-ci.org/geopandas/geopandas.png?branch=master)](https://travis-ci.org/geopandas/geopandas) [![Coverage Status](https://codecov.io/gh/geopandas/geopandas/branch/master/graph/badge.svg)](https://codecov.io/gh/geopandas/geopandas) [![Join the chat at https://gitter.im/geopandas/geopandas](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/geopandas/geopandas?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Binder](https://mybinder.org/badge.svg)](https://mybinder.org/v2/gh/geopandas/geopandas/master)
=========
Python tools for geographic data
......@@ -35,17 +35,44 @@ For the installation of GeoPandas, the following packages are required:
- ``pandas``
- ``shapely``
- ``fiona``
- ``descartes``
- ``pyproj``
Further, [``rtree``](https://github.com/Toblerity/rtree) is an optional
dependency. ``rtree`` requires the C library [``libspatialindex``](https://github.com/libspatialindex/libspatialindex). If using brew, you can install using ``brew install Spatialindex``.
Further, ``descartes`` and ``matplotlib`` are optional dependencies, required
for plotting, and [``rtree``](https://github.com/Toblerity/rtree) is an optional
dependency, required for spatial joins. ``rtree`` requires the C library [``libspatialindex``](https://github.com/libspatialindex/libspatialindex). If using brew, you can install using ``brew install Spatialindex``.
**Install**
Then, installation works as normal: ``pip install geopandas``
GeoPandas depends on several low-level libraries for geospatial analysis. Depending on the system and package
manager that you use, this may cause dependency conflicts if you are not careful.
*Using `conda`*
We suggest that you use the [anaconda distribution](https://conda.io/docs/user-guide/install/download.html)
to install GeoPandas (``miniconda`` is fine as well).
Use ``conda`` and the ``conda-forge`` channel to install GeoPandas on a clean environment:
```bash
conda create -n geopandas
source activate geopandas # 'activate geopandas' on Windows
conda install -c conda-forge geopandas
```
**NOTE:** Creating a new environment is not strictly necessary, but installing other geospatial packages
from a *different* channel than ``conda-forge`` may cause dependency conflicts, so we recommend starting
fresh if possible. See the [conda-forge gotcha page](https://conda-forge.org/docs/conda-forge_gotchas.html)
for more information.
*Using `pip`*
GeoPandas is also pip-installable. If you choose to use `pip`, make sure that you have the proper non-python
libraries installed and linked properly.
```bash
pip install geopandas
```
Examples
--------
......@@ -53,7 +80,7 @@ Examples
>>> 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 = geopandas.GeoSeries([p1, p2, p3])
>>> g
0 POLYGON ((0.0000000000000000 0.000000000000000...
1 POLYGON ((0.0000000000000000 0.000000000000000...
......@@ -88,7 +115,7 @@ GeoPandas objects also know how to plot themselves. GeoPandas uses [descartes](
GeoPandas also implements alternate constructors that can read any data format recognized by [fiona](http://toblerity.github.io/fiona). To read a zip file containing an ESRI shapefile with the [boroughs boundaries of New York City](https://data.cityofnewyork.us/City-Government/Borough-Boundaries/tqmj-j8zm) (GeoPandas includes this as an example dataset):
>>> nybb_path = geopandas.datasets.get_path('nybb')
>>> boros = GeoDataFrame.from_file(nybb_path)
>>> boros = geopandas.read_file(nybb_path)
>>> boros.set_index('BoroCode', inplace=True)
>>> boros.sort()
>>> boros
......
......@@ -34,10 +34,7 @@ install:
- conda update -q conda
- conda config --add channels conda-forge
- conda info -a
- "conda create -q -n test-environment python=%PYTHON_VERSION%"
- activate test-environment
- conda install pandas shapely=1.5 fiona pyproj rtree matplotlib descartes
- conda install pytest mock
- "conda create --quiet --name test-environment python=%PYTHON_VERSION% pandas --file requirements.txt --file requirements.test.txt"
test_script:
- activate test-environment
......
from geopandas import GeoDataFrame, GeoSeries, read_file, datasets
import numpy as np
import pandas as pd
from shapely.geometry import Point
class CRS:
def setup(self):
nybb = read_file(datasets.get_path('nybb'))
self.long_nybb = GeoDataFrame(pd.concat(10 * [nybb]),
crs=nybb.crs)
num_points = 20000
longitudes = np.random.rand(num_points) - 120
latitudes = np.random.rand(num_points) + 38
self.point_df = GeoSeries([Point(x, y) for (x, y)
in zip(longitudes, latitudes)])
self.point_df.crs = {"init": "epsg:4326"}
def time_transform_wgs84(self):
self.long_nybb.to_crs({"init": "epsg:4326"})
def time_transform_many_points(self):
self.point_df.to_crs({"init": "epsg:32610"})
python-geopandas (0.3.0-2) UNRELEASED; urgency=medium
python-geopandas (0.4.0-1) unstable; urgency=medium
* Team upload.
* New upstream release.
* Add python3-sphinx to build dependencies.
* Bump Standards-Version to 4.1.5, no changes.
* Update copyright-format URL to use HTTPS.
* Update Vcs-* URLs for Salsa.
* Strip trailing whitespace from control file.
* Update build dependencies for doc build.
* Add patch to disable gallery, requires unpackaged dependencies.
* Ignore test failures on all architectures.
-- Bas Couwenberg <sebastic@debian.org> Wed, 27 Sep 2017 15:01:11 +0200
-- Bas Couwenberg <sebastic@debian.org> Mon, 16 Jul 2018 12:29:56 +0200
python-geopandas (0.3.0-1) unstable; urgency=medium
......
......@@ -12,8 +12,12 @@ Build-Depends: debhelper (>= 9),
ipython3,
python-all,
python3-all,
python-cartopy,
python3-cartopy,
python-descartes,
python3-descartes,
python-pyepsg,
python3-pyepsg,
python-fiona,
python3-fiona,
python-geopy,
......@@ -26,6 +30,8 @@ Build-Depends: debhelper (>= 9),
python3-nose,
python-numpy,
python3-numpy,
python-numpydoc,
python3-numpydoc,
python-pandas,
python3-pandas,
python-psycopg2,
......@@ -48,6 +54,8 @@ Build-Depends: debhelper (>= 9),
python3-sqlalchemy,
python-sphinx,
python3-sphinx,
python-sphinx-gallery,
python3-sphinx-gallery,
python-sphinx-rtd-theme,
python3-sphinx-rtd-theme
Standards-Version: 4.1.5
......
Description: Disable gallery, requires unpacked dependencies.
Author: Bas Couwenberg <sebastic@debian.org>
Forwarded: not-needed
--- a/doc/source/conf.py
+++ b/doc/source/conf.py
@@ -27,7 +27,6 @@ import sys, os
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['IPython.sphinxext.ipython_console_highlighting',
'IPython.sphinxext.ipython_directive',
- 'sphinx_gallery.gen_gallery',
'sphinx.ext.autosummary',
'sphinx.ext.intersphinx',
'sphinx.ext.autodoc',
@@ -46,19 +45,6 @@ templates_path = ['_templates']
autosummary_generate = True
-# Sphinx gallery configuration
-sphinx_gallery_conf = {
- 'examples_dirs': ['../../examples'],
- 'filename_pattern': '^((?!sgskip).)*$',
- 'gallery_dirs': ['gallery'],
- 'doc_module': ('geopandas',),
- 'reference_url': {'matplotlib': 'http://matplotlib.org',
- 'numpy': 'http://docs.scipy.org/doc/numpy/reference',
- 'scipy': 'http://docs.scipy.org/doc/scipy/reference',
- 'geopandas': None},
- 'backreferences_dir': 'reference'
-}
-
# The suffix of source filenames.
source_suffix = '.rst'
......@@ -18,18 +18,10 @@ override_dh_auto_build:
override_dh_auto_test:
cp -v debian/nybb_*.zip examples/
# Ignore test failures on problematic architectures only
ifneq (,$(findstring $(DEB_BUILD_ARCH),"i386"))
PYBUILD_BEFORE_TEST="cp -rv examples/ {build_dir}" \
PYBUILD_AFTER_TEST="rm -rfv {build_dir}/examples/" \
PYBUILD_TEST_ARGS="-v --ignore=geopandas/tests/test_geocode.py --ignore=geopandas/tests/test_plotting.py" \
dh_auto_test || echo "Ignoring test failures"
else
PYBUILD_BEFORE_TEST="cp -rv examples/ {build_dir}" \
PYBUILD_AFTER_TEST="rm -rfv {build_dir}/examples/" \
PYBUILD_TEST_ARGS="-v --ignore=geopandas/tests/test_geocode.py --ignore=geopandas/tests/test_plotting.py" \
dh_auto_test
endif
rm -f examples/nybb_*.zip
......
......@@ -40,6 +40,7 @@ help:
clean:
-rm -rf $(BUILDDIR)/*
-rm -rf source/reference/*
html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
......
......@@ -2,7 +2,7 @@ name: geopandas_docs
channels:
- conda-forge
dependencies:
- python=3.5
- python=3.6
- pandas
- shapely
- fiona
......@@ -15,5 +15,12 @@ dependencies:
- pysal
- sphinx
- sphinx_rtd_theme
- numpydoc
- ipython
- pillow
- mock
- cartopy
- contextily
- geoplot
- sphinx-gallery
- jinja2
"""
Generate example images for GeoPandas documentation.
Visualizing NYC Boroughs
------------------------
TODO: autogenerate these from docs themselves
Visualize the Boroughs of New York City with Geopandas.
Kelsey Jordahl
Time-stamp: <Tue May 6 12:17:29 EDT 2014>
This example generates many images that are used in the documentation. See
the `Geometric Manipulations <geometric_manipulations>` example for more
details.
First we'll import a dataset containing each borough in New York City. We'll
use the ``datasets`` module to handle this quickly.
"""
import numpy as np
import matplotlib.pyplot as plt
from shapely.geometry import Point
from geopandas import GeoSeries, GeoDataFrame
import geopandas as gpd
np.random.seed(1)
DPI = 100
# http://www1.nyc.gov/assets/planning/download/zip/data-maps/open-data/nybb_16a.zip
boros = GeoDataFrame.from_file('nybb.shp')
boros.set_index('BoroCode', inplace=True)
boros.sort()
boros.plot()
path_nybb = gpd.datasets.get_path('nybb')
boros = GeoDataFrame.from_file(path_nybb)
boros = boros.set_index('BoroCode')
boros
##############################################################################
# Next, we'll plot the raw data
ax = boros.plot()
plt.xticks(rotation=90)
plt.savefig('nyc.png', dpi=DPI, bbox_inches='tight')
#plt.show()
##############################################################################
# We can easily retrieve the convex hull of each shape. This corresponds to
# the outer edge of the shapes.
boros.geometry.convex_hull.plot()
plt.xticks(rotation=90)
# Grab the limits which we'll use later
xmin, xmax = plt.gca().get_xlim()
ymin, ymax = plt.gca().get_ylim()
plt.savefig('nyc_hull.png', dpi=DPI, bbox_inches='tight')
#plt.show()
##############################################################################
# We'll generate some random dots scattered throughout our data, and will
# use them to perform some set operations with our boroughs. We can use
# GeoPandas to perform unions, intersections, etc.
N = 2000 # number of random points
R = 2000 # radius of buffer in feet
xmin, xmax = plt.gca().get_xlim()
ymin, ymax = plt.gca().get_ylim()
#xmin, xmax, ymin, ymax = 900000, 1080000, 120000, 280000
xc = (xmax - xmin) * np.random.random(N) + xmin
yc = (ymax - ymin) * np.random.random(N) + ymin
......@@ -40,7 +60,10 @@ boros_with_holes = boros.geometry - mp
boros_with_holes.plot()
plt.xticks(rotation=90)
plt.savefig('boros_with_holes.png', dpi=DPI, bbox_inches='tight')
plt.show()
##############################################################################
# Finally, we'll show the holes that were taken out of our boroughs.
holes = boros.geometry & mp
holes.plot()
plt.xticks(rotation=90)
......
/*This ensures that clickable links in the SG examples are the right color*/
div.section a span {
color: #2980B9 !important
}
{{ fullname | escape | underline}}
.. currentmodule:: {{ module }}
.. auto{{ objtype }}:: {{ objname }}
{% if objtype in ['class', 'method', 'function'] %}
.. include:: {{module}}.{{objname}}.examples
.. raw:: html
<div class="clear"></div>
{% endif %}
About
=====
Known issues
------------
- The ``geopy`` API has changed significantly over recent versions,
``geopy 1.10.0`` is currently supported.
.. toctree::
:maxdepth: 2
.. ipython:: python
:suppress:
import geopandas as gpd
import geopandas
import matplotlib
orig = matplotlib.rcParams['figure.figsize']
matplotlib.rcParams['figure.figsize'] = [orig[0] * 1.5, orig[1]]
......@@ -26,7 +26,7 @@ First, let's look at the most simple case where we just want continent shapes an
.. ipython:: python
world = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres'))
world = geopandas.read_file(geopandas.datasets.get_path('naturalearth_lowres'))
world = world[['continent', 'geometry']]
continents = world.dissolve(by='continent')
......@@ -39,7 +39,7 @@ If we are interested in aggregate populations, however, we can pass different fu
.. ipython:: python
world = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres'))
world = geopandas.read_file(geopandas.datasets.get_path('naturalearth_lowres'))
world = world[['continent', 'geometry', 'pop_est']]
continents = world.dissolve(by='continent', aggfunc='sum')
......
......@@ -26,12 +26,39 @@ import sys, os
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['IPython.sphinxext.ipython_console_highlighting',
'IPython.sphinxext.ipython_directive']
'IPython.sphinxext.ipython_directive',
'sphinx_gallery.gen_gallery',
'sphinx.ext.autosummary',
'sphinx.ext.intersphinx',
'sphinx.ext.autodoc',
'numpydoc',
]
# Fix issue with warnings from numpydoc (see discussion in PR #534)
numpydoc_show_class_members = False
def setup(app):
app.add_stylesheet('custom.css') # may also be an URL
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
autosummary_generate = True
# Sphinx gallery configuration
sphinx_gallery_conf = {
'examples_dirs': ['../../examples'],
'filename_pattern': '^((?!sgskip).)*$',
'gallery_dirs': ['gallery'],
'doc_module': ('geopandas',),
'reference_url': {'matplotlib': 'http://matplotlib.org',
'numpy': 'http://docs.scipy.org/doc/numpy/reference',
'scipy': 'http://docs.scipy.org/doc/scipy/reference',
'geopandas': None},
'backreferences_dir': 'reference'
}
# The suffix of source filenames.
source_suffix = '.rst'
......@@ -43,7 +70,7 @@ master_doc = 'index'
# General information about the project.
project = u'GeoPandas'
copyright = u'2013-2016, GeoPandas developers'
copyright = u'20132017, GeoPandas developers'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
......
......@@ -3,7 +3,7 @@
.. ipython:: python
:suppress:
import geopandas as gpd
import geopandas
import matplotlib
orig = matplotlib.rcParams['figure.figsize']
matplotlib.rcParams['figure.figsize'] = [orig[0] * 1.5, orig[1]]
......@@ -93,7 +93,7 @@ An example using the ``worlds`` GeoDataFrame:
.. ipython:: python
world = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres'))
world = geopandas.read_file(geopandas.datasets.get_path('naturalearth_lowres'))
world.head()
#Plot countries
......