Skip to main content

sorted_max_node_id

Function sorted_max_node_id 

Source
pub fn sorted_max_node_id(pbf_path: &Path) -> Result<Option<u64>, GeolithError>
Expand description

The largest node id of a PBF sorted by type then id, or None when the header does not declare that order.

In a sorted file the blobs that hold nodes are a prefix of the file, and the last node of the last of them has the largest id. Reading only the blob headers (each body is skipped with a seek), then binary-searching for that last node blob, decodes about log2(blobs) blobs: around 21 for the planet’s 1.4 million, instead of every node blob.

§Errors

Returns an error if the PBF file can’t be read or a blob can’t be decoded.