# joemattathil/geotiff-mapper architecture

> Architecture diagram of the GitHub repository joemattathil/geotiff-mapper, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-03-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/joemattathil/geotiff-mapper
- Repository: https://github.com/joemattathil/geotiff-mapper

## Overview

This repository is a small, client-side GIS/mapping application built around Leaflet.

#### Overall architecture

The project is effectively a static browser app:
- `index.html` is the application shell.
- `leaflet.js` and `leaflet.css` provide the mapping engine and its styling.
- `app.js` contains the custom application logic.
- `style.css` contains the app-specific UI styling.

There is no backend service, database server, or build pipeline visible in the repository. The README explicitly says the tool is “locally based on instance memory,” which matches a frontend-only architecture where state lives in the browser session unless the app later exports/imports data.

#### Main subsystems

##### 1. Presentation / page shell
`index.html` is the entry point that assembles the page and loads the assets. In a diagram, this is the browser-facing container that:
- loads Leaflet and the app code
- provides the DOM elements for map display and upload/legend controls
- serves as the host for all runtime state in the browser

##### 2. Mapping engine
Leaflet is the core mapping subsystem:
- renders the interactive map
- manages zoom/pan/tiles/layers
- provides the canvas/DOM layer where overlays such as GeoTIFFs would be displayed

Because Leaflet is shipped as local files in the repository, it is part of the app’s runtime dependency set rather than an external CDN dependency.

##### 3. Custom application logic
`app.js` is the main orchestration layer. Based on the README, it likely handles:
- GeoTIFF upload workflow
- reading/parsing the uploaded raster
- converting it into a form Leaflet can display as an overlay
- legend creation/editing
- maintaining current session state in memory
- possibly import/export of “local json or excel database” content if that capability is implemented

This is the central boundary in the system: it sits between user interaction, file handling, and the map rendering library.

##### 4. Styling layer
`style.css` defines the visual layout around the map and controls:
- page layout
- control positioning
- legend appearance
- upload interface styling

This layer does not affect core data flow, but it shapes the UI structure around the map canvas.

#### Data flow

A typical runtime flow is:

1. User opens `index.html` in the browser.
2. The page loads Leaflet assets and `app.js`.
3. `app.js` initializes the map.
4. User uploads a GeoTIFF from the local machine.
5. The app processes the file in-browser and creates a map overlay or equivalent visual representation.
6. The overlay is added to the Leaflet map.
7. User creates or edits custom legends, which are kept in session memory or other local-only state.
8. If persistence exists, it would be via local import/export mechanisms rather than a server database, since no backend is present in the repository.

#### Key boundaries

##### Browser boundary
Everything runs inside the browser process. There is no evidence of network-backed services or server-side rendering.

##### File input boundary
The GeoTIFF comes from the user’s local filesystem and is handled client-side. This is the main external data ingress into the app.

##### Mapping/rendering boundary
Leaflet owns the map rendering surface, while `app.js` owns the business logic that decides what overlay/legend state gets shown.

##### Persistence boundary
The README mentions “local json or excel database,” but the repository itself does not show a real persistence layer. So the safe architectural reading is:
- primary state is in-memory during the session
- any durable storage is likely manual/local-file based, not a remote DB service

#### Deployment/runtime model

This looks like a static application that can be served from any basic web server or opened in a browser environment that permits local asset loading. There are no signs of:
- Node.js backend
- API server
- database engine
- build artifacts
- package/dependency manager metadata

#### What an architecture diagram should show

A correct diagram would have:
- a browser/client box containing:
  - `index.html`
  - `app.js`
  - `style.css`
  - `leaflet.js`/`leaflet.css`
- a GeoTIFF file coming from the user into the client
- `app.js` as the controller/logic layer
- Leaflet as the map rendering layer
- in-memory session state for overlays/legends
- optional local import/export path if the JSON/Excel workflow is implemented

In short: this is a frontend-only, Leaflet-based GeoTIFF mapping tool where the client browser is both the UI and the execution environment, and the map plus legend state is managed locally without a server-side database.

