gz support for OSM xml reading and writing

This commit is contained in:
Patrick Brosi 2023-08-23 13:46:23 +02:00
parent ed15d5d1de
commit d43d9fc908
10 changed files with 137 additions and 44 deletions

View file

@ -18,7 +18,7 @@ configure_file (
add_executable(pfaedle ${pfaedle_main})
add_library(pfaedle_dep ${pfaedle_SRC})
include_directories(pfaedle_dep PUBLIC ${PROJECT_SOURCE_DIR}/src/cppgtfs/src)
include_directories(pfaedle_dep PUBLIC ${PROJECT_SOURCE_DIR}/src/xml/include/ ${PROJECT_SOURCE_DIR}/src/cppgtfs/src)
target_link_libraries(pfaedle pfaedle_dep util configparser ad_cppgtfs -lpthread ${LIBZIP_LIBRARY})
add_subdirectory(tests)

View file

@ -24,7 +24,7 @@
#include "util/Misc.h"
#include "util/Nullable.h"
#include "util/log/Log.h"
#include "xml/pfxml.h"
#include "pfxml/pfxml.h"
using ad::cppgtfs::gtfs::Stop;
using pfaedle::osm::BlockSearch;
@ -333,8 +333,6 @@ void OsmBuilder::filterWrite(const std::string& in, const std::string& out,
NIdMultMap multNodes;
pfxml::file xml(in);
std::ofstream outstr;
outstr.open(out);
BBoxIdx latLngBox = box;
@ -381,9 +379,9 @@ void OsmBuilder::filterWrite(const std::string& in, const std::string& out,
latLngBox.add(Box<double>({minlon, minlat}, {maxlon, maxlat}));
}
util::xml::XmlWriter wr(&outstr, true, 4);
util::xml::XmlWriter wr(out, true, 4);
outstr << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
wr.put("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
wr.openTag("osm", {{"version", "0.6"},
{"generator", std::string("pfaedle/") + VERSION_FULL}});
wr.openTag(

View file

@ -25,7 +25,7 @@
#include "util/Nullable.h"
#include "util/geo/Geo.h"
#include "util/xml/XmlWriter.h"
#include "xml/pfxml.h"
#include "pfxml/pfxml.h"
namespace pfaedle {
namespace osm {