Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem loading branches #47

Open
Ni3lz87 opened this issue Jun 1, 2023 · 1 comment
Open

Problem loading branches #47

Ni3lz87 opened this issue Jun 1, 2023 · 1 comment

Comments

@Ni3lz87
Copy link

Ni3lz87 commented Jun 1, 2023

I got the following error while trying to load branches from the example data::


TypeError Traceback (most recent call last)
Cell In[15], line 5
2 gpkg_file = "C:/Users/ngra/Documents/Python Scripts/Dhydro_Model/delft3dfmpy-master/data/gpkg/Example_model.gpkg"
4 # branches
----> 5 hydamo.branches.read_gpkg_layer(gpkg_file, layer_name="hydroobject", index_col="code")

File ~\Anaconda3\lib\site-packages\delft3dfmpy\datamodels\common.py:235, in ExtendedGeoDataFrame.read_gpkg_layer(self, gpkg_path, layer_name, index_col, groupby_column, order_column, id_col, column_mapping, check_columns, check_geotype, clip)
233 pattern = "^[{]?[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}[}]?$"
234 for i,f in enumerate(features):
--> 235 geometry = wkb.loads(georefs[i].ExportToWkb())
236 if(geometry.type=='MultiPolygon')|(geometry.type=='MultiPoint'):
237 new_geoms = list(geometry)

File ~\AppData\Roaming\Python\Python39\site-packages\shapely\wkb.py:23, in loads(data, hex)
21 return reader.read_hex(data)
22 else:
---> 23 return reader.read(data)

File ~\AppData\Roaming\Python\Python39\site-packages\shapely\geos.py:418, in WKBReader.read(self, data)
415 def read(self, data):
416 """Returns geometry from WKB"""
417 geom = self._lgeos.GEOSWKBReader_read(
--> 418 self._reader, c_char_p(data), c_size_t(len(data)))
419 if not geom:
420 raise WKBReadingError(
421 "Could not create geometry because of errors "
422 "while reading input.")

TypeError: bytes or integer address expected instead of bytearray instance

@RuudHurkmans
Copy link
Collaborator

This probably has to do with an inconsistency between shapely and geopandas. Did you use geopandas 0.8.2 and shapely 1.8.0? If not update (or downdate) to that combination. Note that delft3dfmpy is deprecated; you can now use dhydamo in hydrolib 0.2.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants