swh:1:snp:ff2a11cd2e44dd19ec3814028ef2ce6605664e63
Raw File
Tip revision: b7cc62cadded212a9921d1f9905f22afbbdd1d95 authored by Eric Fischer on 13 April 2017, 00:00:18 UTC
Reduce number of input threads if needed to avoid using too many files
Tip revision: b7cc62c
rawtiles.cpp
#include <iostream>
#include <fstream>
#include <string>
#include <sys/stat.h>
#include "rawtiles.hpp"

void write_raw_tile(const char *outdir, int z, int tx, int ty, std::string const &pbf) {
	mkdir(outdir, S_IRWXU | S_IRWXG | S_IRWXO);
	std::string curdir(outdir);
	std::string slash("/");
	std::string newdir = curdir + slash + std::to_string(z);
	mkdir(newdir.c_str(), S_IRWXU | S_IRWXG | S_IRWXO);
	newdir = newdir + "/" + std::to_string(tx);
	mkdir(newdir.c_str(), S_IRWXU | S_IRWXG | S_IRWXO);
	newdir = newdir + "/" + std::to_string(ty) + ".pbf";

	std::ofstream pbfFile(newdir, std::ios::out | std::ios::binary);
	pbfFile.write(pbf.data(), pbf.size());
	pbfFile.close();
}
back to top