3

I have two geodataframes which I would like to concatenate. I have tried this:

test=gpd.GeoDataFrame( pd.concat( [gdf1, gdf2], ignore_index=True) )

where print(gdf1.columns) and print(gdf2.columns) both give

Index(['ville', 'objectid', 'geometry', 'area_km2'], dtype='object')

and where print(gdf1.geometry.crs) and print(gdf2.geometry.crs) both give +init=epsg:4326 +type=crs

yet i am getting this error:

ValueError: Cannot determine common CRS for concatenation inputs, got ['WGS 84', 'WGS 84']. Use to_crs() to transform geometries to the same CRS before merging.

Output is truncated. View as a scrollable element or open in a text editor. Adjust cell output settings...

How can this be possible when both CRS are on 4326 (GPS)

Any idea?

1
  • It is false but print(gd1.crs) and print(gdf2.crs) both give 4326
    – bravopapa
    Commented May 25, 2023 at 10:12

1 Answer 1

4

Try resetting the crs's to make sure they are the same:

gdf1 = gdf1.to_crs("epsg:4326")
gdf2 = gdf2.to_crs("epsg:4326")

then concat

Your Answer

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

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