Process a query request to the JMap server, for given layer and query ids, and provided form data
throws
if group or query ids are not correct (invalid format or no resource exists)
example
// returns a promise that when resolved returns the result of the search,// an array of features, for layer id=3 and query id=5.
JMap.Query
.fetchFeatures(3, 5, {
"$PARAM1": "test",
"$PARAM2": 35
})
.then(features =>console.info(`Found ${features.length} features.`))
.catch(error =>console.error("Error while processing query request.", error))
By default attribute query forms are not fetched from server, because sometime it takes too much time.
This method will fetch the query form.
example
// initializes query id="layers/2/attribute-queries/3" form of layer id=2, then returns the filled query
JMap.Query.initializeQueryFormById(2, "layers/2/attribute-queries/3")
.then(query =>console.log("Query form has been loaded", query))
.catch(error =>console.error("An error occured while loading query id='layers/2/attribute-queries/3'"))
JMap.Query
A feature query mecanism has been set in JMap to get filtered features.
By example we can get all features that have an attribute equals to a given value.
A query concerns a single layer, and it set a data form that will be filled by users to make a search.
For a given project, a JMap administrator can create query groups and put inside all queries he wants, not depending on a particular layers.
You can get queries definitions (including the form definition) and process a query from this section.