@@ -177,10 +177,14 @@ def __eq__(self, other):
177177
178178 try :
179179 pd .testing .assert_frame_equal (self .gdf , other .gdf , check_like = True )
180- return True
181180 except AssertionError :
182181 return False
183182
183+ if not (self .gdf .geometry == other .gdf .geometry ).all ():
184+ return False
185+
186+ return True
187+
184188 def to_default_crs (self , inplace = True ):
185189 """Project the current centroids to the default CRS (epsg4326)
186190
@@ -483,11 +487,11 @@ def plot(self, *, axis=None, figsize=(9, 13), **kwargs):
483487 -------
484488 ax : cartopy.mpl.geoaxes.GeoAxes instance
485489 """
486- if axis == None :
490+ if axis is None :
487491 fig , axis = plt .subplots (
488492 figsize = figsize , subplot_kw = {"projection" : ccrs .PlateCarree ()}
489493 )
490- if type (axis ) != cartopy .mpl .geoaxes .GeoAxes :
494+ if type (axis ) is not cartopy .mpl .geoaxes .GeoAxes :
491495 raise AttributeError (
492496 f"The axis provided is of type: { type (axis )} "
493497 "The function requires a cartopy.mpl.geoaxes.GeoAxes."
@@ -964,13 +968,19 @@ def from_hdf5(cls, file_name):
964968 # the CRS was stored in '_crs'/'crs'
965969 crs = metadata .get ("crs" )
966970 gdf = gpd .GeoDataFrame (store ["centroids" ])
967- for xycol in metadata .get ("xy_columns" , []):
968- gdf [xycol ] = gpd .points_from_xy (
969- x = gdf [xycol + ".x" ], y = gdf [xycol + ".y" ], crs = crs
970- )
971- gdf .drop (columns = [xycol + ".x" , xycol + ".y" ], inplace = True )
972- for wkbcol in metadata .get ("wkb_columns" , []):
973- gdf [wkbcol ] = gpd .GeoSeries .from_wkb (gdf [wkbcol ], crs = crs )
971+ with warnings .catch_warnings ():
972+ # setting a column named 'geometry' triggers a future warning
973+ # with geopandas 0.14
974+ warnings .simplefilter (action = "ignore" , category = FutureWarning )
975+
976+ for xycol in metadata .get ("xy_columns" , []):
977+ gdf [xycol ] = gpd .points_from_xy (
978+ x = gdf [xycol + ".x" ], y = gdf [xycol + ".y" ], crs = crs
979+ )
980+ gdf .drop (columns = [xycol + ".x" , xycol + ".y" ], inplace = True )
981+ for wkbcol in metadata .get ("wkb_columns" , []):
982+ gdf [wkbcol ] = gpd .GeoSeries .from_wkb (gdf [wkbcol ], crs = crs )
983+ gdf .set_geometry ("geometry" , crs = crs , inplace = True )
974984
975985 except TypeError :
976986 with h5py .File (file_name , "r" ) as data :
0 commit comments