From 334a99fab92a55abd7410a24314a39b5e0ffb680 Mon Sep 17 00:00:00 2001 From: Richard Fairhurst Date: Tue, 7 Mar 2023 23:22:34 +0000 Subject: [PATCH] Ignore nodes in ways with --skip-integrity (#469) (#471) --- include/osm_store.h | 1 + src/read_pbf.cpp | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/include/osm_store.h b/include/osm_store.h index a616c1eb..311890f6 100644 --- a/include/osm_store.h +++ b/include/osm_store.h @@ -463,6 +463,7 @@ class OSMStore void use_compact_store(bool use = true) { use_compact_nodes = use; } void enforce_integrity(bool ei = true) { require_integrity = ei; } + bool integrity_enforced() { return require_integrity; } void shapes_sort(unsigned int threadNum = 1); void generated_sort(unsigned int threadNum = 1); diff --git a/src/read_pbf.cpp b/src/read_pbf.cpp index 773292ca..aa61372c 100644 --- a/src/read_pbf.cpp +++ b/src/read_pbf.cpp @@ -90,7 +90,11 @@ bool PbfReader::ReadWays(OsmLuaProcessing &output, PrimitiveGroup &pg, Primitive int64_t nodeId = 0; for (int k=0; k(nodeId))); + try { + llVec.push_back(osmStore.nodes_at(static_cast(nodeId))); + } catch (std::out_of_range &err) { + if (osmStore.integrity_enforced()) throw err; + } } }