Skip to content

Commit

Permalink
Fix available root tiles in layer.json with 'CesiumFriendly' param
Browse files Browse the repository at this point in the history
  • Loading branch information
ahuarte47 committed May 17, 2018
1 parent 3471487 commit 2ebd493
Showing 1 changed file with 20 additions and 11 deletions.
31 changes: 20 additions & 11 deletions tools/ctb-tile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -778,17 +778,6 @@ main(int argc, char *argv[]) {
}
}

// Write Json metadata file?
if (metadata) {
std::string datasetName(command.getInputFilename());
datasetName = datasetName.substr(datasetName.find_last_of("/\\") + 1);
const size_t rfindpos = datasetName.rfind('.');
if (std::string::npos != rfindpos) datasetName = datasetName.erase(rfindpos);

metadata->writeJsonFile(filename, datasetName, std::string(command.outputFormat), std::string(command.profile), command.vertexNormals);
delete metadata;
}

// CesiumJS friendly?
if (command.cesiumFriendly && (strcmp(command.profile, "geodetic") == 0) && command.endZoom <= 0) {
std::string dirName0 = string(command.outputDir) + osDirSep + "0" + osDirSep + "0";
Expand All @@ -805,6 +794,26 @@ main(int argc, char *argv[]) {
VSIMkdir(dirName0.c_str(), 0755);
fileCopy(tileName1, tileName0);
}

// Fix available indexes.
if (metadata && metadata->levels.size() > 0) {
TerrainMetadata::LevelInfo &level = metadata->levels.at(0);
level.startX = 0;
level.startY = 0;
level.finalX = 1;
level.finalY = 0;
}
}

// Write Json metadata file?
if (metadata) {
std::string datasetName(command.getInputFilename());
datasetName = datasetName.substr(datasetName.find_last_of("/\\") + 1);
const size_t rfindpos = datasetName.rfind('.');
if (std::string::npos != rfindpos) datasetName = datasetName.erase(rfindpos);

metadata->writeJsonFile(filename, datasetName, std::string(command.outputFormat), std::string(command.profile), command.vertexNormals);
delete metadata;
}

return 0;
Expand Down

0 comments on commit 2ebd493

Please sign in to comment.