79319661

Date: 2024-12-31 09:56:28
Score: 2
Natty:
Report link

Dissolve is working when I try it, it finishes in a few seconds:

import geopandas as gpd
df = gpd.read_file(r"C:\Users\bera\Downloads\TM_WORLD_BORDERS-0.3.shp")
df.plot(column="NAME")

enter image description here

df2 = df.dissolve()
df2.plot()

enter image description here

There are some invalid geometries that might cause problems for you? Try fixing them:

#df.geometry.is_valid.all()
#np.False_

#Four geometries are invalid
df.loc[~df.geometry.is_valid]
#     FIPS ISO2  ...     LAT                                           geometry
# 23    CA   CA  ...  59.081  MULTIPOLYGON (((-65.61362 43.42027, -65.61972 ...
# 32    CI   CL  ... -23.389  MULTIPOLYGON (((-67.21278 -55.89362, -67.24695...
# 154   NO   NO  ...  61.152  MULTIPOLYGON (((8.74361 58.40972, 8.73194 58.4...
# 174   RS   RU  ...  61.988  MULTIPOLYGON (((131.87329 42.95694, 131.82413 ...
# [4 rows x 12 columns]


df.geometry = df.geometry.make_valid()
#df.geometry.is_valid.all()
#np.True_
Reasons:
  • Probably link only (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Ends in question mark (2):
Posted by: Bera