How does GeoPandas save CRS information?

globe = ccrs.Globe(ellipse='sphere', semimajor_axis=6370000, semiminor_axis=6370000)

crs = ccrs.LambertConformal(globe=globe,central_longitude=111, central_latitude=33,
                            standard_parallels=(30, 60))
crs_proj4 = crs.proj4_init

gdf.crs = ccrs.PlateCarree().proj4_init
gdf.to_crs(crs_proj4, inplace=True)

and then


returns False.

  • can you print the outputs of gpd.read_file(r'/Users/sam/Documents/grid_source.shp').crs and gdf.crs
    – Joe Be
    Nov 11, 2021 at 9:25

1 Answer 1


IMHO you do not need the inplace=True parameter in your code and also besides re-projecting you also need to set the new crs.

So, the entire code can look like

import geopandas as gpd
import cartopy.crs as ccrs

globe = ccrs.Globe(ellipse='sphere', semimajor_axis=6370000, semiminor_axis=6370000)
crs = ccrs.LambertConformal(globe=globe, central_longitude=111, central_latitude=33, standard_parallels=(30, 60))
crs_proj4 = crs.proj4_init

gdf = gpd.read_file('P:/Test/qgis_test/grid_test.shp')

gdf.crs = ccrs.PlateCarree().proj4_init
gdf = gdf.to_crs(crs_proj4)
gdf.crs = crs_proj4


So, after reading the output from the above code

gdf2 = gpd.read_file('P:/Test/qgis_test/grid_test2.shp')

you may get the following output



  • 1
    Small comment on your code: it is currently not keeping the reprojected data. You need to re-assign it: gdf = gdf.to_crs(crs_proj4) (and not set the crs afterwards)
    – joris
    Nov 11, 2021 at 14:57
  • Please feel free to adjust it 🙂
    – Taras
    Nov 11, 2021 at 14:58
  • 1
    gdf.to_crs(crs_proj4, inplace=True) may means gdf = gdf.to_crs(crs_proj4), and Thanks for helping! It did't influece my own work but I need to exchange someting with my co-workers.
    – sam han
    Nov 18, 2021 at 14:49
  • You are welcome. Please, do not forget about "What should I do when someone answers my question?"
    – Taras
    Nov 19, 2021 at 6:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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