3

I have a geoDataFrame with crs {'init': 'epsg:4326'} The data has a global extent and my goal is to calculate the area (in m2) per feature. Therefore I want to reproject the geoDataFrame using the

gdf.to_crs({'init':'epsg:xxxx'})

method. I looked into suitable global equal area projections and found Eckert IV. However I cannot find an EPSG code for this projection. Is there a way to

  1. use an ESRI code in geopandas (proj4 under the hood) e.g. ESRI:54012 ? or should I
  2. use another global equal area projection crs for which an epsg is available.

EDIT: using the proj4 definition string works. Make sure you click proj4 and not just copy the definition on top. (without the +ellps=WGS84 part). Notebook

1 Answer 1

4

The to_crs method also accepts the full proj4 string specification (or in dictionary presentation), so you can do

gdf = gdf.to_crs("+proj=eck4 +lon_0=0 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs")

without the need for an EPSG code (proj4 definition from https://epsg.io/54012)

2
  • Thanks, I copied the definition string from the top of the page which contains an extra '+ellps=WGS84'. Now it works. See notebook attached.
    – RutgerH
    Jun 5, 2018 at 14:34
  • This was by far the easiest volume to flux conversion ever. Thanks geopandas. It would be great to add an example using a proj4 string in the docs: geopandas.org/projections.html#setting-a-projection
    – RutgerH
    Jun 5, 2018 at 15:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.