Indicates that no data should be queried from the backing store.
Returns the query to use on the backing Store for the given level scale. This query can be any value, provided it can be understood by the store. For a WFS store, this is a WFSQueryOptions object with an OGC filter, for a REST store, this can be an object that contains a number of key-value pairs that will be transmitted to the server as URL parameters. For a REST store, the meaning of the passed query object must be agreed with the underlying data provider.
If no data should be downloaded from the server, return QUERY_NONE.
the current level of detail as a non-negative integer value. The least precise detail
level is 0
. The number of available detail levels is determined by the array
returned by getQueryLevelScales.
The query to use on the backing Store.
Example for a WFS store: request features with the scale_rank
property equal to the level
value.
export class WFSQueryProvider extends QueryProvider {
getQueryLevelScales() {
return [1 / 200000, 1 / 10000, 1 / 100];
};
getQueryForLevel(level: number) {
return {
filter: eq(property('scale_rank'), literal(level))
}
}
}
The provider returns a query object that instructs the store to download features with a specific minimum population. As you zoom in on the map, also smaller cities will be loaded.
export class RESTQueryProvider extends QueryProvider {
level_queries = [
QueryProvider.QUERY_NONE,
{minimum_population: 1000000},
{minimum_population: 500000},
{minimum_population: 0}
];
getQueryLevelScales() {
return [1 / 200000, 1 / 10000, 1 / 100];
};
getQueryForLevel(level: number) {
return this.level_queries[level];
};
}
Returns an array of map scales that determine when the layer should switch from one query to another. These scales must be ordered from the smallest scale (zoomed out) to the largest scale (zoomed in). The scale must be expressed in the same unit as th map scale.
This method needs only to be implemented if there is at least a single scale break.
the layer for which the detail level scales are being requested
the map for which the detail level scales are being requested
the switch scales for each level of detail.
getQueryLevelScales() {
return [1 / 200000, 1 / 10000, 1 / 100];
};
Invalidates the query provider. Call this method to indicate that the query must be refreshed. You would use this to ensure a FeatureLayer queries the model again.
myFeatureLayer.loadingStrategy.queryProvider.invalidate();
A QueryProvider allows you to define what Feature instances must be shown at different map scales. A
QueryProvider
must be configured on a data loading strategy. A LoadingStrategy is configured on a FeatureLayer and allows you to control when and what data is downloaded from the server to be visualized in that layer.When the map scale changes, for example because a user zooms in or out, a FeatureLayer's LoadingStrategy will consult its
QueryProvider
if the data that must be shown at the new scale level is different from the data shown at the previous scale level. TheQueryProvider
can then return a value (called a query object) that expresses the filter conditions that the data at that level must satisfy. The value returned by theQueryProvider
will be passed to the FeatureModel's query() method in the query parameter. The FeatureModel's Store can then interpret that value to send a request to the server to download the desired data.A QueryProvider works as follows:
This mechanism is similar to level-of-detail in FeaturePainter.
2015.0