Jia Yu created SEDONA-471:
-----------------------------

             Summary: SedonaKepler cannot work with Uber H3 hex since 1.5.1
                 Key: SEDONA-471
                 URL: https://issues.apache.org/jira/browse/SEDONA-471
             Project: Apache Sedona
          Issue Type: Bug
            Reporter: Jia Yu


Follow the example in this notebook: 
[https://github.com/apache/sedona/blob/master/binder/ApacheSedonaSQL_SpatialJoin_AirportsPerCountry.ipynb]

 

It shows the following error in the last step:

 

```
 
 
--------------------------------------------------------------------------- 
AttributeError Traceback (most recent call last) Cell In[14], line 1 ----> 1 
sedona_kepler_h3 = SedonaKepler.create_map(df=hex_exploded_h3, name="h3")  2 
sedona_kepler_h3 File 
/usr/local/lib/python3.10/dist-packages/sedona/maps/SedonaKepler.py:35, in 
SedonaKepler.create_map(cls, df, name, config)  33 kepler_map = KeplerGl()  34 
if df is not None: ---> 35 SedonaKepler.add_df(kepler_map, df, name)  37 if 
config is not None:  38 kepler_map.config = config File 
/usr/local/lib/python3.10/dist-packages/sedona/maps/SedonaKepler.py:51, in 
SedonaKepler.add_df(cls, kepler_map, df, name)  42 @classmethod  43 def 
add_df(cls, kepler_map, df, name="unnamed"):  44 """  45 Adds a SedonaDataFrame 
to a given map object.  46 :param kepler_map: Map object to add SedonaDataFrame 
to  (...)  49 :return: Does not return anything, adds df directly to the given 
map object  50 """ ---> 51 geo_df = SedonaMapUtils.__convert_to_gdf__(df)  52 
kepler_map.add_data(geo_df, name=name) File 
/usr/local/lib/python3.10/dist-packages/sedona/maps/SedonaMapUtils.py:37, in 
SedonaMapUtils.__convert_to_gdf__(cls, df, rename, geometry_col)  35 geo_df = 
gpd.GeoDataFrame(pandas_df, geometry=geometry_col)  36 if geometry_col != 
"geometry" and rename is True: ---> 37 geo_df.rename_geometry("geometry", 
inplace=True)  38 return geo_df File 
/usr/local/lib/python3.10/dist-packages/geopandas/geodataframe.py:389, in 
GeoDataFrame.rename_geometry(self, col, inplace)  356 def rename_geometry(self, 
col, inplace=False):  357 """  358 Renames the GeoDataFrame geometry column to  
359 the specified name. By default yields a new object.  (...)  387 
GeoDataFrame.set_geometry : set the active geometry  388 """ --> 389 
geometry_col = self.geometry.name  390 if col in self.columns:  391 raise 
ValueError(f"Column named {col} already exists") File 
/usr/local/lib/python3.10/dist-packages/pandas/core/generic.py:5487, in 
NDFrame.__getattr__(self, name)  5480 if (  5481 name not in 
self._internal_names_set  5482 and name not in self._metadata  5483 and name 
not in self._accessors  5484 and 
self._info_axis._can_hold_identifiers_and_holds_name(name)  5485 ):  5486 
return self[name] -> 5487 return object.__getattribute__(self, name) File 
/usr/local/lib/python3.10/dist-packages/geopandas/geodataframe.py:233, in 
GeoDataFrame._get_geometry(self)  226 else:  227 msg += (  228 "\nThere are no 
existing columns with geometry data type. You can "  229 "add a geometry column 
as the active geometry column with "  230 "df.set_geometry. "  231 ) --> 233 
raise AttributeError(msg)  234 return self[self._geometry_column_name] 
AttributeError: You are calling a geospatial method on the GeoDataFrame, but 
the active geometry column ('geometry') is not present. There are no existing 
columns with geometry data type. You can add a geometry column as the active 
geometry column with df.set_geometry.
```



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to