holoviz / spatialpandas

Pandas extension arrays for spatial/geometric operations
BSD 2-Clause "Simplified" License
308 stars 24 forks source link

GeometryArray.__geitem__ does not preserve dtype #64

Closed gsakkis closed 7 months ago

gsakkis commented 3 years ago

When indexing a GeometryArray, the buffer_values (and flat_values) of the returned Geometry object does not have the same dtype as the respective array:

In [1]: from spatialpandas.geometry import LineArray

In [2]: line_array = LineArray([
   ...:     [1, 2, 3, 4, 5, 6],
   ...:     [7, 8, 9, 10],
   ...:     [11, 12, 13, 14, 15, 16],
   ...: ], dtype="i2")

In [3]: line_array.buffer_values.dtype
Out[3]: dtype('int16')

In [4]: line_array[1].buffer_values.dtype
Out[4]: dtype('int64')

In [5]: line_array[1].flat_values.dtype
Out[5]: dtype('int64')