yeesian / ArchGDAL.jl

A high level API for GDAL - Geospatial Data Abstraction Library
https://yeesian.github.io/ArchGDAL.jl/stable/
Other
141 stars 27 forks source link

Convert types that can't be written automatically? #259

Closed rafaqz closed 2 years ago

rafaqz commented 2 years ago

I'm wondering if it would be useful to do automatic type conversion from types that can't be written by GDAL, e.g. Int64.

It could come with a warning that this has occurred.

It's very rare that we will have Int64 data that wont fit in Int32, but Int64 is the default in Julia so it comes up a lot.

rafaqz commented 2 years ago

Thinking about how DiskArrays.jl works, we can probably do this with a lazy broadcast like:

if eltype(A) <: Float64
    A = Float32.(A)
end

And the conversion will happen lazily during write if the object is already a DiskArray.

The non-DiskArrays.jl write methods may need a new array allocated? It would be good to minimise the memory use of doing these conversions somehow.

rafaqz commented 2 years ago

Closing in favour of #298, GDAL can write Int64 now!