write attributions.txt crediting OSM contributors, mention OSM copyright in README, closes #53
This commit is contained in:
parent
0037a83f68
commit
7ccc303022
4 changed files with 34 additions and 1 deletions
|
|
@ -1 +1 @@
|
|||
Subproject commit 7496330a36bdfa7a3cdacff26d785a0607e63328
|
||||
Subproject commit d26d5794d396141905d71ecb8cd4f45e0120cba7
|
||||
|
|
@ -345,6 +345,22 @@ void Writer::write(gtfs::Feed* sourceFeed, const std::string& path) const {
|
|||
cannotWrite(curFileTg);
|
||||
}
|
||||
}
|
||||
|
||||
curFile = getTmpFName(gtfsPath, ".pfaedle-tmp", "attributions.txt");
|
||||
curFileTg = gtfsPath + "/attributions.txt";
|
||||
fs.open(curFile.c_str());
|
||||
if (!fs.good()) cannotWrite(curFile, curFileTg);
|
||||
writeAttribution(sourceFeed, &fs);
|
||||
fs.close();
|
||||
|
||||
if (toZip) {
|
||||
#ifdef LIBZIP_FOUND
|
||||
moveIntoZip(za, curFile, "attributions.txt");
|
||||
#endif
|
||||
} else {
|
||||
if (std::rename(curFile.c_str(), curFileTg.c_str()))
|
||||
cannotWrite(curFileTg);
|
||||
}
|
||||
} catch (...) {
|
||||
#ifdef LIBZIP_FOUND
|
||||
zip_discard(za);
|
||||
|
|
@ -363,6 +379,18 @@ void Writer::write(gtfs::Feed* sourceFeed, const std::string& path) const {
|
|||
}
|
||||
}
|
||||
|
||||
// ____________________________________________________________________________
|
||||
void Writer::writeAttribution(gtfs::Feed*, std::ostream* os) const {
|
||||
auto csvw = ad::cppgtfs::Writer::getAttributionCsvw(os);
|
||||
|
||||
csvw->flushLine();
|
||||
csvw->writeString("OpenStreetMap contributors");
|
||||
csvw->writeString("https://www.openstreetmap.org/copyright");
|
||||
csvw->writeInt(1);
|
||||
|
||||
csvw->flushLine();
|
||||
}
|
||||
|
||||
// ____________________________________________________________________________
|
||||
void Writer::writeFeedInfo(gtfs::Feed* f, std::ostream* os) const {
|
||||
auto csvw = ad::cppgtfs::Writer::getFeedInfoCsvw(os);
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ class Writer {
|
|||
void writeStopTimes(Feed* f, std::ostream* os) const;
|
||||
void writeLevels(Feed* f, std::ostream* os) const;
|
||||
void writePathways(Feed* f, std::ostream* os) const;
|
||||
void writeAttribution(Feed* f, std::ostream* os) const;
|
||||
|
||||
static void cannotWrite(const std::string& file, const std::string& file2);
|
||||
static void cannotWrite(const std::string& file);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue