# yamiriko/gis_nextjs architecture

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

- Interactive diagram: https://gitdiagram.com/yamiriko/gis_nextjs
- Repository: https://github.com/yamiriko/gis_nextjs

## Overview

This Next.js GIS app presents Pekanbaru’s district boundaries in an interactive Leaflet map. The user opens the home page; the client map obtains the KMZ through the API, unpacks and parses its KML, then renders styled boundaries, district popups, a satellite basemap, and a clickable city-center marker. The graph separates page delivery, KMZ access, and map behavior. Some fetch and rendering details are documented in the README but omitted from the source excerpts, so those links cite the README; unsampled internals are not inferred.

Main entry points: [`app/pekanbaru-map.js`](https://github.com/yamiriko/gis_nextjs/blob/main/app/pekanbaru-map.js) (Interactive map), [`app/page.js`](https://github.com/yamiriko/gis_nextjs/blob/main/app/page.js) (Home page), [`app/api/kmz/route.js`](https://github.com/yamiriko/gis_nextjs/blob/main/app/api/kmz/route.js) (KMZ endpoint), [`app/BatasKecamatanKotaPekanbaru.kmz`](https://github.com/yamiriko/gis_nextjs/blob/main/app/BatasKecamatanKotaPekanbaru.kmz) (District KMZ)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_delivery["Page delivery"]
  node_home["Home page<br/>[page.js]"]
end

subgraph group_data["Boundary data"]
  node_api["KMZ endpoint<br/>[route.js]"]
  node_kmz["District KMZ"]
end

subgraph group_mapping["Map experience"]
  node_map["Interactive map<br/>[pekanbaru-map.js]"]
  node_unpack["KMZ extraction<br/>[pekanbaru-map.js]"]
  node_kml["KML conversion<br/>[pekanbaru-map.js]"]
  node_styles["KML style handling<br/>[pekanbaru-map.js]"]
  node_boundary["District boundaries<br/>[pekanbaru-map.js]"]
  node_popup["District details<br/>[pekanbaru-map.js]"]
  node_viewport["Map navigation<br/>[pekanbaru-map.js]"]
  node_center["City-center marker<br/>[pekanbaru-map.js]"]
end

node_visitor(("Map visitor"))
node_tiles["Satellite tiles"]

node_visitor -->|"opens"| node_home
node_home -->|"loads"| node_map
node_map -->|"fetches KMZ"| node_api
node_api -->|"reads"| node_kmz
node_map -->|"unpacks"| node_unpack
node_unpack -->|"passes KML"| node_kml
node_kml -->|"converts to GeoJSON"| node_boundary
node_kml -->|"extracts styles"| node_styles
node_boundary -->|"resolves feature style"| node_styles
node_boundary -->|"binds details"| node_popup
node_map -->|"renders"| node_boundary
node_map -->|"fits bounds"| node_viewport
node_map -->|"renders"| node_center
node_map -->|"loads tiles"| node_tiles

click node_home "https://github.com/yamiriko/gis_nextjs/blob/main/app/page.js"
click node_map "https://github.com/yamiriko/gis_nextjs/blob/main/app/pekanbaru-map.js"
click node_api "https://github.com/yamiriko/gis_nextjs/blob/main/app/api/kmz/route.js"
click node_kmz "https://github.com/yamiriko/gis_nextjs/blob/main/app/BatasKecamatanKotaPekanbaru.kmz"
click node_unpack "https://github.com/yamiriko/gis_nextjs/blob/main/app/pekanbaru-map.js"
click node_kml "https://github.com/yamiriko/gis_nextjs/blob/main/app/pekanbaru-map.js"
click node_styles "https://github.com/yamiriko/gis_nextjs/blob/main/app/pekanbaru-map.js"
click node_boundary "https://github.com/yamiriko/gis_nextjs/blob/main/app/pekanbaru-map.js"
click node_popup "https://github.com/yamiriko/gis_nextjs/blob/main/app/pekanbaru-map.js"
click node_viewport "https://github.com/yamiriko/gis_nextjs/blob/main/app/pekanbaru-map.js"
click node_center "https://github.com/yamiriko/gis_nextjs/blob/main/app/pekanbaru-map.js"

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 node_home toneBlue
class node_api,node_kmz toneAmber
class node_map,node_unpack,node_kml,node_styles,node_boundary,node_popup,node_viewport,node_center toneMint
class node_visitor,node_tiles toneIndigo
```

## Components

### Page delivery

- [Home page](https://github.com/yamiriko/gis_nextjs/blob/main/app/page.js): `app/page.js`

### Boundary data

- [KMZ endpoint](https://github.com/yamiriko/gis_nextjs/blob/main/app/api/kmz/route.js): `app/api/kmz/route.js`
- [District KMZ](https://github.com/yamiriko/gis_nextjs/blob/main/app/BatasKecamatanKotaPekanbaru.kmz): `app/BatasKecamatanKotaPekanbaru.kmz`

### Map experience

- [Interactive map](https://github.com/yamiriko/gis_nextjs/blob/main/app/pekanbaru-map.js): `app/pekanbaru-map.js`
- [KMZ extraction](https://github.com/yamiriko/gis_nextjs/blob/main/app/pekanbaru-map.js): `app/pekanbaru-map.js`
- [KML conversion](https://github.com/yamiriko/gis_nextjs/blob/main/app/pekanbaru-map.js): `app/pekanbaru-map.js`
- [KML style handling](https://github.com/yamiriko/gis_nextjs/blob/main/app/pekanbaru-map.js): `app/pekanbaru-map.js`
- [District boundaries](https://github.com/yamiriko/gis_nextjs/blob/main/app/pekanbaru-map.js): `app/pekanbaru-map.js`
- [District details](https://github.com/yamiriko/gis_nextjs/blob/main/app/pekanbaru-map.js): `app/pekanbaru-map.js`
- [Map navigation](https://github.com/yamiriko/gis_nextjs/blob/main/app/pekanbaru-map.js): `app/pekanbaru-map.js`
- [City-center marker](https://github.com/yamiriko/gis_nextjs/blob/main/app/pekanbaru-map.js): `app/pekanbaru-map.js`

### Other components

- **Map visitor**
- **Satellite tiles**

## Connections

- Map visitor → Home page: opens (evidence: `README.md`)
- Home page → Interactive map: loads (evidence: `app/page.js`)
- Interactive map → KMZ endpoint: fetches KMZ (evidence: `README.md`)
- KMZ endpoint → District KMZ: reads (evidence: `app/api/kmz/route.js`)
- Interactive map → KMZ extraction: unpacks (evidence: `app/pekanbaru-map.js`)
- KMZ extraction → KML conversion: passes KML (evidence: `app/pekanbaru-map.js`)
- KML conversion → District boundaries: converts to GeoJSON (evidence: `app/pekanbaru-map.js`)
- KML conversion → KML style handling: extracts styles (evidence: `app/pekanbaru-map.js`)
- District boundaries → KML style handling: resolves feature style (evidence: `app/pekanbaru-map.js`)
- District boundaries → District details: binds details (evidence: `README.md`)
- Interactive map → District boundaries: renders (evidence: `app/pekanbaru-map.js`)
- Interactive map → Map navigation: fits bounds (evidence: `app/pekanbaru-map.js`)
- Interactive map → City-center marker: renders (evidence: `app/pekanbaru-map.js`)
- Interactive map → Satellite tiles: loads tiles (evidence: `app/pekanbaru-map.js`)
