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

Delimited text substring capability - also bug #7742 #569

Merged
merged 16 commits into from May 1, 2013

Conversation

ccrook
Copy link
Contributor

@ccrook ccrook commented Apr 30, 2013

This request adds substring functionality to the delimited text plugin. That is you can define a subset string in the url, and update via the UI.

This also means that delimited text data can be joined to other layers (which requires subset string support). Note that at the moment the implementation is not well optimised for this use. However for small tables it can be very convenient.

The main issue with this is implementation that the vector layer properties dialog opens an SQL expression dialog,whereas this uses the standard QgsExpression to select. However the functionality is still all available - just the query builder doesn't quite match.

Maybe wishful thinking for 2.0, but very useful capability and makes delimited text more compatible with other providers. Also very safe in terms of impact - doesn't affect API and scope is completely contained within delimited text provider (apart from additional documentation comments in vector data provider header file)

Also this has been raised as a regression bug http://hub.qgis.org/issues/7742. I'm not sure if technically it is a regression (ie I'm not sure if it was ever working).

The user manual http://docs.qgis.org/1.8/html/en/docs/user_manual/working_with_vector/vector_properties.html#joins-tab states joins to delimited text providers is supported, but it doesn't work for me in 1.8?

@minorua
Copy link
Contributor

minorua commented May 1, 2013

What a great advance! I can manage graduated style with values of joined fields that come from csv (fine with 5200 records).

@ccrook
Copy link
Contributor Author

ccrook commented May 1, 2013

Looking at the code for managing joins it seems that in fact the subset string capability is not required if the join is cached. I'm guessing that this is why it is fast. However the GUI for defining joins does require it. Could be worth fixing the GUI to allow joins for any vector provider, but force cached join if layer doesn't support subsets.

The code in QgsVectorLayerFeatureIterator::FetchJoinInfo::addJoinedAttributesDirect which uses subset string would be a lot slower (and actually looks quite buggy - original subset string is not enclosed in parentheses when adding subset string, join value is in double quotes " rather than single quotes '). Probably wouldn't want to use this option with delimited text in any case, as with no indexing could be quite slow...

Fixed the join error in #571.

@ghost ghost assigned timlinux May 1, 2013
timlinux added a commit that referenced this pull request May 1, 2013
Delimited text substring capability - also bug #7742
@timlinux timlinux merged commit 5e9e98a into qgis:master May 1, 2013
@timlinux
Copy link
Member

timlinux commented May 1, 2013

Thanks Chris I have gone ahead and merged this as it adds useful functionality to delimited provider to bring it more into parity to other providers.

@ccrook
Copy link
Contributor Author

ccrook commented May 1, 2013

Brilliant! Thanks

@ccrook ccrook deleted the delimited_text_substring_capability branch May 1, 2013 20:57
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.

None yet

3 participants