geo_osm_pbf 1.0.0 copy "geo_osm_pbf: ^1.0.0" to clipboard
geo_osm_pbf: ^1.0.0 copied to clipboard

Streaming OpenStreetMap `.osm.pbf` reader and extract downloader in pure Dart. Hand-rolled protobuf decoding with no dependencies, delivering nodes, tagged nodes, ways and relations with their full tags.

1.0.0 #

  • Initial release, extracted from geo_route_finder 1.0.3 so that the OSM acquisition and decoding layer can be shared with geo_tile_builder. The moved code is unchanged in behaviour; its tests moved with it.
  • Model:
    • GeoCoordinate (+ haversineMeters, equirectSquared, earthRadiusMeters), GeoNode, GeoWay — moved from geo_route_finder.
    • GeoTaggedNode (new): a node that carries tags of its own. Kept separate from GeoNode so that consumers reading only geometry never pay for a tag map across tens of millions of shape points.
    • GeoRelation, GeoMember, GeoMemberType (new): the third OSM element kind, with isMultipolygon, membersOf and membersWithRole helpers.
  • OsmPbfParser:
    • Moved from geo_route_finder, with the streaming, dependency-free hand-rolled protobuf decoding intact.
    • Added onTaggedNode: decodes the DenseNodes.keys_vals stream, which was previously skipped. Read only when the callback is supplied, so the routing path is unaffected.
    • Added onRelation and readRelations: decodes PrimitiveGroup field 4, undoing the delta encoding of member ids and resolving roles.
    • Added sparse (non-dense) Node decoding, previously skipped silently.
    • Added onHeader and readHeader, decoding the OSMHeader block — bounding box, required/optional features, writing program and source. The block was previously ignored entirely.
    • Added isOsmPbf, a cheap shape check on the first blob header.
  • OsmHeader, OsmBoundingBox (new): the header block, with unsupportedFeatures and isHistorical.
  • OsmDownloader.downloadRegion now verifies that what arrived is really an .osm.pbf, and deletes it (with its .dlmeta and .part) if not.
    • Why: a provider answers an unknown region path with 200 OK and an HTML page. That page has a correct Content-Length, so the existing size check accepted it, cached it on disk under the extract's name, and left a .dlmeta that a later resume would have tried to continue. The failure only surfaced later, far from its cause. Observed against Geofabrik.
    • downloadUrl stays content-agnostic; only the region path validates.
  • Download subsystem moved unchanged: OsmDownloader, OsmDownloadSource, OsmMirroredSource, OsmSourceResolver, OsmDownloadSourceRegistry, MirrorBenchmark, OsmPatternDownloadSource, and the Geofabrik, OSM France, BBBike and Planet sources.
  • Tests:
    • test/support.dart synthesizes a valid .osm.pbf in code — including tagged dense nodes, sparse nodes, relations and a header block — so no binary fixture is committed.
    • Covers tag/coordinate alignment across the keys_vals terminator, member id delta decoding, and non-ASCII tag values.
1
likes
150
points
413
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Streaming OpenStreetMap `.osm.pbf` reader and extract downloader in pure Dart. Hand-rolled protobuf decoding with no dependencies, delivering nodes, tagged nodes, ways and relations with their full tags.

Repository (GitHub)
View/report issues

License

Apache-2.0 (license)

Dependencies

path

More

Packages that depend on geo_osm_pbf