Skip to content
Python tools for geographic data
Branch: master
Clone or download
Lashuk1729 and martinfleis DOC: Adding Example for interactive point plot with folium (#969)
* Adding example for Plotting with Folium

* Adding HeatMap in plotting with folium example

* Adding HeatMap in plotting with folium example

* Updating and tried to fix the issue.

* Update examples/plotting_with_folium.ipynb

Co-Authored-By: Martin Fleischmann <36797143+martinfleis@users.noreply.github.com>

* Updated and made the suggested changes

* Delete ne_110m_admin_0_countries.zip
Latest commit 5dccac7 May 20, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
benchmarks Add very basic benchmarks for file reading/writing (#890) Jan 7, 2019
ci/travis CI: too old fiona installed on py3.5-minimal build (#985) Apr 25, 2019
doc DOC: updated year in copyright Apr 27, 2019
examples DOC: Adding Example for interactive point plot with folium (#969) May 20, 2019
geopandas CLN: Use read_file from geodataframe in geoseries (#887) May 19, 2019
.coveragerc TST: clean requirements.txt, add pysal on travis, omit _versions.py f… Aug 25, 2017
.gitattributes MNT/BLD: use versioneer May 31, 2016
.gitignore ENH: write GeoDataFrame with mixed geometry types (#870) Apr 17, 2019
.travis.yml CI: too old fiona installed on py3.5-minimal build (#985) Apr 25, 2019
CHANGELOG.md update changelog Apr 25, 2019
CONTRIBUTING.md Contributing file updates python 2.7 instead of 2.6 + a few other syn… Nov 8, 2018
LICENSE.txt Update copyright date Jun 10, 2016
MANIFEST.in Ensure to package license file (#795) Aug 14, 2018
README.md DOC: add different communication channels to README/docs (#977) Apr 19, 2019
appveyor.yml TST: fix to_csv test on Windows (#904) Jan 26, 2019
asv.conf.json Start adding an asv benchmark suite (#497) Aug 20, 2017
constraints.txt Create constraints.txt: rtree Dec 3, 2015
readthedocs.yml DOC/BLD: readthedocs version 2 config file (#934) Mar 6, 2019
requirements.test.txt TST: fix to_csv test on Windows (#904) Jan 26, 2019
requirements.txt BUG/COMPAT: fix fillna by filling with Polygon instead of Point (#512) Aug 28, 2017
setup.cfg Fix usage of versioneer in setup.py (#362) Jul 24, 2016
setup.py Fix broken links to Shapely and Fiona docs (#954) Apr 1, 2019
versioneer.py MNT/BLD: use versioneer May 31, 2016

README.md

GeoPandas build status Coverage Status Join the chat at https://gitter.im/geopandas/geopandas Binder DOI

Python tools for geographic data

Introduction

GeoPandas is a project to add support for geographic data to pandas objects. It currently implements GeoSeries and GeoDataFrame types which are subclasses of pandas.Series and pandas.DataFrame respectively. GeoPandas objects can act on shapely geometry objects and perform geometric operations.

GeoPandas geometry operations are cartesian. The coordinate reference system (crs) can be stored as an attribute on an object, and is automatically set when loading from a file. Objects may be transformed to new coordinate systems with the to_crs() method. There is currently no enforcement of like coordinates for operations, but that may change in the future.

Documentation is available at geopandas.org (current release) and Read the Docs (release and development versions).

Install

See the installation docs for all details. GeoPandas depends on the following packages:

  • pandas
  • shapely
  • fiona
  • pyproj

Further, descartes and matplotlib are optional dependencies, required for plotting, and rtree is an optional dependency, required for spatial joins. rtree requires the C library libspatialindex.

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. See the installation docs for more details.

Get in touch

  • Ask usage questions ("How do I?") on StackOverflow or GIS StackExchange.
  • Report bugs, suggest features or view the source code on GitHub.
  • For a quick question about a bug report or feature request, or Pull Request, head over to the gitter channel.
  • For less well defined questions or ideas, or to announce other projects of interest to GeoPandas users, ... use the mailing list.

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 = geopandas.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

Example 1

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:

>>> print g.area
0    0.5
1    1.0
2    1.0
dtype: float64

Other operations return GeoPandas objects:

>>> 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

Example 2

GeoPandas objects also know how to plot themselves. GeoPandas uses descartes to generate a matplotlib plot. To generate a plot of our GeoSeries, use:

>>> g.plot()

GeoPandas also implements alternate constructors that can read any data format recognized by fiona. To read a zip file containing an ESRI shapefile with the boroughs boundaries of New York City (GeoPandas includes this as an example dataset):

>>> nybb_path = geopandas.datasets.get_path('nybb')
>>> boros = geopandas.read_file(nybb_path)
>>> 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...

New York City boroughs

>>> 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

Convex hulls of New York City boroughs

You can’t perform that action at this time.