# cran/dsn architecture

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

- Interactive diagram: https://gitdiagram.com/cran/dsn
- Repository: https://github.com/cran/dsn

## Overview

dsn is a small R library for composing and interpreting GDAL-style data-source strings; it does not itself open or process GDAL data. Users call helpers to add or remove prefixes, wrap subdataset or VRT declarations, build MEM-driver connections, and access datatype or GCP utilities. The MEM connection uses a native address helper, whose registration is visible in the sampled C source. The README documents the capabilities, but the R implementations were not sampled, so detailed call relationships between them are not shown.

Main entry points: [`src/init.c`](https://github.com/cran/dsn/blob/master/src/init.c) (Native registration), [`R/prefix.R`](https://github.com/cran/dsn/blob/master/R/prefix.R) (Prefix helpers), [`R/wrap.R`](https://github.com/cran/dsn/blob/master/R/wrap.R) (DSN wrappers), [`R/mem.R`](https://github.com/cran/dsn/blob/master/R/mem.R) (MEM connections)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_dsn_strings["DSN strings"]
  node_prefix_helpers["Prefix helpers<br/>[prefix.R]"]
  node_wrapper_helpers["DSN wrappers<br/>[wrap.R]"]
  node_mem_connections["MEM connections<br/>[mem.R]"]
end

subgraph group_raster_metadata["Raster metadata"]
  node_datatype_helpers["Datatype helpers<br/>[datatype.R]"]
  node_gcp_helpers["GCP helpers<br/>[gcp.R]"]
end

subgraph group_native_support["Native support"]
  node_address_helper["Vector address<br/>[addr.c]"]
  node_native_registration["Native registration<br/>[init.c]"]
end

node_user(("R user"))

node_user -->|"adds or removes"| node_prefix_helpers
node_user -->|"wraps declarations"| node_wrapper_helpers
node_user -->|"creates connections"| node_mem_connections
node_user -->|"uses datatype helpers"| node_datatype_helpers
node_user -->|"creates GCP lists"| node_gcp_helpers
node_native_registration -->|"registers"| node_address_helper

click node_prefix_helpers "https://github.com/cran/dsn/blob/master/R/prefix.R"
click node_wrapper_helpers "https://github.com/cran/dsn/blob/master/R/wrap.R"
click node_mem_connections "https://github.com/cran/dsn/blob/master/R/mem.R"
click node_datatype_helpers "https://github.com/cran/dsn/blob/master/R/datatype.R"
click node_gcp_helpers "https://github.com/cran/dsn/blob/master/R/gcp.R"
click node_address_helper "https://github.com/cran/dsn/blob/master/src/addr.c"
click node_native_registration "https://github.com/cran/dsn/blob/master/src/init.c"

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_prefix_helpers,node_wrapper_helpers,node_mem_connections,node_user toneBlue
class node_datatype_helpers,node_gcp_helpers toneAmber
class node_address_helper,node_native_registration toneMint
```

## Components

### DSN strings

- [Prefix helpers](https://github.com/cran/dsn/blob/master/R/prefix.R): `R/prefix.R`
- [DSN wrappers](https://github.com/cran/dsn/blob/master/R/wrap.R): `R/wrap.R`
- [MEM connections](https://github.com/cran/dsn/blob/master/R/mem.R): `R/mem.R`

### Raster metadata

- [Datatype helpers](https://github.com/cran/dsn/blob/master/R/datatype.R): `R/datatype.R`
- [GCP helpers](https://github.com/cran/dsn/blob/master/R/gcp.R): `R/gcp.R`

### Native support

- [Vector address](https://github.com/cran/dsn/blob/master/src/addr.c): `src/addr.c`
- [Native registration](https://github.com/cran/dsn/blob/master/src/init.c): `src/init.c`

### Other components

- **R user**

## Connections

- R user → Prefix helpers: adds or removes (evidence: `README.md`)
- R user → DSN wrappers: wraps declarations (evidence: `README.md`)
- R user → MEM connections: creates connections (evidence: `README.md`)
- R user → Datatype helpers: uses datatype helpers (evidence: `README.md`)
- R user → GCP helpers: creates GCP lists (evidence: `README.md`)
- Native registration → Vector address: registers (evidence: `src/init.c`)
