geo_osm_pbf 1.0.0
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_finder1.0.3 so that the OSM acquisition and decoding layer can be shared withgeo_tile_builder. The moved code is unchanged in behaviour; its tests moved with it. - Model:
GeoCoordinate(+haversineMeters,equirectSquared,earthRadiusMeters),GeoNode,GeoWay— moved fromgeo_route_finder.GeoTaggedNode(new): a node that carries tags of its own. Kept separate fromGeoNodeso 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, withisMultipolygon,membersOfandmembersWithRolehelpers.
OsmPbfParser:- Moved from
geo_route_finder, with the streaming, dependency-free hand-rolled protobuf decoding intact. - Added
onTaggedNode: decodes theDenseNodes.keys_valsstream, which was previously skipped. Read only when the callback is supplied, so the routing path is unaffected. - Added
onRelationandreadRelations: decodesPrimitiveGroupfield 4, undoing the delta encoding of member ids and resolving roles. - Added sparse (non-dense)
Nodedecoding, previously skipped silently. - Added
onHeaderandreadHeader, decoding theOSMHeaderblock — 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.
- Moved from
OsmHeader,OsmBoundingBox(new): the header block, withunsupportedFeaturesandisHistorical.OsmDownloader.downloadRegionnow verifies that what arrived is really an.osm.pbf, and deletes it (with its.dlmetaand.part) if not.- Why: a provider answers an unknown region path with
200 OKand an HTML page. That page has a correctContent-Length, so the existing size check accepted it, cached it on disk under the extract's name, and left a.dlmetathat a later resume would have tried to continue. The failure only surfaced later, far from its cause. Observed against Geofabrik. downloadUrlstays content-agnostic; only the region path validates.
- Why: a provider answers an unknown region path with
- Download subsystem moved unchanged:
OsmDownloader,OsmDownloadSource,OsmMirroredSource,OsmSourceResolver,OsmDownloadSourceRegistry,MirrorBenchmark,OsmPatternDownloadSource, and the Geofabrik, OSM France, BBBike and Planet sources. - Tests:
test/support.dartsynthesizes a valid.osm.pbfin 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_valsterminator, member id delta decoding, and non-ASCII tag values.