Managing projections using geopandas

Updated: Feb 27, 2020

A Coordinate Reference System (CRS) tells Python kernel how those coordinates are related to places on the Earth. CRS is referred to using codes called proj4 strings. PROJ.4 (or proj) is a library for performing conversions between cartographic projections. The CRS can be referred to in many ways. e.g. one of the most commonly used CRS is the WGS84 latitude-longitude projection.

One proj4 representation of this projection is:

"+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs".

However, common projections can also be referred to by EPSG codes, so this same projection can be called using the proj4 string "+init=epsg:4326".

geopandas can accept lots of representations of CRS, including the proj4 string itself

("+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs")

or parameters broken out in a dictionary:

{'proj': 'latlong', 'ellps': 'WGS84', 'datum': 'WGS84', 'no_defs': True}).

In addition, some functions will take EPSG codes directly.

For reference, following are proj4 strings for common projections: -

  • WGS84 Latitude/Longitude: "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs" or "+init=epsg:4326"

  • UTM Zones (North): "+proj=utm +zone=33 +ellps=WGS84 +datum=WGS84 +units=m +no_defs"

  • UTM Zones (South): "+proj=utm +zone=33 +ellps=WGS84 +datum=WGS84 +units=m +no_defs +south"

Setting a Projection

Setting a projection is how one tells geopandas how to interpret coordinates. If no CRS is set, geopandas geometry operations will still work, but coordinate transformations will not be possible and exported files may not be interpreted correctly by other software. One can see an objects' current CRS through the crs attribute:


Re-projecting is the process of changing the representation of locations from one coordinate system to another. All projections of locations on the Earth into a two-dimensional plane are distortions. The projection that is best for an application may be different from the projection associated with the data which is imported. In these cases, data can be re-projected using the to_crs command.

# load example data world = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres')) # Check original projection # (it's Platte Carre! x-y are long and lat) Out[2]: {'init': 'epsg:4326'} # Visualize ax = world.plot() ax.set_title("WGS84 (lat/lon)"); # Reproject to Mercator (after dropping Antartica) world = world[( != "Antarctica") & ( != "Fr. S. Antarctic Lands")] world = world.to_crs({'init': 'epsg:3395'}) # world.to_crs(epsg=3395) would also work ax = world.plot() ax.set_title("Mercator");

Interested to discuss any related technical problem. Write to us at

155 views0 comments

Recent Posts

See All