Main entry points: [`app.js`](https://github.com/joemattathil/geotiff-mapper/blob/HEAD/app.js) (app.js), [`index.html`](https://github.com/joemattathil/geotiff-mapper/blob/HEAD/index.html) (index.html), [`style.css`](https://github.com/joemattathil/geotiff-mapper/blob/HEAD/style.css) (style.css), [`leaflet.js`](https://github.com/joemattathil/geotiff-mapper/blob/HEAD/leaflet.js) (leaflet.js)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph "Browser App"
  index_html["index.html<br/>entry shell<br/>[index.html]"]
  app_js["app.js<br/>controller<br/>[app.js]"]
  style_css["style.css<br/>ui styles<br/>[style.css]"]
  leaflet_js["leaflet.js<br/>map engine<br/>[leaflet.js]"]
  leaflet_css["leaflet.css<br/>map styles<br/>[leaflet.css]"]
  map_view(("Map view<br/>render surface"))
  user_file["GeoTIFF file<br/>local input"]
  overlay_legend[("Overlay legend<br/>session state")]
  local_io["Local import/export<br/>file exchange"]
end

index_html -->|"loads"| leaflet_js
index_html -->|"loads"| leaflet_css
index_html -->|"loads"| app_js
index_html -->|"loads"| style_css
app_js -->|"initializes"| map_view
leaflet_js -->|"renders"| map_view
leaflet_css -->|"styles"| map_view
user_file -->|"uploads to"| app_js
app_js -->|"updates"| overlay_legend
app_js -.->|"imports/exports"| local_io
overlay_legend -->|"displays on"| map_view
style_css -->|"positions"| overlay_legend

click index_html "https://github.com/joemattathil/geotiff-mapper/blob/main/index.html"
click app_js "https://github.com/joemattathil/geotiff-mapper/blob/main/app.js"
click style_css "https://github.com/joemattathil/geotiff-mapper/blob/main/style.css"
click leaflet_js "https://github.com/joemattathil/geotiff-mapper/blob/main/leaflet.js"
click leaflet_css "https://github.com/joemattathil/geotiff-mapper/blob/main/leaflet.css"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class index_html,app_js,style_css,leaflet_js,leaflet_css,map_view,user_file,overlay_legend,local_io toneBlue
```

## Components

### Browser App

Static client-side GIS application

- [index.html](https://github.com/joemattathil/geotiff-mapper/blob/HEAD/index.html): entry shell · Browser entry point that assembles the page and loads assets · `index.html`
- [app.js](https://github.com/joemattathil/geotiff-mapper/blob/HEAD/app.js): controller · Main application logic for file handling, map setup, and session coordination · `app.js`
- [style.css](https://github.com/joemattathil/geotiff-mapper/blob/HEAD/style.css): ui styles · App-specific layout and control styling · `style.css`
- [leaflet.js](https://github.com/joemattathil/geotiff-mapper/blob/HEAD/leaflet.js): map engine · Local Leaflet runtime used for interactive mapping · `leaflet.js`
- [leaflet.css](https://github.com/joemattathil/geotiff-mapper/blob/HEAD/leaflet.css): map styles · Leaflet's base styles for map rendering · `leaflet.css`
- **Map view**: render surface · Interactive map canvas where tiles and overlays are displayed
- **GeoTIFF file**: local input · Raster file selected from the user's machine
- **Overlay legend**: session state · In-browser overlay and legend state kept during the session
- **Local import/export**: file exchange · Optional local JSON or Excel workflow for moving data in and out of the app

## Connections

- index.html → leaflet.js: loads · Includes the mapping library into the page
- index.html → leaflet.css: loads · Includes Leaflet styling
- index.html → app.js: loads · Bootstraps custom application logic
- index.html → style.css: loads · Applies app-specific styling
- app.js → Map view: initializes · Creates and configures the interactive map
- leaflet.js → Map view: renders · Provides map interaction and rendering primitives
- leaflet.css → Map view: styles · Provides baseline map layout and visuals
- GeoTIFF file → app.js: uploads to · GeoTIFF is handled client-side by the application logic
- app.js → Overlay legend: updates · Maintains overlay and legend state in memory
- app.js → Local import/export: imports/exports · Supports local file-based data exchange when used
- Overlay legend → Map view: displays on · Legend and overlay state are reflected in the map UI
- style.css → Overlay legend: positions · Controls legend and UI layout
