GPKG

application/x-geopackage

Safe

Magic Bytes

Offset: 0
53 51 4C 69 74 65 20 66 6F 72 6D 61 74 20 33 00

GeoPackage is an open, standards-based file format governed by the Open Geospatial Consortium (OGC) intended for the exchange of geospatial information. Built upon the SQLite database architecture, it is utilized extensively by Geographic Information Systems (GIS) to store vector features, map tiles, and non-spatial attributes within a single container. This format serves as a modern, platform-independent alternative to legacy Shapefiles, offering broad compatibility across mobile and desktop mapping environments.

Extension

.gpkg

MIME Type

application/x-geopackage, application/x-geopackage; version=1.1Or1.0

Byte Offset

0

Risk Level

Safe

Validation Code

How to validate .gpkg files in Python

Python
def is_gpkg(file_path: str) -> bool:
    """Check if file is a valid GPKG by magic bytes."""
    signature = bytes([0x53, 0x51, 0x4C, 0x69, 0x74, 0x65, 0x20, 0x66, 0x6F, 0x72, 0x6D, 0x61, 0x74, 0x20, 0x33, 0x00])
    with open(file_path, "rb") as f:
        return f.read(16) == signature

How to validate .gpkg files in Node.js

Node.js
function isGPKG(buffer: Buffer): boolean {
  const signature = Buffer.from([0x53, 0x51, 0x4C, 0x69, 0x74, 0x65, 0x20, 0x66, 0x6F, 0x72, 0x6D, 0x61, 0x74, 0x20, 0x33, 0x00]);
  return buffer.subarray(0, 16).equals(signature);
}
Go
func IsGPKG(data []byte) bool {
    signature := []byte{0x53, 0x51, 0x4C, 0x69, 0x74, 0x65, 0x20, 0x66, 0x6F, 0x72, 0x6D, 0x61, 0x74, 0x20, 0x33, 0x00}
    if len(data) < 16 {
        return false
    }
    return bytes.Equal(data[:16], signature)
}

API Endpoint

GET /api/v1/gpkg
curl https://filesignature.org/api/v1/gpkg

Related Formats