Skip to content

Enhancement: Skip unnecessary service request in queryAllFeatures #1289

@gowin20

Description

@gowin20

The queryAllFeatures method performs an initial service request to obtain the maxRecordCount of the feature layer being loaded:

const pageSizeResponse = await request(requestOptions.url, {
httpMethod: "GET",
authentication: requestOptions.authentication
});
// default the pageSize to 2000 if it is not provided
const pageSize = pageSizeResponse.maxRecordCount || 2000;
const userRecordCount = requestOptions.params?.resultRecordCount;
// use the user defined count only if it's less than or equal to the page size, otherwise use pageSize
const recordCountToUse =
userRecordCount && userRecordCount <= pageSize ? userRecordCount : pageSize;

As you can see in this excerpt, the response from the request is only used if the user does not specify a value for resultRecordCount. If the resultRecordCount parameter is provided, the response from this request will be discarded.

If a user provides this resultRecordCount parameter, this request should be skipped entirely. It will improve performance in environments like MapLibre ArcGIS.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions