1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
//! Magic-byte signatures for binary geospatial formats.
//!
//! This module centralises every format fingerprint used by
//! [`DatasetFormat::detect_from_magic_bytes`] and
//! [`DatasetFormat::detect`]. All constants are `pub(crate)` so they
//! can be referenced from `open.rs` without duplication.
//!
//! # Adding a new format
//!
//! 1. Define a `pub(crate) const` for the signature bytes.
//! 2. Add a match arm in [`crate::DatasetFormat::detect_from_magic_bytes`].
//! 3. Update the doc-comment table here.
//!
//! # Format signatures table
//!
//! | Format | Offset | Bytes (hex) |
//! |-----------------|--------|-----------------------------------------------|
//! | TIFF LE | 0 | `49 49` |
//! | TIFF BE | 0 | `4D 4D` |
//! | JPEG 2000 | 0 | `00 00 00 0C 6A 50 20 20 0D 0A 87 0A` |
//! | HDF5 | 0 | `89 48 44 46 0D 0A 1A 0A` |
//! | NetCDF classic | 0 | `43 44 46 01` (or `02` / `05`) |
//! | SQLite / GPKG | 0 | `53 51 4C 69 74 65` |
//! | ZIP / GPKG | 0 | `50 4B 03 04` |
//! | FlatGeobuf | 0 | `66 67 62 03 66 67 62 00` (`fgb\x03fgb\x00`) |
//! | PMTiles v3 | 0 | `50 4D 54 69 6C 65 73` (`PMTiles`) |
//! | LAS / LAZ | 0 | `4C 41 53 46` (`LASF`) |
//! | GRIB / GRIB2 | 0 | `47 52 49 42` (`GRIB`) |
//! | GeoParquet | 0 | `50 41 52 31` (`PAR1`) |
// ─── TIFF ────────────────────────────────────────────────────────────────────
/// TIFF little-endian byte-order marker: `II`
pub const TIFF_LE_MAGIC: = ;
/// TIFF big-endian byte-order marker: `MM`
pub const TIFF_BE_MAGIC: = ;
/// Standard TIFF IFD version field (42)
pub const TIFF_VERSION: u16 = 42;
/// BigTIFF IFD version field (43)
pub const BIGTIFF_VERSION: u16 = 43;
// ─── JPEG 2000 ────────────────────────────────────────────────────────────────
/// JPEG 2000 / JP2 box signature (12 bytes)
pub const JP2_MAGIC: = ;
// ─── HDF5 ─────────────────────────────────────────────────────────────────────
/// HDF5 superblock signature (8 bytes)
pub const HDF5_MAGIC: = ;
// ─── NetCDF ──────────────────────────────────────────────────────────────────
/// NetCDF classic / 64-bit offset prefix: `CDF` (bytes 0-2)
pub const NETCDF_MAGIC: = ;
// ─── SQLite / GeoPackage ─────────────────────────────────────────────────────
/// SQLite database file header prefix (6 bytes).
/// Used for GeoPackage (.gpkg) and MBTiles (.mbtiles).
pub const SQLITE_MAGIC: = ;
/// ZIP local file header: `PK\x03\x04`.
/// ZIP-based formats include ODS/XLSX as well as some GPKG variants.
pub const ZIP_MAGIC: = ;
// ─── FlatGeobuf ───────────────────────────────────────────────────────────────
/// FlatGeobuf magic bytes: `fgb\x03fgb\x00` (8 bytes)
pub const FLATGEOBUF_MAGIC: = ;
// ─── PMTiles ─────────────────────────────────────────────────────────────────
/// PMTiles v3 magic: `PMTiles` (7 bytes)
pub const PMTILES_MAGIC: = ;
// ─── LAS / LAZ (COPC) ────────────────────────────────────────────────────────
/// LAS/LAZ file signature: `LASF` (4 bytes)
pub const LAS_MAGIC: = ;
// ─── GRIB ────────────────────────────────────────────────────────────────────
/// GRIB/GRIB2 edition indicator: `GRIB` (4 bytes)
pub const GRIB_MAGIC: = ;
// ─── GeoParquet ──────────────────────────────────────────────────────────────
/// Parquet file magic: `PAR1` at both the start and end of the file.
/// We only check the start here; end-of-file checks are left to the driver.
pub const GEOPARQUET_MAGIC: = ;
// ─── Minimum read size ───────────────────────────────────────────────────────
/// Minimum bytes to read for reliable magic detection.
/// 72 bytes covers: SQLite (16), PMTiles (7), JP2 (12), HDF5 (8),
/// TIFF (8), LAS (4), GRIB (4), FlatGeobuf (8), Parquet (4), NetCDF (4).
pub const MAGIC_READ_SIZE: usize = 72;