Only movetos and linetos have elevations, not closepaths

This commit is contained in:
Eric Fischer 2018-10-11 17:04:03 -07:00
parent 6315009cc1
commit c3d06f8931

20
mvt.cpp
View File

@ -468,18 +468,20 @@ bool mvt_tile::decode(std::string &message, bool &was_compressed) {
std::vector<long> &elevations = layer.features[i].elevations; std::vector<long> &elevations = layer.features[i].elevations;
if (elevations.size() != 0) { if (elevations.size() != 0) {
for (size_t j = 0; j < geom.size(); j++) { for (size_t j = 0; j < geom.size(); j++) {
if (off < elevations.size()) { if (geom[j].op == mvt_moveto || geom[j].op == mvt_lineto) {
double el; if (off < elevations.size()) {
double el;
current_elevation += elevations[off]; current_elevation += elevations[off];
el = elevation_scaling.base + elevation_scaling.multiplier * current_elevation; el = elevation_scaling.base + elevation_scaling.multiplier * current_elevation;
geom[j].elevations.push_back(el); geom[j].elevations.push_back(el);
off++; off++;
} else { } else {
fprintf(stderr, "Ran out of elevations\n"); fprintf(stderr, "Ran out of elevations\n");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
}
} }
} }
} }