Web Map / AMIA Villages

Web Map on Home Page

This section covers how to update the GeoJSON map boundaries on the Home Page (the colored province overlays).

This step is labelled (Optional) because the SHAPEFILE and new AMIA Villages data for the target region may yet not be readily available during Installation.

homepage

Required Files

These steps require the files:

  1. SHAPEFILE (.shp, .shx, .prj, .dbf and .cpg files) of the new region
  2. New AMIA Villages information of the new region in a CSV file, following the format in the /server/src/scripts/data/amia_villages_r5.csv file.
          • amia_villages_r5.csv
            • acap-bicol.geojson
  • đź’ˇ

    Since ACAP uses the provinces and municipality naming conventions from the PAGASA 10-day weather forecast Excel file, please ensure the SHAPEFILE and AMIA Villages CSV file share similar naming conventions with it.

    Normalize the SHAPEFILE

    1. Convert the SHAPEFILE to a normalized, web-friendly GeoJSON file format. (Recommended GeoJSON file size is approximately less than 500KB).

    2. (Optional) Use QGIS to check the SHAPEFILE for errors. Follow steps No. 2, No. 3 and No. 4 described in the URL link to check and fix SHAPEFILE errors. https://github.com/ciatph/ciatph.github.io/issues/33#issuecomment-769405843 (opens in a new tab)

    3. (Optional) Use the https://github.com/ciatph/shapefile-simplify (opens in a new tab) tool to normalize, simplify and convert the SHAPEFILE to GeoJSON, playing around with PERCENTAGE % values that lead to a small file size with acceptable visual effects when loaded on the Home page.

      ACAP 1.0's GeoJSON file is available in /server/src/scripts/data/geojson/acap-bicol.geojson file for reference.

    Upload the GeoJSON file

    MapBox Hosting

    Upload the normalized GeoJSON file to MapBox, or any hosting service that allows serving GeoJSON content over HTTP from Normalize the SHAPEFILE step #2 or #3. The original ACAP 1.0 uses MapBox (Datasets) for hosting.

    Update the following variables when using MapBox:

    MAPBOX_BASEMAP_STYLE_ID
    MAPBOX_DATASET_ID
    MAPBOX_API_KEY

    Firebase Storage Hosting

    You can use Firebase Storage in case a new MapBox account is not readily available.

    Replace the NEXT_PUBLIC_GEOJSON_URL variable with the GeoJSON file's remote URL after uploading it to Firebase Storage.

    Use a Target Environment

    Open the server .env file. Update the FIREBASE_SERVICE_ACC and FIREBASE_PRIVATE_KEY keys with the development key values.

    Upload the AMIA Villages Data

    1. Upload the new AMIA Villages information (CSV file) to Firestore.
    2. Copy the new CSV file to /server/src/scripts/data/amia_villages_r5.csv
    3. Run the server NPM script:
      npm run seed:01_amiavillages
    4. Re-deploy to the development environment to view the updates on the live site.
    5. Repeat starting from the Use a Target Environment using the production Firebase keys to view the updates on the live production GitHub Pages site.