Skip to content
Commits on Source (5)
......@@ -9,6 +9,7 @@ __pycache__/
# Distribution / packaging
.Python
env/
venv*/
build/
dist/
eggs/
......
......@@ -9,27 +9,31 @@ matrix:
# Python 2.7 and 3.6 test all supported Pandas versions
- env: ENV_FILE="ci/travis/27-pd020.yaml"
- env: ENV_FILE="ci/travis/27-pd023.yaml"
- env: ENV_FILE="ci/travis/27-latest-defaults.yaml"
- env: ENV_FILE="ci/travis/27-dev.yaml"
- env: ENV_FILE="ci/travis/27-latest-conda-forge.yaml"
- env: ENV_FILE="ci/travis/36-pd020.yaml"
- env: ENV_FILE="ci/travis/36-pd022.yaml"
- env: ENV_FILE="ci/travis/37-latest-defaults.yaml"
- env: ENV_FILE="ci/travis/37-latest-conda-forge.yaml"
- env: ENV_FILE="ci/travis/37-dev.yaml"
- env: ENV_FILE="ci/travis/37-dev.yaml" DEV=true
install:
# Install conda
- wget http://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -O miniconda.sh
- wget https://repo.continuum.io/miniconda/Miniconda3-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
- conda info
# Install dependencies
- conda env create --file="${ENV_FILE}"
- source activate test
- if [ "$DEV" ]; then pip install git+https://github.com/pydata/pandas.git; fi
- if [ "$DEV" ]; then pip install git+https://github.com/matplotlib/matplotlib.git; fi
- pip install -e .
- conda list
......
Changes
=======
Version 0.5.0 (April 25, 2019)
---------------------------------
Improvements:
* Significant performance improvement (around 10x) for `GeoDataFrame.iterfeatures`,
which also improves `GeoDataFrame.to_file` (#864).
* File IO enhancements based on Fiona 1.8:
* Support for writing bool dtype (#855) and datetime dtype, if the file format supports it (#728).
* Support for writing dataframes with multiple geometry types, if the file format allows it (e.g. GeoJSON for all types, or ESRI Shapefile for Polygon+MultiPolygon) (#827, #867, #870).
* Compatibility with pyproj >= 2 (#962).
* A new `geopandas.points_from_xy()` helper function to convert x and y coordinates to Point objects (#896).
* The `buffer` and `interpolate` methods now accept an array-like to specify a variable distance for each geometry (#781).
* Addition of a `relate` method, corresponding to the shapely method that returns the DE-9IM matrix (#853).
* Plotting improvements:
* Performance improvement in plotting by only flattening the geometries if there are actually 'Multi' geometries (#785).
* Choropleths: access to all `mapclassify` classification schemes and addition of the `classification_kwds` keyword in the `plot` method to specify options for the scheme (#876).
* Ability to specify a matplotlib axes object on which to plot the color bar with the `cax` keyword, in order to have more control over the color bar placement (#894).
* Changed the default provider in ``geopandas.tools.geocode`` from Google (now requires an API key) to Geocode.Farm (#907, #975).
Bug fixes:
- Remove the edge in the legend marker (#807).
- Fix the `align` method to preserve the CRS (#829).
- Fix `geopandas.testing.assert_geodataframe_equal` to correctly compare left and right dataframes (#810).
- Fix in choropleth mapping when the values contain missing values (#877).
- Better error message in `sjoin` if the input is not a GeoDataFrame (#842).
- Fix in `read_postgis` to handle nullable (missing) geometries (#856).
- Correctly passing through the `parse_dates` keyword in `read_postgis` to the underlying pandas method (#860).
- Fixed the shape of Antarctica in the included demo dataset 'naturalearth_lowres'
(by updating to the latest version) (#804).
Version 0.4.1 (March 5, 2019)
-----------------------------
......
......@@ -28,7 +28,7 @@ In particular, when submitting a pull request:
- Classes, methods, functions, etc. should have docstrings. The first
line of a docstring should be a standalone summary. Parameters and
return values should be ducumented explicitly.
return values should be documented explicitly.
Improving the documentation and testing for code already in GeoPandas
is a great way to get started if you'd like to make a contribution.
......@@ -36,19 +36,19 @@ is a great way to get started if you'd like to make a contribution.
Style
-----
- GeoPandas supports python 2 (2.6+) and python 3 (3.2+) with a single
code base. Use modern python idioms when possible that are
compatibile with both major versions, and use the
- GeoPandas supports Python 2 (2.7+) and Python 3 (3.5+) with a single
code base. Use modern Python idioms when possible that are
compatible with both major versions, and use the
[six](https://pythonhosted.org/six) library where helpful to smooth
over the differences. Use `from __future__ import` statements where
appropriate. Test code locally in both python 2 and python 3 when
appropriate. Test code locally in both Python 2 and Python 3 when
possible (all supported versions will be automatically tested on
Travis CI).
- Follow PEP 8 when possible.
- Imports should be grouped with standard library imports first,
3rd-party libraries next, and geopandas imports third. Within each
3rd-party libraries next, and GeoPandas imports third. Within each
grouping, imports should be alphabetized. Always use absolute
imports when possible, and explicit relative imports for local
imports when necessary in tests.
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)
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) [![DOI](https://zenodo.org/badge/11002815.svg)](https://zenodo.org/badge/latestdoi/11002815)
=========
Python tools for geographic data
......@@ -10,7 +10,7 @@ GeoPandas is a project to add support for geographic data to
[pandas](http://pandas.pydata.org) objects. It currently implements
`GeoSeries` and `GeoDataFrame` types which are subclasses of
`pandas.Series` and `pandas.DataFrame` respectively. GeoPandas
objects can act on [shapely](http://toblerity.github.io/shapely)
objects can act on [shapely](http://shapely.readthedocs.io/en/latest/)
geometry objects and perform geometric operations.
GeoPandas geometry operations are cartesian. The coordinate reference
......@@ -43,6 +43,15 @@ dependency, required for spatial joins. ``rtree`` requires the C library [``libs
Those packages depend on several low-level libraries for geospatial analysis, which can be a challenge to install. Therefore, we recommend to install GeoPandas using the [conda package manager](https://conda.io/en/latest/). See the [installation docs](https://geopandas.readthedocs.io/en/latest/install.html) for more details.
Get in touch
------------
- Ask usage questions ("How do I?") on [StackOverflow](https://stackoverflow.com/questions/tagged/geopandas) or [GIS StackExchange](https://gis.stackexchange.com/questions/tagged/geopandas).
- Report bugs, suggest features or view the source code [on GitHub](https://github.com/geopandas/geopandas).
- For a quick question about a bug report or feature request, or Pull Request, head over to the [gitter channel](https://gitter.im/geopandas/geopandas).
- For less well defined questions or ideas, or to announce other projects of interest to GeoPandas users, ... use the [mailing list](https://groups.google.com/forum/#!forum/geopandas).
Examples
--------
......@@ -81,7 +90,7 @@ GeoPandas objects also know how to plot themselves. GeoPandas uses [descartes](
>>> g.plot()
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):
GeoPandas also implements alternate constructors that can read any data format recognized by [fiona](http://fiona.readthedocs.io/en/latest/). 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 = geopandas.read_file(nybb_path)
......
import os
import shutil
import tempfile
from geopandas import GeoDataFrame, GeoSeries
import numpy as np
from shapely.geometry import Point
class Bench:
# extensions for different file types to test
params = [".shp", ".json", ".gpkg"]
param_names = ["ext"]
def setup(self, ext):
self.driver_dict = {".shp": "ESRI Shapefile",
".json": "GeoJSON",
".gpkg": "GPKG"}
driver = self.driver_dict[ext]
num_points = 20000
xs = np.random.rand(num_points)
ys = np.random.rand(num_points)
self.points = GeoSeries([Point(x, y) for (x, y) in zip(xs, ys)])
self.df = GeoDataFrame({"geometry": self.points, "x": xs, "y": ys,
"s": np.zeros(num_points, dtype="object")})
self.tmpdir = tempfile.mkdtemp()
self.series_filename = os.path.join(self.tmpdir, "series" + ext)
self.frame_filename = os.path.join(self.tmpdir, "frame" + ext)
self.points.to_file(self.series_filename, driver=driver)
self.df.to_file(self.frame_filename, driver=driver)
def teardown(self, ext):
shutil.rmtree(self.tmpdir)
def time_write_frame(self, ext):
driver = self.driver_dict[ext]
with tempfile.TemporaryDirectory() as tmpdir:
out_filename = os.path.join(tmpdir, "frame" + ext)
self.df.to_file(out_filename, driver=driver)
def time_write_series(self, ext):
driver = self.driver_dict[ext]
with tempfile.TemporaryDirectory() as tmpdir:
out_filename = os.path.join(tmpdir, "series" + ext)
self.points.to_file(out_filename, driver=driver)
def time_read_frame(self, ext):
frame = GeoDataFrame.from_file(self.frame_filename)
def time_read_series(self, ext):
points = GeoSeries.from_file(self.series_filename)
def time_read_series_from_frame(self, ext):
points = GeoSeries.from_file(self.frame_filename)
......@@ -22,6 +22,7 @@ dependencies:
#- geopy
- SQLalchemy
- psycopg2
- libspatialite
- pip:
- codecov
- geopy
......@@ -21,6 +21,7 @@ dependencies:
#- geopy
- SQLalchemy
- psycopg2
- libspatialite
- pip:
- codecov
- geopy
......
......@@ -20,7 +20,8 @@ dependencies:
- rtree
- matplotlib==2.0.2
- descartes
- pysal=1
- geopy
- SQLalchemy
- psycopg2
- libspatialite
- mapclassify==1.0.1
......@@ -6,9 +6,9 @@ dependencies:
- six
- cython
# required
- pandas
- pandas=0.23
- shapely
- fiona
- fiona=1.7
- pyproj
# testing
- pytest
......@@ -22,8 +22,8 @@ dependencies:
#- geopy
- SQLalchemy
- psycopg2
- libspatialite
- pip:
- git+https://github.com/pydata/pandas.git
- codecov
- geopy
- mapclassify==1.0.1
......@@ -6,9 +6,10 @@ dependencies:
- python=3.5
- six
# required
- numpy=1.12
- pandas==0.19.2
- shapely=1.5
- fiona
- fiona=1.7
- pyproj
# testing
- pytest
......@@ -16,9 +17,12 @@ dependencies:
- codecov
# optional
- rtree
- matplotlib==1.5.3
- matplotlib
- descartes
- mapclassify
- geopy
- SQLalchemy
- psycopg2
- libspatialite
- pip:
- matplotlib==1.5.3
......@@ -23,3 +23,4 @@ dependencies:
- geopy
- SQLalchemy
- psycopg2
- libspatialite
......@@ -7,7 +7,7 @@ dependencies:
# required
- pandas=0.22
- shapely
- fiona
- fiona=1.7
- pyproj
# testing
- pytest
......@@ -20,6 +20,7 @@ dependencies:
#- geopy
- SQLalchemy
- psycopg2
- libspatialite
- pip:
- codecov
- geopy
......
......@@ -21,9 +21,8 @@ dependencies:
#- geopy
- SQLalchemy
- psycopg2
- libspatialite
- pip:
- git+https://github.com/matplotlib/matplotlib.git
- git+https://github.com/pydata/pandas.git
- codecov
- geopy
- mapclassify
......@@ -21,3 +21,4 @@ dependencies:
- geopy
- SQLalchemy
- psycopg2
- libspatialite
......@@ -20,6 +20,7 @@ dependencies:
#- geopy
- SQLalchemy
- psycopg2
- libspatialite
- pip:
- codecov
- geopy
......
python-geopandas (0.5.0-1~exp1) experimental; urgency=medium
* Team upload.
* New upstream release.
* Refresh patches.
-- Bas Couwenberg <sebastic@debian.org> Thu, 25 Apr 2019 15:25:19 +0200
python-geopandas (0.4.1-1~exp1) experimental; urgency=medium
* Team upload.
......
......@@ -12,7 +12,7 @@ Forwarded: not-needed
'sphinx.ext.autosummary',
'sphinx.ext.intersphinx',
'sphinx.ext.autodoc',
@@ -49,19 +48,6 @@ templates_path = ['_templates']
@@ -55,19 +54,6 @@ templates_path = ['_templates']
autosummary_generate = True
......@@ -23,7 +23,7 @@ Forwarded: not-needed
- 'gallery_dirs': ['gallery'],
- 'doc_module': ('geopandas',),
- 'reference_url': {'matplotlib': 'http://matplotlib.org',
- 'numpy': 'http://docs.scipy.org/doc/numpy/reference',
- 'numpy': 'http://docs.scipy.org/doc/numpy',
- 'scipy': 'http://docs.scipy.org/doc/scipy/reference',
- 'geopandas': None},
- 'backreferences_dir': 'reference'
......
......@@ -22,6 +22,6 @@ dependencies:
- cartopy=0.17.0
- contextily=1.0rc1
- rasterio=1.0.21
- geoplot=0.2.3
- geoplot=0.2.4
- sphinx-gallery=0.2.0
- jinja2=2.10
......@@ -10,9 +10,9 @@
Aggregation with dissolve
=============================
It is often the case that we find ourselves working with spatial data that is more granular than we need. For example, we might have data on sub-national units, but we're actually interested in studying patterns at the level of countries.
Spatial data are often more granular than we need. For example, we might have data on sub-national units, but we're actually interested in studying patterns at the level of countries.
In a non-spatial setting, we aggregate our data using the ``groupby`` function. But when working with spatial data, we need a special tool that can also aggregate geometric features. In the *geopandas* library, that functionality is provided by the ``dissolve`` function.
In a non-spatial setting, when all we need are summary statistics of the data, we aggregate our data using the ``groupby`` function. But for spatial data, we sometimes also need to aggregate geometric features. In the *geopandas* library, we can aggregate geometric features using the ``dissolve`` function.
``dissolve`` can be thought of as doing three things: (a) it dissolves all the geometries within a given group together into a single geometric feature (using the ``unary_union`` method), and (b) it aggregates all the rows of data in a group using ``groupby.aggregate()``, and (c) it combines those two results.
......@@ -35,7 +35,7 @@ First, let's look at the most simple case where we just want continent shapes an
continents.head()
If we are interested in aggregate populations, however, we can pass different functions to the ``dissolve`` method to aggregate populations:
If we are interested in aggregate populations, however, we can pass different functions to the ``dissolve`` method to aggregate populations using the ``aggfunc =`` argument:
.. ipython:: python
......@@ -57,3 +57,17 @@ If we are interested in aggregate populations, however, we can pass different fu
.. toctree::
:maxdepth: 2
Dissolve Arguments
~~~~~~~~~~~~~~~~~~
The ``aggfunc =`` argument defaults to 'first' which means that the first row of attributes values found in the dissolve routine will be assigned to the resultant dissolved geodataframe.
However it also accepts other summary statistic options as allowed by ``pandas.groupby()`` including:
* 'first'
* 'last'
* 'min'
* 'max'
* 'sum'
* 'mean'
* 'median'