This tool is used to track which webmaps depend on which layers.
This nodejs app can be used to assemble a report containing all the publicly shared webmaps on the Government of BC Maps ArcGIS page along with their layers. If an ArcGIS Online account is provided via command line parameters, all webmaps accessible to that user will be included in the output. When an administrator account is used, all webmaps in the Government of BC organzation will be included in the output. If a comma separted list of item IDs corresponding to feature layers of interest is supplied as a parameter, the report will only include webmaps that contain the specified layers.
npm i # install packages
node src/index.js # or npm run start
- You will be prompted for a BC MapHub username. This step is optional, press Enter to continue.
- Next you are prompted for a list of layer itemIds. This step is optional, press Enter to continue.
- Once complete, three output files can be found in the 'reports' directory.
- dependencies.csv - A CSV file listing layers and the webmaps that use them
- layers.yml - A .yml file containing a hierachical view of layers and the webmaps that use them
- maps.yaml - A .yml file containing the harvested map data
- Start the script as for 'Basic Usage' above.
- Enter the username of an admin account when prompted and press Enter.
- Enter the password for the admin account and press Enter.
- Next you are prompted for a list of layer itemIds. This step is optional, press Enter to continue.
- Start the script as for 'Basic Usage' above.
- Optionally enter the username of an admin account when prompted and press Enter.
- Optionally enter the password for the admin account and press Enter.
- Next you are prompted for a list of layer itemIds. Enter a comma separated list of layer itemIds and press Enter
We can paginate through results using the start parameter of the above URL. We're expecting to see the following JSON returned. What we're after is in the results section.
{
"total" : int,
"start" : int,
"num" : int,
"nextStart" : int,
// [ ... ]
"results": [
// [ ... ]
]
}Fields of interest from the items in the results list include:
idtitlemap_ownernumViews
We can gather some of that information from the search results directly, but for other bits of information (e.g. the list of attached layers) a new request has to be made for each search result.
We may want to pivot the information in the following ways:
- Get a flat list of all layers and their associated webmaps
Note that this is a fork from https://github.com/joe-taylor/arcgis_layer_dependencies and hsa diverged significantly.