Updating the Stats - GeoEngineers/RCOPublicLands GitHub Wiki

To update the statistics follow the steps below.

  1. Navigate to \RCOPublicLands\scripts\appServer\src\data in your file explorer.

  2. If you have new csv files for the statistics, add them to this folder.

  3. Find the generatejson.js file in this folder and open it in a text editing program.

  4. Update the "targetData" json variable (at line 9) with your new csv targets for each type. There will be a csvTarget variable for each type (Congressional, Counties, Legistlative, Wrias, Statewide). You can also update the fileName variable for each type to change the name of json file that will be created in the process. Do not change lines 42 through 45 as these are placeholders.

  5. Navigate to \RCOPublicLands\scripts\appServer\src\data in your command console.

  6. Run the following commands to create the new file for each type: (You can just run a single type if you wish.)

    node generatejson.js counties

    node generatejson.js congressional

    node generatejson.js legislative

    node generatejson.js wrias

    node generatejson.js statewide

*If you have any problems running these commands, check your csv files to make sure they are delimited with commas and that their structure matches the previous csv files that are in this folder. The statewide csv should have 3 columns in the order of Acres, Acquisition Cost, and Agency. The other types will have an order of Acres, Acquisition Cost, Name, and Agency. The code also assumes that first line has headers, if your files do not have headers, update line 84 in generatejson.js to "if(count > -1)".

  1. After your new file(s) are created navigate to \RCOPublicLands\scripts\appClient\src\extensions in your file explorer.

  2. Find the washington_stats.js file in this folder and open it in a text editor.

  3. On lines 13 - 17 are the variables for each type:

    BootstrapVars.sums_statewide

    BootstrapVars.sums_counties

    BootstrapVars.sums_congressional_districts

    BootstrapVars.sums_wria

    BootstrapVars.sums_legdistricts

  4. Update each of these variables with the json from each file that you created. The files you created will be in the same folder as the washington_stats.js file. If you did not change the fileName variables in generateJson.js the files will be named the following:

    sums_congressional_districts.json

    sums_counties.json

    sums_legdistricts.json

    sums_wrias.json

    sums_statewide.json