Skip to content

digidem/comapeo-area-calculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CoMapeo Area Calculator

Client-side GeoJSON area calculator for comparing multiple point-to-coverage methods in the browser.

This app is designed for loading point GeoJSON, adjusting spatial rules, comparing generated coverage polygons on a map, and exporting the resulting GeoJSON layers.

Quick Start

bun i
bun run dev

Then open the local Vite URL, load a point GeoJSON file, pick or adjust a profile, and run the calculations.

Features

  • Loads GeoJSON Point and MultiPoint inputs and normalizes them into point features.
  • Compares multiple coverage methods from the same dataset and parameter set.
  • Runs heavy calculations in a Web Worker so the UI can keep updating incrementally.
  • Previews generated geometries on a Leaflet map and exports each method as GeoJSON.
  • Supports built-in and saved parameter profiles.
  • Publishes cleanly to GitHub Pages.

Usage

  1. Upload a GeoJSON file containing point features.
  2. Choose a built-in profile or adjust the calculation parameters manually.
  3. Click Calculate all methods.
  4. Inspect each result on the map.
  5. Switch the displayed area unit between ha, , and km².
  6. Export any generated result as GeoJSON.

Calculation Methods

The app currently calculates these output layers:

  • Observed footprint
  • Connectivity A
  • Connectivity B
  • Cluster + concave hull
  • Occupied grid

Each method uses the currently selected profile values from the sidebar.

Development

Requirements

Commands

# install dependencies
bun i

# start local dev server
bun run dev

# create a production build
bun run build

# preview the production build locally
bun run preview

Project Structure

src/
  main.js                UI, map rendering, profile management, worker messaging
  calculator.js          Shared spatial calculation logic
  calculation-worker.js  Background calculation orchestration
  config.js              Default parameters and built-in presets
  styles.css             Layout and visual styling

Architecture Notes

  • The app is fully client-side.
  • Long-running geospatial work is executed in src/calculation-worker.js.
  • Shared spatial logic lives in src/calculator.js.
  • The map preview uses lighter preview geometry where available, while exports preserve the full generated GeoJSON.

Input Expectations

  • Input should be valid GeoJSON.
  • The app currently expects Point or MultiPoint geometry.
  • Non-point geometries are ignored during extraction.

Deployment

GitHub Pages deployment is configured in .github/workflows/deploy-pages.yml.

On pushes to main, the workflow:

  • installs dependencies with Bun
  • builds the app with Vite
  • publishes the dist/ output to GitHub Pages

The Vite config uses a relative base path so the built app works both on GitHub Pages subpaths and when served from the site root.

Contributing

Keep changes incremental and preserve the current product shape:

  • upload point GeoJSON
  • adjust parameters
  • compare methods
  • preview geometry
  • export GeoJSON

Before opening a PR:

bun run build

If calculation behavior changes, verify at least one real GeoJSON upload in the browser.

License

TODO: add project license.

About

Client-side GeoJSON area calculator for comparing coverage methods.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors