Skip to content
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

Implement a Tables interface for features #118

Merged
merged 70 commits into from
Sep 14, 2020

Conversation

Sov-trotter
Copy link
Contributor

Ran into problems since I updated my fork with the old tables branch of origin.

@Sov-trotter Sov-trotter changed the title Reset local fork and local repo made changes Implement a Tables interface for features Apr 20, 2020
@yeesian yeesian requested a review from visr May 16, 2020 19:06
src/tables.jl Outdated Show resolved Hide resolved
src/tables.jl Outdated Show resolved Hide resolved
src/tables.jl Outdated Show resolved Hide resolved
src/tables.jl Outdated Show resolved Hide resolved
test/test_tables.jl Outdated Show resolved Hide resolved
test/test_tables.jl Outdated Show resolved Hide resolved
test/test_tables.jl Outdated Show resolved Hide resolved
test/test_tables.jl Outdated Show resolved Hide resolved
test/test_tables.jl Outdated Show resolved Hide resolved
test/test_tables.jl Outdated Show resolved Hide resolved
@Sov-trotter
Copy link
Contributor Author

Sov-trotter commented Aug 30, 2020

If this is right then should I push the updated dataset?
https://github.com/Sov-trotter/ArchGDALDatasets/blob/master/data/multi_geom.csv

@yeesian
Copy link
Owner

yeesian commented Aug 31, 2020

Yeah sure! I think that will help -- maybe we can have it as a new test case, rather than modifying an existing one?

@Sov-trotter
Copy link
Contributor Author

Sov-trotter commented Aug 31, 2020

One thing to note is that for csv files (like the one here) GDAL would read all fields except geometry ones as String. This generally shouldn't be a problem?
However in the case of missing fields, the data is actually a String i.e. "missing". This may cause issues if someone wishes to use something like dropmissing()?

test/test_featurelayer.jl Outdated Show resolved Hide resolved
src/tables.jl Outdated Show resolved Hide resolved
src/tables.jl Show resolved Hide resolved
Copy link
Owner

@yeesian yeesian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I have a few minor nits, but this PR should be good to go from my end.

@visr, anything else from your end?

@evetion
Copy link
Collaborator

evetion commented Sep 1, 2020

Shall we test this on an (existing) shapefile or geopackage as well?

@Sov-trotter
Copy link
Contributor Author

Sov-trotter commented Sep 2, 2020

Yeah. That does sound cool. Though there isn't any existing geopackage dataset in the repo.
Since adding tests for shp and gpkg will be easy, I wish to leave it out for this year's upcoming Hacktoberfest as good first issues? I know a few people willing to make contributions?

@yeesian
Copy link
Owner

yeesian commented Sep 13, 2020

Hey everyone, we're close to getting this PR merged -- let's see it through to completion.

@visr @evetion are there any specific requests that must go into this PR, that we cannot open as additional feature requests?

I'll merge this PR if I don't hear any blockers in the next 24hours.

@visr
Copy link
Collaborator

visr commented Sep 13, 2020

I see the Base.getindex(t::Table, idx::Int) is 0-based. Shouldn't that be 1-based? And I think it would be clearer if the docs use the table[i] syntax rather than getindex(table, i).
Otherwise I think it's good to merge this.

The iteration state issue I described in #118 (comment) is still present I believe. But we could also turn that into an issue, and tackle it later.

@Sov-trotter
Copy link
Contributor Author

@visr can you take a look?

@visr
Copy link
Collaborator

visr commented Sep 13, 2020

Thanks, looks good.

@Sov-trotter
Copy link
Contributor Author

Btw the issue that you described above, I think it is now handled well in the interface unless one goes around inappropriate indices?

@evetion
Copy link
Collaborator

evetion commented Sep 14, 2020

I'm fine with merging if @visr items are merged. Things like shapefile, geopackage testing are nice Hacktoberfest issues.

Happy to have this functionality in. ☺️

src/tables.jl Outdated Show resolved Hide resolved
@visr
Copy link
Collaborator

visr commented Sep 14, 2020

Btw the issue that you described above, I think it is now handled well in the interface unless one goes around inappropriate indices?

No it is still there, just try running iterate(gt, 2) several times on such a table. The state (2) is not connected to the GDAL tracked current row. Connecting this in some way would perhaps be a nice improvement, and less prone to errors, but doesn't need to be a part of this PR.

@yeesian
Copy link
Owner

yeesian commented Sep 14, 2020

@visr I agree that Base.iterate() should not be used as a public method. I think a robust way of handling it might be use setnextbyindex!(layer, i) inside Base.iterate(), but it'll make it unusable for drivers that have O(n) performance in setting the index.

FWIW, the same issue is there for the current code, and we're lucky we haven't run into any issues so far. We can open a feature request for us to wrap the layer/table (similar to how we do it for rasterbands) and have ways of qualifying the state (rather than using arbitrary integers).

@yeesian yeesian merged commit 215044c into yeesian:master Sep 14, 2020
@yeesian
Copy link
Owner

yeesian commented Sep 14, 2020

This is huge, congrats @Sov-trotter! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants