The JMap layer id
The full query id, for example "layers/3/attribute-queries/5"
The form data (values mapping the query form definition)
if the layer or query id is invalid or the query does not exist
// 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, "layers/3/attribute-queries/5", {
"$PARAM1": "test",
"$PARAM2": 35
})
.then(features => console.info(`Found ${features.length} features.`))
.catch(error => console.error("Error while processing query request.", error))
async function fetchFeaturesAfterFormLoad() {
const layerId = 3
const queryId = "layers/3/attribute-queries/5"
if (!JMap.Query.isFormInitialized(layerId, queryId)) {
await JMap.Query.initializeQueryFormById(layerId, queryId)
}
const features = await JMap.Query.fetchFeatures(layerId, queryId, {
"$PARAM1": "test",
"$PARAM2": 35
})
console.info(`Found ${features.length} features.`)
return features
}
fetchFeaturesAfterFormLoad().catch(error => console.error("Query failed", error))
JMap.Query.fetchFeatures
Process a query request to the JMap server, for given layer and query ids, and provided form data. Loads the query form metadata first if it is not already available. Callers can also initialize the form explicitly when they need to confirm readiness before fetching.