Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel
Integration:  git github
Martin Fleischmann 14c7a48343
RLS: 0.12.2 changelog (#2672)
1 year ago
00ac5dce16
Bump actions/setup-python from 3 to 4 (#2646)
1 year ago
5dc982edbf
blacken the rest of the code (docs, benchmarks) (#2636)
1 year ago
ci
7ccd92943b
CI: add Python 3.11 to the test matrix (#2627)
1 year ago
doc
5ee690dc70
DOC: Changelog formatting (#2662)
1 year ago
60552cbff9
DEV: rename master to main (#2277)
2 years ago
361cd183da
BUG: assign Crimea to Ukraine in naturalearth_lowres (#2670)
1 year ago
afa6806a1d
Update naturalearth_lowres dataset to v5.0.1 (#2418)
1 year ago
dd815ac9d1
MNT/BLD: use versioneer
8 years ago
afa6806a1d
Update naturalearth_lowres dataset to v5.0.1 (#2418)
1 year ago
3bfd13f618
pre-commit config: Add auto update schedule (#2635)
1 year ago
14c7a48343
RLS: 0.12.2 changelog (#2672)
1 year ago
3cbc7fb997
Add a Code of Conduct (#1288)
4 years ago
28462f8e7f
DOC: add changelog for main (#2473)
1 year ago
b39e5de8e5
DOC: Update copyright year, fix 3rd clause ref to GeoPandas (#2532)
1 year ago
9fa6bffede
Ensure to package license file (#795)
5 years ago
572d284e01
DOC: add pypi badge (#2412)
2 years ago
b50fe9f81c
Add conda-forge to asv.conf.json. (#1390)
4 years ago
e833bd5cd1
CI: codecov yml (#1629)
3 years ago
a775361608
Create constraints.txt: rtree
8 years ago
ff5ed7eab9
DEP: bump required versions of dependecies (#2358)
2 years ago
4346120b5e
REF: replace deprecated distutils LooseVersion with packaging parse (#2084)
2 years ago
80ac94e17a
CI: Filter distutils Version warnings from pytest output (#2632)
1 year ago
ca61933746
Update Read the Docs configuration (automatic) (#2309)
2 years ago
ff5ed7eab9
DEP: bump required versions of dependecies (#2358)
2 years ago
80ac94e17a
CI: Filter distutils Version warnings from pytest output (#2632)
1 year ago
89e53d6877
MAINT: move static metadata to pyproject.toml (#2512)
1 year ago
abe2179f82
Update Versioneer (#2640)
1 year ago
Storage Buckets

README.md

You have to be logged in to leave a comment. Sign In

pypi Actions Status Coverage Status Join the chat at https://gitter.im/geopandas/geopandas Binder DOI

GeoPandas

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

Further, matplotlib is an optional dependency, 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

>>> import geopandas
>>> from shapely.geometry import Polygon
>>> 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 0, 1 0, 1 1, 0 0))
1    POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0))
2    POLYGON ((2 0, 3 0, 3 1, 2 1, 2 0))
dtype: geometry

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)
0    POLYGON ((-0.3535533905932737 0.35355339059327...
1    POLYGON ((-0.5 0, -0.5 1, -0.4975923633360985 ...
2    POLYGON ((1.5 0, 1.5 1, 1.502407636663901 1.04...
dtype: geometry

Example 2

GeoPandas objects also know how to plot themselves. GeoPandas uses matplotlib for plotting. 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_index(inplace=True)
>>> boros
               BoroName     Shape_Leng    Shape_Area  \
BoroCode
1             Manhattan  359299.096471  6.364715e+08
2                 Bronx  464392.991824  1.186925e+09
3              Brooklyn  741080.523166  1.937479e+09
4                Queens  896344.047763  3.045213e+09
5         Staten Island  330470.010332  1.623820e+09

                                                   geometry
BoroCode
1         MULTIPOLYGON (((981219.0557861328 188655.31579...
2         MULTIPOLYGON (((1012821.805786133 229228.26458...
3         MULTIPOLYGON (((1021176.479003906 151374.79699...
4         MULTIPOLYGON (((1029606.076599121 156073.81420...
5         MULTIPOLYGON (((970217.0223999023 145643.33221...

New York City boroughs

>>> boros['geometry'].convex_hull
BoroCode
1    POLYGON ((977855.4451904297 188082.3223876953,...
2    POLYGON ((1017949.977600098 225426.8845825195,...
3    POLYGON ((988872.8212280273 146772.0317993164,...
4    POLYGON ((1000721.531799316 136681.776184082, ...
5    POLYGON ((915517.6877458114 120121.8812543372,...
dtype: geometry

Convex hulls of New York City boroughs

Tip!

Press p or to see the previous file or, n or to see the next file

About

Python tools for geographic data

Collaborators 1

Comments

Loading...