Skip to content

Commit

Permalink
Merge pull request #1726 from CartoDB/fix_rename_geometry_to_carto
Browse files Browse the repository at this point in the history
Avoid renaming geometry if geometry name is already GEOM_COLUMN_NAME
  • Loading branch information
Mmoncadaisla authored Mar 17, 2021
2 parents b54c0ac + a5c48ad commit 85f4a9a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cartoframes/io/carto.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ def to_carto(dataframe, table_name, credentials=None, if_exists='fail', geom_col
gdf.drop(columns=[GEOM_COLUMN_NAME], inplace=True)

# Prepare geometry column for the upload
gdf.rename_geometry(GEOM_COLUMN_NAME, inplace=True)
if dataframe.geometry.name != GEOM_COLUMN_NAME:
gdf.rename_geometry(GEOM_COLUMN_NAME, inplace=True)

elif isinstance(dataframe, GeoDataFrame):
log.warning('Geometry column not found in the GeoDataFrame.')
Expand Down

0 comments on commit 85f4a9a

Please sign in to comment.