{"id":15413318,"url":"https://github.com/gavinr/query-all-features","last_synced_at":"2025-04-19T11:38:39.717Z","repository":{"id":65522965,"uuid":"487120603","full_name":"gavinr/query-all-features","owner":"gavinr","description":"Query all features of an ArcGIS Feature Service","archived":false,"fork":false,"pushed_at":"2022-05-02T13:27:57.000Z","size":607,"stargazers_count":5,"open_issues_count":2,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-18T19:25:07.962Z","etag":null,"topics":["arcgis","arcgis-developers","arcgis-rest-api","arcgis-rest-js","feature-service"],"latest_commit_sha":null,"homepage":"https://codepen.io/gavinr/pen/ExQYegd?editors=0010","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gavinr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-04-29T22:00:08.000Z","updated_at":"2024-11-12T07:04:16.000Z","dependencies_parsed_at":"2023-01-27T06:01:40.105Z","dependency_job_id":null,"html_url":"https://github.com/gavinr/query-all-features","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gavinr%2Fquery-all-features","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gavinr%2Fquery-all-features/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gavinr%2Fquery-all-features/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gavinr%2Fquery-all-features/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gavinr","download_url":"https://codeload.github.com/gavinr/query-all-features/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249685246,"owners_count":21310570,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arcgis","arcgis-developers","arcgis-rest-api","arcgis-rest-js","feature-service"],"created_at":"2024-10-01T16:56:35.740Z","updated_at":"2025-04-19T11:38:39.695Z","avatar_url":"https://github.com/gavinr.png","language":"JavaScript","readme":"# Query All Features\n\n[![npm](https://img.shields.io/npm/v/query-all-features)](https://www.npmjs.com/package/query-all-features)\n\n*Query all features of an ArcGIS Feature Service*\n\nThis package calls [queryFeatures from ArcGIS REST JS](https://developers.arcgis.com/arcgis-rest-js/api-reference/arcgis-rest-feature-service/queryFeatures) multiple times until it gets all the features.\n\n- [Quick Start](#quick-start)\n- [API Reference](#api-reference)\n- [Usage](#usage)\n- [License](#license)\n\n## Quick Start\n\n```bash\nnpm install query-all-features\n```\n\nThen:\n\n```js\nimport { queryAllFeatures } from \"query-all-features\";\n\nqueryAllFeatures(\n    {\n        url: \"https://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer/0\"\n    }\n).then((results) =\u003e {\n    console.log('results', results);\n}, (err) =\u003e {\n    console.error('err', err);\n});\n```\n\n## API Reference\n\n### queryAllFeatures\n\n\u003cpre\u003e\nqueryAllFeatures(\u003ca href=\"https://developers.arcgis.com/arcgis-rest-js/api-reference/arcgis-rest-feature-service/IQueryFeaturesOptions\"\u003erequestOptions\u003c/a\u003e, \u003ca href=\"#IQueryFeaturesAllAdditionalOptions\"\u003eadditionalOptions\u003c/a\u003e): Promise\u003c\u003ca href=\"https://developers.arcgis.com/arcgis-rest-js/api-reference/arcgis-rest-feature-service/IQueryFeaturesResponse\"\u003eIQueryFeaturesResponse\u003c/a\u003e\u003e\n\u003c/pre\u003e\n\nQuery a feature service, repeatedly paging through the results to get all the features.\n\n#### Parameters\n\n| Parameter         | Type                               | Notes                                                                 |\n|-------------------|------------------------------------|-----------------------------------------------------------------------|\n| requestOptions    | [IQueryFeaturesOptions](https://developers.arcgis.com/arcgis-rest-js/api-reference/arcgis-rest-feature-service/IQueryFeaturesOptions) | This is the same input object that you would pass into [ArcGIS REST JS queryFeatures](https://developers.arcgis.com/arcgis-rest-js/api-reference/arcgis-rest-feature-service/queryFeatures). |\n| additionalOptions | [IQueryFeaturesAllAdditionalOptions](#IQueryFeaturesAllAdditionalOptions) | Additional options specific to this module. See table below. |\n\n##### IQueryFeaturesAllAdditionalOptions\n\n| Parameter         | Type                               | Notes                                                                 |\n|-------------------|------------------------------------|-----------------------------------------------------------------------|\n| pageBy (optional)    | *number* | How many records to request from the service at a time. By default, the service info will be checked to find the maxRecordCount of the service, and that will be used as the `pageBy` value. If this `pageBy` value is provided, that additional request will not be made. |\n\n```js\nimport { queryAllFeatures } from \"query-all-features\";\n\nqueryAllFeatures(\n    {\n        url: \"https://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer/0\"\n    }, { \n        pageBy: 100\n    }\n).then((results) =\u003e {\n    console.log('results', results);\n}, (err) =\u003e {\n    console.error('err', err);\n});\n```\n\n#### Returns\n\n\u003cpre\u003e\nPromise\u003c\u003ca href=\"https://developers.arcgis.com/arcgis-rest-js/api-reference/arcgis-rest-feature-service/IQueryFeaturesResponse\"\u003eIQueryFeaturesResponse\u003c/a\u003e\u003e\n\u003c/pre\u003e\n\nA Promise that will resolve with the same query response as [queryFeatures](https://developers.arcgis.com/arcgis-rest-js/api-reference/arcgis-rest-feature-service/queryFeatures).\n\n## Usage\n\n### Node JS\n\n```bash\nnpm install query-all-features\n```\n\nThen:\n\n```js\nconst { queryAllFeatures } = require(\"query-all-features\");\n\nqueryAllFeatures({url: \"https://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer/0\"}).then((results) =\u003e {\n    console.log('results', results);\n}, (err) =\u003e {\n    console.error('err', err);\n});\n```\n\n### Browser - ES Modules\n\nDistributed as an ES module which should work \"out-of-the-box\" with most popular module bundlers. See \"Quick Start\" above.\n\n### Browser - ES Modules via CDN\n\n```html\n\u003cscript type=\"module\"\u003e\n    import { queryAllFeatures } from \"https://cdn.skypack.dev/query-all-features\";\n\n    queryAllFeatures({url: \"https://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer/0\"}).then((results) =\u003e {\n        console.log('results', results);\n    }, (err) =\u003e {\n        console.error('err', err);\n    });\n\u003c/script\u003e\n```\n\n[Example in action](https://codepen.io/gavinr/pen/ExQYegd?editors=0010)\n\n### Browser - Script tag via UMD CDN\n\n```html\n\u003c!-- arcgis-rest-request and arcgis-rest-feature-service are dependencies: --\u003e\n\u003cscript src=\"https://unpkg.com/@esri/arcgis-rest-request@4\"\u003e\u003c/script\u003e\n\u003cscript src=\"https://unpkg.com/@esri/arcgis-rest-feature-service@4\"\u003e\u003c/script\u003e\n\u003cscript src=\"https://unpkg.com/query-all-features\"\u003e\u003c/script\u003e\n\n\u003cscript\u003e\n    queryAllFeatures.queryAllFeatures({url: \"https://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer/0\"}).then((results) =\u003e {\n        console.log('results', results);\n    }, (err) =\u003e {\n        console.log('err', err);\n    });\n\u003c/script\u003e\n```\n\n[Example in action](https://jsbin.com/kegayoz/edit?html,output)\n\n## License\n\n   Copyright 2022 Gavin Rehkemper\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgavinr%2Fquery-all-features","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgavinr%2Fquery-all-features","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgavinr%2Fquery-all-features/lists"}