{"id":21070677,"url":"https://github.com/pyronear/pyro-visibility-analysis","last_synced_at":"2025-04-30T15:27:54.747Z","repository":{"id":260239835,"uuid":"880749981","full_name":"pyronear/pyro-visibility-analysis","owner":"pyronear","description":"Tools to perform visibility analysis","archived":false,"fork":false,"pushed_at":"2025-04-10T17:53:36.000Z","size":32271,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-22T11:23:44.277Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pyronear.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-30T09:36:44.000Z","updated_at":"2025-04-10T14:44:56.000Z","dependencies_parsed_at":"2025-01-22T09:26:22.057Z","dependency_job_id":"f18f8ec4-0990-415d-814c-8dae34e41b11","html_url":"https://github.com/pyronear/pyro-visibility-analysis","commit_stats":null,"previous_names":["pyronear/pyro-visibility-analysis"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyronear%2Fpyro-visibility-analysis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyronear%2Fpyro-visibility-analysis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyronear%2Fpyro-visibility-analysis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyronear%2Fpyro-visibility-analysis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pyronear","download_url":"https://codeload.github.com/pyronear/pyro-visibility-analysis/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251731238,"owners_count":21634541,"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":[],"created_at":"2024-11-19T18:47:47.927Z","updated_at":"2025-04-30T15:27:54.740Z","avatar_url":"https://github.com/pyronear.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PyroNear Visibility Analysis\n\nAutomated analysis of coverage and visibility zones using QGIS and Python.\n\n---\n\n## Overview\n\nThis repository provides a script-based solution for evaluating viewsheds (areas visible from high points), calculating coverage, and analyzing overlaps between them. It integrates with QGIS and uses raster-based elevation data.\n\n---\n\n## Contents\n\n- `./data`: Input and output data (DEM files, input CSV, output CSV).\n- `./src`: All Python scripts.\n  - `viewshed.py`: Creates viewsheds from high points.\n  - `area_analysis.py`: Computes coverage metrics and overlaps.\n  - `utils.py`: General-purpose functions (I/O, normalization, display).\n- `./viewsheds_geotiff`: Raw viewsheds generated by the tool.\n- `./normalized`: Viewsheds after NaN removal.\n- `./fusion`: Viewshed files resulting from fusion operations (OR/AND).\n- `main.py`: The main script to run the analysis.\n\n---\n\n## Requirements\n\n- QGIS (https://www.qgis.org/en/site/forusers/alldownloads.html)\n- Plugins:\n  - SRTM Downloader (for DEM files)\n  - HCMGIS (for base maps)\n- EarthData account for DEM data: https://urs.earthdata.nasa.gov/users/new\n\n---\n\n## DEM Preparation (QGIS)\n\n1. Install plugins: SRTM Downloader and HCMGIS.\n2. Set map to Google Maps: `HCMGIS \u003e BaseMaps \u003e Google Maps`.\n3. Use SRTM Downloader:\n   - Either set canvas extent or input coordinates manually.\n   - Login to EarthData when prompted.\n4. Merge DEM tiles: Use \"Merge\" tool.\n   - Output format: `Int16`\n   - Save as: `./data/dem_file.tif`\n5. Reproject the DEM:\n   - Use \"Warp (Reproject)\" tool.\n   - Target CRS: UTM zone for your area (e.g., EPSG:32631)\n   - Save as: `./data/dem_file_projected.tif`\n\n---\n\n## Running the Code (QGIS)\n\n1. Open QGIS \u003e Python Console \u003e Show Editor\n2. Load `main.py`\n3. Run the script using the \"Play\" button\n\n---\n\n## Functionality\n\n### Viewshed Generation (`viewshed.py`)\n- Reads a CSV of observation points (lat/lon, height, name).\n- Generates a viewshed (visibility map) for each point.\n- Reprojects to appropriate CRS.\n- Applies a visual style (`.qml`).\n- Saves results as individual `.tif` files.\n\n### Normalization (`utils.py`)\n- Removes NaN values from `.tif` files (required for further analysis).\n- Output files are saved to `./normalized`.\n\n### Fusion (`utils.py`)\n- Logical fusion of viewsheds using OR or AND.\n- Results saved to `./fusion`.\n\n### Coverage Analysis (`area_analysis.py`)\n- Calculates:\n  - Area covered by a single viewshed\n  - Coverage ratio relative to the network\n  - Overlap between two viewsheds\n\n### Output\n- Final metrics are stored in `./data/output.csv`.\n\n---\n\n## Configuration\n\nPaths are defined in `main.py`:\n- `VISILITY_ANALYSIS_PATH`: Root folder (`./analysis_shape`)\n- `DATA_PATH`: `./data`\n- `CSV_PATH`: Input file (`pts_hauts_x.csv`)\n- `DEM_PROJECTED_PATH`: `dem_file_projected.tif`\n- `VIEWSHEDS_PATH`, `NORM_VIEWSHEDS_PATH`, `FUSION_PATH`: Subdirectories for outputs\n- `OUTPUT_PATH`: `./data/output.csv`\n\n(You can externalize paths into a `config.py` file if needed.)\n\n---\n\n## Dependencies\n\nPython Standard Library:\n- `os`, `csv`, `numpy`\n\nImage Processing:\n- `PIL.Image`, `PIL.TiffTags`\n\n---\n\n## Usage Summary\n\n1. Prepare DEM using QGIS.\n2. Normalize all viewsheds using `normalize_create()`.\n3. Generate KPIs using `covered_surface()`.\n4. Output will be saved in `output.csv`.\n\n---\n\n## Notes\n\n- Viewshed generation uses QGIS native plugin `Visibility Analysis`.\n- Normalization is required because the default plugin outputs use NaN for no-data values.\n- QGIS may misinterpret the scale of `.tif` files unless color ramps are explicitly set to binary.\n\n---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpyronear%2Fpyro-visibility-analysis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpyronear%2Fpyro-visibility-analysis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpyronear%2Fpyro-visibility-analysis/lists"}