ArchGDAL.jl icon indicating copy to clipboard operation
ArchGDAL.jl copied to clipboard

implement Base.getproperty on Feature and FeatureLayer

Open visr opened this issue 4 years ago • 4 comments

If we iterate through a layer, we get features. These make up our rows in the tables interface. Therefore I assumed they would behave somewhat like a NamedTuple. In https://discourse.julialang.org/t/find-if-point-is-within-geojson-polygons/70416 I tried feature.name to get the name of the feature, but it doesn't work.

Would it be a good idea to add Base.getproperty methods for Features?

Actually now I'm a bit confused. In #118 we defined propertynames and getproperty on the table (then a separate type, now FeatureLayer). It looks like we have to re-add those for FeatureLayer now as well? Or would this conflict with the new schema somehow @mathieu17g?

visr avatar Oct 26 '21 21:10 visr

Defining getproperties for the row object should mean the rowaccess-based Tables.jl interface will just work too? Thats how a Vector of NamedTuple works.

Its also nice to have that symmetry where the objects have the same properties as the row names.

rafaqz avatar Oct 26 '21 22:10 rafaqz

Yeah although the current Tables interface for ArchGDAL is already row based, since that corresponds to GDAL's data model better.

visr avatar Oct 27 '21 07:10 visr

Might we run into situations where there are spaces in the fieldnames?

yeesian avatar Oct 28 '21 02:10 yeesian

Or would this conflict with the new schema somehow @mathieu17g?

I do not see why it would.

mathieu17g avatar Oct 28 '21 04:10 mathieu17g