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
|
@ -109,3 +109,7 @@ The following flags may be useful for debugging:
|
|||
# Configuration
|
||||
|
||||
A default configuration file `pfaedle.cfg` can be found in this repo and will be installed with `make install`. Custom configuration files can be specified with the `-c` flag. If no `-c` flag is set, `pfaedle` will parse and merge the following cfg files in the given order (if present): `<install prefix>/etc/pfaedle/pfaedle.cfg`, `$HOME/.config/pfaedle/pfaedle.cfg`, `<CWD>/pfaedle.cfg`. Values given in later files will overwrite earlier defined values.
|
||||
|
||||
# Attribution
|
||||
|
||||
Note that the `shapes.txt` produced by `pfaedle` is based on OpenStreetMap data, which is licensed under OdBL 1.0 (see [here](https://osm.org/copyright)). If you copy, distribute, transmit and adapt the shapefied GTFS feed, please credit the contributors of OpenStreetMap.
|
||||
|
|
|
@ -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…
Reference in a new issue