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

error when accessing geom or layer out of bounds #302

Closed maxfreu closed 2 years ago

maxfreu commented 2 years ago

getgeom or getlayer now print an error message instead of returning a NULL Geometry. The original behaviour can be obtained by adding an @inbounds annotation in contexts where getgeom or getlayer is inlined. I think this PR breaks code, which explicitly handles NULL Geometry.

visr commented 2 years ago

Thanks for the PR! Interestingly the string continuation syntax you used is julia 1.7+, I didn't know.

Is there a reason you didn't go for the BoundsError you mentioned in #301?

maxfreu commented 2 years ago

Oh I just noticed the string continuation problem, too, strange...

Is there a reason you didn't go for the BoundsError you mentioned in https://github.com/yeesian/ArchGDAL.jl/issues/301?

Yes:

throw(BoundsError(layer, 123))  # ERROR: BoundsError: attempt to access ArchGDAL.IFeatureLayer at index [123]

I found that not specific enough and it is missing the hint to 0 based indexing. And I didn't find a way to incorporate a different message into the BoundsError.

maxfreu commented 2 years ago

just made another branch for this, maybe I'll reopen it later