Move feature type to index so point skipping can avoid looking up geometry

Which should avoid having to page the geometry in if there is
more data than will fit in memory
This commit is contained in:
Eric Fischer 2014-11-05 12:17:12 -08:00
parent bc4527b25d
commit c24cfada61
3 changed files with 5 additions and 6 deletions

View File

@ -381,7 +381,6 @@ void read_json(FILE *f, char *fname, char *layername, int maxzoom, int minzoom,
unsigned bbox[] = { UINT_MAX, UINT_MAX, 0, 0 };
serialize_int(metafile, mb_geometry[t], &fpos, fname, jp);
parse_geometry(t, coordinates, bbox, &fpos, metafile, VT_MOVETO, fname, jp);
serialize_int(metafile, VT_END, &fpos, fname, jp);
@ -467,6 +466,7 @@ void read_json(FILE *f, char *fname, char *layername, int maxzoom, int minzoom,
ix.index = encode(x << (32 - z), y << (32 - z));
}
ix.fpos = start;
ix.type = mb_geometry[t];
ix.maxzoom = z;
fwrite_check(&ix, sizeof(struct index), 1, indexfile, fname, jp);
}

View File

@ -376,10 +376,7 @@ long long write_tile(struct index *start, struct index *end, char *metabase, uns
}
dup.insert(std::pair<long long, int>(i->fpos, 1));
int t;
char *meta = metabase + i->fpos;
deserialize_int(&meta, &t);
int t = i->type;
if (t == VT_POINT) {
seq++;
@ -390,6 +387,7 @@ long long write_tile(struct index *start, struct index *end, char *metabase, uns
}
}
char *meta = metabase + i->fpos;
drawvec geom = decode_geometry(&meta, z, tx, ty, line_detail);
bool reduced = false;

3
tile.h
View File

@ -19,8 +19,9 @@ struct pool_val *deserialize_string(char **f, struct pool *p, int type);
struct index {
unsigned long long index;
long long fpos : 56;
long long fpos : 48;
int maxzoom : 8;
int type : 8;
};
long long write_tile(struct index *start, struct index *end, char *metabase, unsigned *file_bbox, int z, unsigned x, unsigned y, int detail, int basezoom, struct pool *file_keys, char *layername, sqlite3 *outdb, double droprate, int buffer);