-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
"gdal vector filter": add --where and --fields; add "gdal vector select" #11794
Conversation
0671c17
to
7d406c7
Compare
apps/gdalalg_vector_filter.cpp
Outdated
private: | ||
bool m_bIsOK = true; | ||
OGRLayer *const m_poSrcLayer; | ||
OGRFeatureDefn *const m_poFeatureDefn = nullptr; |
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.
can we use a unique pointer here or is it already using the self made share ptr with reference/dereference?
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.
- m_poSrcLayer transformed into a reference
- for m_poFeatureDefn, we can't do much about that since OGRFeatureDefn includes its own ref counting mechanism. Changing that (or studying if we can...) is I believe in the todo list of @dbaston. I've some doubts we can do that in the GDAL 3.x series
I would consider putting |
85e0ee0
to
8c1d084
Compare
…ter on result layer
…r on result layer
8c1d084
to
5a62208
Compare
done: "gdal vector select" added |
5a62208
to
25a8487
Compare
Does |
25a8487
to
a3dbe8d
Compare
I've added an --exclude switch |
a3dbe8d
to
faccd03
Compare
A field is only selected once, even if mentioned several times in the list. | ||
|
||
Geometry fields can also be specified in the list. If the source layer has | ||
no explicit name for the geometry field, ``_ogr_geometry_`` must be used to |
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.
I think needing to include _ogr_geometry_
explicitly might be surprising for users. I can imagine including it by default unless an --exclude-geom
argument is passed. Would be curious what others think.
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.
FWIW, the R sf package behaves this way (some discussion at r-spatial/sf#121).
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.
I think needing to include
_ogr_geometry_
explicitly might be surprising for users. I can imagine including it by default unless an--exclude-geom
argument is passed
that's a good question. I'm not sure either. One thing that is certain is that the current difference in behavior between OGRSQL where "SELECT" automatically selects the geometry field (unless excluded thanks to your recent work on EXCLUDE) compared to all other SQL dialects where the geometry field must be explicitly selected surprises users a lot.
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.
ticketed at #11839
m_poFeatureDefn->Dereference(); | ||
} | ||
|
||
bool IncludeFields(const std::vector<std::string> &selectedFields, |
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.
The only thought I have on the implementation is whether the processing could be handled by creating an in-memory VRT that could either be materialized or not, depending on the output format. I don't think anything about this interface precludes that, so I could look into it later on as part of #10066.
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.
Same comment could apply to #11827
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.
Good question. Regarding VRT'ization of all of this, I believe both GDAL and OGR VRT will have to be extended to support accepting a datasource and a pipeline string, rather than trying to extend the capabilities of the VRT drivers themselves to support all algorithms, which would involve duplicating all the code.
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.
ticketed at #11837
faccd03
to
d884bda
Compare
d884bda
to
32d4ef0
Compare
No description provided.