public class FileStructureAnalyzer extends Object
Modifier and Type | Method and Description |
---|---|
static FileStructure |
analyze(PbfFile pbfFile)
Analyze the file structure of the specified PBF file.
|
public static FileStructure analyze(PbfFile pbfFile) throws IOException
PbfFile.buildBlockIndex()
. After that it will scan the blocks for
the contained element types and build a FileStructure
object that
specifies which blocks of the file contain nodes, which contain ways and
which contain relations.
The analyzer will find the boundaries between entity types using binary
search. Since a PBF file block needs to be parsed completely (and
possibly extracted beforehand) before we can tell which entities it
contains, it is computationally expensive to read a block. Using binary
search minimizes the number of blocks that will be parsed in order to
find the entity block boundaries.
For the algorithm to work correctly, it is of course necessary that the
input file contains the OSM entities in their correct order, i.e. first
nodes if any, then ways if any and finally relations if any.pbfFile
- IOException