Open klavspc opened 6 years ago
@klavspc just for my clarity: why not just search for all feature classes, and filter in your filter implementation. We have something similar in NL here: there is a solr based search service, which you can specify feature types for, but it is just easiest to search for everything and split the result in the filter:
In your screendump your prefixes are rather large: 'stream, lake', while (I think) the purpose of this is to be able to quickly search for something like in our case: 'pdok 2022zj' a zip location in our national PDOK search service.
Another option would be to have one locator for the geonames service, but a small configuration window in which you can choose which featuretypes you want to have returned (as from the geonames api I understand you can ask several at a time)..
Or am I missing your point here?
PS I would claim geon or gnames or gnam quick for this service :-)
Ah, duh, not related, but you do not want to see this :-)
So should people register? Or is it the locatorfilter that is registred then as an application?
@rduivenvoorde: Thank you for your questions.
I hope this clarifies my intention with the proposal
I favor keeping QgsLocatorFilter as the changes may easily be implemented in the existing class while backwards compatibility is maintained.
+1
A new flag FlagMutipleTargets may be defined,
+1
@rduivenvoorde
In your screendump your prefixes are rather large: 'stream, lake', while (I think) the purpose of this is to be able to quickly search for something like in our case: 'pdok 2022zj' a zip location in our national PDOK search service.
FYI - @3nids implemented user-overrides of prefixes in 3.2. So I'm generally in favour of more-specific default prefixes for plugin based services, and leave this up to users to customise according to their particular needs and set of installed plugin services.
I've looked over this proposal and I think it's a good approach to solve this problem. So I'm a +1 overall here.
One small thing I'd like to see when implemented relates to the screenshot of the config panel with multiple targets - instead of the "- Country ...." approach for showing the targets, we should put these items as proper children under the parent filter.
I have been facing similar issues when implementing a locator for the Swiss Geoportal. I ended up doing 3 filters but not for the exact same reasons. My main issue was that I am having different requests for each sub-search (i.e. 3 different URLs I cannot combine) although they do belong to the same locator.
I am not sure how this is compatible with this proposition, but I'd like to be able to have a fetchResults
per sub-filter. I'd have to think a bit more about it.
Also, in one of my 3 filters, I would also have sub-categories similarly to your problem. For this part, I only have a table in the options where I can select sub-categories. Having something more accessible would be awesome. Maybe an auto-completion for the sub-categories?
I wanna one entry to locate multi layers features
Allow locator filters to support more than one target
Date 2018/06/21
Author Klavs Pihlkjær (@klavspc)
Contact klavspc@gmail.com
maintainer @nyalldawson
Version QGIS 3.4
The original pdf version of this proposal: QgsLocatorFilter-Proposal-Targets.pdf
Summary
This proposal covers extending the locator architecture to allow locator filters to register more than one target. For a specific set of use cases this proposal will enable
In the following sections a fictive geonames locator filter is used as example
A geonames locator filter
The GeoNames geographical database covers all countries and contains over eleven million placenames that are available for download free of charge. Geonames.org maintains Geonames and publishes it both for download and through a search web service
A GeoNames QGIS plug-in could register with the locator and, by using this search service, give the user the ability to search geonames directly in the built-in QGIS locator.
To be as user friendly as possible the plugin may want to represent the nine feature classes as individual targets in the locator:
Today, the plugin can only achieve this by registering nine separate locator filters. This is absolutely doable, but it has two major drawbacks:
Each filter, representing a feature class, is called resulting in a separate call for each target. That’s a considerable overhead when a search request against geonames allows querying any combination of feature classes in a single request
Proposed Solution
QgsLocatorFilter
expose a methodtargets()
which will return an array of target definitions consisting of{ targetId / displayName / prefix }
sets.QgsLocatorContext
is extended with a targetIds array such that whenQgsLocatorFilter.fetchResults( QString &string, QgsLocatorContext &context, QgsFeedback feedback )
is called it knows which feature types to retrieve.Request time
A geonames locator filter may now determine the necessary featureClass query parameter from
context.targetIds()
. When results are retrieved and signals are emitted, the filter will decorate results with a target property, which will be used to display results correctly.The result list in the locator will not be any different under this proposal.
Configuration time
Affected Files
QgsLocatorFiltersModel
needs to be changed in order to support the hierarchical structure to be presented in the Options|Locator dialog.QgsLocator
needs to be updated. Both in regards to what needs to be presented to the locator widget and how targets are determined and filters are called.QgsLocatorModel
will have to be extended to evaluate filter / target information inaddResults (bool addingFilter)
QgsLocatorFilter
or create a new classMultiTargetQgsLocatorFilter
. I favor keepingQgsLocatorFilter
as the changes may easily be implemented in the existing class while backwards compatibility is maintained.Performance Implications
The performance of searches against multiple-target services may be greatly improved
The performance cost of the extra logic in the locator architecture is negligible.
Backwards Compatibility
Backwards Compatibility is easily obtained and should be a requirement such that existing locator filters continue to function. Several options exist. In prioritized order I suggest:
FlagMutipleTargets
may be defined,registerLocatorFilter2()
Votes
(required)