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

Can't read attributes of type DataType.GEOM_WKB / GEOM_WKT with pytiledb 0.28 #1956

Closed
rouault opened this issue Apr 22, 2024 · 2 comments
Closed
Assignees

Comments

@rouault
Copy link

rouault commented Apr 22, 2024

with pytiledb 0.28, I get the following exception on a SparseArray with a GEOM_WKB attribute
poly.tiledb.zip

>>> import tiledb
>>> db = tiledb.open('poly.tiledb')
>>> db.schema
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/even/gdal/gdal/build_cmake/pytiledb_0_28/lib/python3.8/site-packages/tiledb/array_schema.py", line 427, in __repr__
    output.write(f"    {repr(self.attr(i))},\n")
  File "/home/even/gdal/gdal/build_cmake/pytiledb_0_28/lib/python3.8/site-packages/tiledb/attribute.py", line 278, in __repr__
    attr_dtype = self.dtype
  File "/home/even/gdal/gdal/build_cmake/pytiledb_0_28/lib/python3.8/site-packages/tiledb/attribute.py", line 161, in dtype
    return DataType.from_tiledb(self._tiledb_dtype, self._ncell).np_dtype
  File "/home/even/gdal/gdal/build_cmake/pytiledb_0_28/lib/python3.8/site-packages/tiledb/datatypes.py", line 64, in from_tiledb
    base_dtype = _TILEDB_TO_NUMPY[tiledb_type]
KeyError: <DataType.GEOM_WKB: 42>
@kounelisagis
Copy link
Member

Will be fixed by #1912.

@kounelisagis
Copy link
Member

Seems to work for me after merging the PR.

>>> import tiledb
>>> db = tiledb.open('poly.tiledb')
>>> db.schema
ArraySchema(
  domain=Domain(*[
    Dim(name='_X', domain=(-40071412.625353545, 40071412.625353545), tile=8014282.525070709, dtype='float64'),
    Dim(name='_Y', domain=(-40071412.625353545, 40071412.625353545), tile=8014282.525070709, dtype='float64'),
  ]),
  attrs=[
    Attr(name='FID', dtype='int64', var=False, nullable=False, enum_label=None),
    Attr(name='wkb_geometry', dtype='wkb', var=True, nullable=False, enum_label=None),
    Attr(name='AREA', dtype='float64', var=False, nullable=True, enum_label=None),
    Attr(name='EAS_ID', dtype='int64', var=False, nullable=True, enum_label=None),
    Attr(name='PRFEDEA', dtype='<U0', var=True, nullable=True, enum_label=None),
  ],
  cell_order='row-major',
  tile_order='row-major',
  capacity=10000,
  sparse=True,
  allows_duplicates=True,
)

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