Retain original feature index rather than recalculating

For better density calculation of clipped features
This commit is contained in:
Eric Fischer
2016-11-02 15:11:22 -07:00
parent d0db3323fb
commit 2e3ba8f374
8 changed files with 177 additions and 165 deletions
+7 -6
View File
@@ -381,6 +381,12 @@ int serialize_geometry(json_object *geometry, json_object *properties, json_obje
sf.m = m;
sf.feature_minzoom = 0; // Will be filled in during index merging
// Calculate the center even if off the edge of the plane,
// and then mask to bring it back into the addressable area
long long midx = (bbox[0] / 2 + bbox[2] / 2) & ((1LL << 32) - 1);
long long midy = (bbox[1] / 2 + bbox[3] / 2) & ((1LL << 32) - 1);
sf.index = encode(midx, midy);
if (inline_meta) {
sf.metapos = -1;
for (size_t i = 0; i < m; i++) {
@@ -403,12 +409,7 @@ int serialize_geometry(json_object *geometry, json_object *properties, json_obje
index.segment = segment;
index.seq = *layer_seq;
index.t = sf.t;
// Calculate the center even if off the edge of the plane,
// and then mask to bring it back into the addressable area
long long midx = (bbox[0] / 2 + bbox[2] / 2) & ((1LL << 32) - 1);
long long midy = (bbox[1] / 2 + bbox[3] / 2) & ((1LL << 32) - 1);
index.index = encode(midx, midy);
index.index = sf.index;
fwrite_check(&index, sizeof(struct index), 1, indexfile, fname);
*indexpos += sizeof(struct index);