HFA
application/x-erdas-hfa
Magic Bytes
Offset: 0
45 48 46 41 5F 48 45 41 44 45 52 5F 54 41 47
Hierarchical File Architecture (HFA) is a proprietary geospatial raster format developed by ERDAS, Inc. for the ERDAS IMAGINE software suite. It is widely used for storing satellite imagery, aerial photography, and complex remote sensing data within a flexible, node-based structure. Although proprietary, the format is supported by various Geographic Information Systems (GIS) and remains a standard for managing high-resolution raster datasets with extensive metadata.
Validation Code
How to validate .hfa files in Python
Python
def is_hfa(file_path: str) -> bool:
"""Check if file is a valid HFA by magic bytes."""
signature = bytes([0x45, 0x48, 0x46, 0x41, 0x5F, 0x48, 0x45, 0x41, 0x44, 0x45, 0x52, 0x5F, 0x54, 0x41, 0x47])
with open(file_path, "rb") as f:
return f.read(15) == signature
How to validate .hfa files in Node.js
Node.js
function isHFA(buffer: Buffer): boolean {
const signature = Buffer.from([0x45, 0x48, 0x46, 0x41, 0x5F, 0x48, 0x45, 0x41, 0x44, 0x45, 0x52, 0x5F, 0x54, 0x41, 0x47]);
return buffer.subarray(0, 15).equals(signature);
}
Go
func IsHFA(data []byte) bool {
signature := []byte{0x45, 0x48, 0x46, 0x41, 0x5F, 0x48, 0x45, 0x41, 0x44, 0x45, 0x52, 0x5F, 0x54, 0x41, 0x47}
if len(data) < 15 {
return false
}
return bytes.Equal(data[:15], signature)
}
API Endpoint
GET
/api/v1/hfa
curl https://filesignature.org/api/v1/hfa