-
Notifications
You must be signed in to change notification settings - Fork 26
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
Table to IFeatureLayer #243
base: master
Are you sure you want to change the base?
Conversation
I do think it's a good idea to move away from the I'll write up about it in a RFC and get thoughts and feedback first. |
Unfortunately, it'll be difficult to review this PR with 38a23ef. If I still remember it right, I'd suggest
|
Thanks, I did as advised below |
286b10e
to
bbf3760
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking this on -- it's ambitious in all the right ways and I really appreciate it!
My comments are mostly around src/tables.jl
since it has become pretty complex to follow along, and I think it needs to get to a state where it "feels obvious" for maintainability.
- The number of if-else suggests that the current system of types might not be sufficiently tight for doing this is a clean way, but
- I don't yet have a good understanding where the gap might be.
- Therefore, my suggestions are mostly around https://docs.julialang.org/en/v1/manual/performance-tips/#Break-functions-into-multiple-definitions.
…tries, mixed float/int Test with `nothing` skipped until PR yeesian#238 [Breaking] Return missing if the field is set but null. is merged
Added some test coverage on convert error cases: - ogrerr macro error message modification - IFeature(table) constructor errors on type conversions
Added a test on OGRFieldType error handing
…file, illustrating the data modification that may be induced by the driver limitations (here "ESRI Shapefile")
Adjusted prerequisite Added layer name option to IFeatureLayer
- no difference for geometry columns. Both `nothing` and `missing` values map to an UNSET geometry field (null pointer) - field set to NULL for `missing` values and not set for `nothing` values
d48e4a8
to
1b6ab33
Compare
- refactored conversion of table column types to ArchGDAL layer featuredefn's geomfield and field types - added docstrings - adjusted convert fonctions between `OGRFieldType`s / `OGRFieldSubType`s and `DataType`s to enable refactoring
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you so much! This PR is shaping up really nicely, and I have a much better grasp of it now :)
The generated functions are really quite magical haha, so my remaining comments are mostly stylistic in nature.
…onform to modification made in commit b08919b
…sting beyond already existing tests which have been adapted
… any specific tests yet
… `geomcols` kwargs. Ajusted error messages syntax
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I think the overall flow is there, but the amount of coherence checks and inference and so on makes me very hesitant about the API. I've suggested some changes to see if they might help keep things simple.
- Moved from `@generated` to normal functions - Added conversion for `GeoInterface.AbstractGeometryCollection` - Differentiated display between `IGeometry` and `Geometry` - Added tests on compact display for `AbstracGeometry` (e.g in use in DataFrames)
….)` following @yeesian comments
@yeesian I dropped |
@@ -251,26 +252,28 @@ function Base.show(io::IO, spref::AbstractSpatialRef)::Nothing | |||
return nothing | |||
end | |||
|
|||
function Base.show(io::IO, geom::AbstractGeometry)::Nothing | |||
function Base.show(io::IO, geom::AbstractGeometry, prefix::String)::Nothing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be named as _show
or something, or does it need to have the Base.
prefix?
Wanted to say I like the new API a lot, thank you so much for working through all the review comments! |
OFSTInt16::Vector{Int16}, | ||
OFSTInt16::Int16, # default type comes last | ||
OFSTNone::Vector{Int32}, | ||
OFSTInt16::Float16, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This (and also Vector{Float16}
) is not correct for OFSTInt16 AFAIK
It would very nice to have this feature. It would make integration with other geometry packages easier. Is there any reason why this effort stopped? Is there still interest on this feature? |
Here is a 1st draft to fix issue #152
I have implemented the conversion from table to an
IFeatureLayer
in a memory dataset.It is done via an
IFeatureLayer
constructor but it can be moved to acreatelayer
method.Here are some modifications that has / may need to be implemented:
Tables.schema
returnsnothing
orTable.Schema{names, nothing}
missing
if the field is set but null. #238 is merged, set field/geomfield values=== nothing
to nulldataset(::AbstractFeatureLayer)
instead of callingownedby
property. Could be generalized to all ArchGDAL objects once Issue Model and handle relationships between GDAL objects systematically #215 has been addressed<: Union{Missing, Nothing, GeoInterface.AbstractGeometry}
or WKT/WKBwrite(::AbstractFeatureLayer, args...)
to simplify table to geofile workflow syntaxOther additions:
convert
methods betweenOGRwkbGeometryType
andIGeometry{OGRwkbGeometryType}
. Necessary in column types conversion since it is based on try-catch onconvert
methodsGDAL.ogr_gfld_setname
to set first geomfield name, sincesetname!
is not implemented forFeatureDefn
. set name!(::FeatureDefn, ::String) may require to fix issue Model and handle relationships between GDAL objects systematically #215 first@ogrerr
: message has to be escaped. This fix may also be necessary in other similar macros (not tested)convert
methods betweenOGRFieldType
andDataType
for vectors,Int8
andFloat16
Here is a test on multi_geom.csv test file: