Skip to content

Read OSM PBF file header and bounds? #147

@WalterSharpJr

Description

@WalterSharpJr

I'm busy converting a library I originally wrote in c++ with libosmium to c# and OsmSharp.

One issue I'm having is that with the libosmium library I could retrieve the bounding box for the PBF file like so:

auto header = pbfReader.header();
auto box = header.box();

if (box.valid()) {
	auto topRight = box.top_right();
	auto bottomLeft = box.bottom_left();

	bounds.SetBounds(bottomLeft.lon(), topRight.lat(), topRight.lon(), bottomLeft.lat());
}

I'm trying to find a way to do the same with OsmSharp but I'm not coming up with anything. Is this something that can be done with OsmSharp?

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions