ai4er-cdt / geograph

GeoGraph provides a tool for analysing habitat fragmentation and related problems in landscape ecology. GeoGraph builds a geospatially referenced graph from land cover or field survey data and enables graph-based landscape ecology analysis as well as interactive visualizations.
https://geograph.readthedocs.io
MIT License
39 stars 10 forks source link

Regarding projection system(crs) for graph generation #95

Open rockbusteriitk opened 9 months ago

rockbusteriitk commented 9 months ago

Hi,

I tried theEPSG:3857 Projection.

"from geograph import GeoGraph data= r'D:\Geograph\lulc_test\lulc_2021.tif' graph = GeoGraph(data,crs="EPSG:3857")"

and

"from geograph.visualisation.geoviewer import GeoGraphViewer viewer = GeoGraphViewer() viewer.add_graph(graph, name='my_graph')

viewer.enable_graph_controls()

viewer"

and I received the error: "AttributeError Traceback (most recent call last) Cell In[5], line 3 1 from geograph.visualisation.geoviewer import GeoGraphViewer 2 viewer = GeoGraphViewer() ----> 3 viewer.add_graph(graph, name='my_graph') 4 #viewer.enable_graph_controls() 5 viewer

File ~\anaconda3\envs\geograph-local\lib\site-packages\geograph\visualisation\geoviewer.py:231, in GeoGraphViewer.add_graph(self, graph, name, with_components) 226 self.logger.debug("Creating graph geometries layer (graph_geo_data).") 227 nodes, edges = graph_utils.create_node_edge_geometries( 228 current_graph, crs=self.gpd_crs_code 229 ) 230 graph_geo_data = ipyleaflet.GeoData( --> 231 geo_dataframe=edges.append(nodes) 232 .to_frame(name="geometry") 233 .reset_index(), 234 name=current_name + "_graph", 235 **self.layer_style["graph"] 236 ) 238 # Creating choropleth layer for patch polygons 239 self.logger.debug("Creating patch polygons layer (pgon_choropleth).")

File ~\anaconda3\envs\geograph-local\lib\site-packages\geopandas\geoseries.py:235, in GeoSeries.append(self, *args, kwargs) 234 def append(self, *args, *kwargs): --> 235 return self._wrapped_pandas_method("append", args, kwargs)

File ~\anaconda3\envs\geograph-local\lib\site-packages\geopandas\geoseries.py:622, in GeoSeries._wrapped_pandas_method(self, mtd, *args, kwargs) 620 def _wrapped_pandas_method(self, mtd, *args, *kwargs): 621 """Wrap a generic pandas method to ensure it returns a GeoSeries""" --> 622 val = getattr(super(), mtd)(args, kwargs) 623 if type(val) == Series: 624 val.class = GeoSeries

AttributeError: 'super' object has no attribute 'append"

What might be the problem and is there a wayaround?

lucbettaieb commented 4 months ago

I'm also getting this error.

lucbettaieb commented 4 months ago

Looks like it's related to the append function being deprecated in pandas.

Similar issue: https://stackoverflow.com/questions/75956209/error-dataframe-object-has-no-attribute-append

Can get around it by updating functions similar to this: https://github.com/geopandas/geopandas/issues/2606