source: subversion/applications/utils/mod_tile/store.h @ 29283

Last change on this file since 29283 was 28906, checked in by apmon, 7 years ago

[mod_tile] support storage of gzip compressed content in metatiles

In some cases (e.g. geojson vector tiles) storing the content of metatiles in compressed form can be benefitial.
In this case, make sure that the Content-Encoding header is set to gzip, so that clients can correctly
decode the data.

Wether data in a metatile is stored in compressed form or not is defined by the first 4 magic bytes, which are either
META for uncompressed data or METZ for compressed date.

Currently mod_tile does not yet support decompressing the data it self. So if a client doesn't send the
Accept-Encoding: gzip header, they will get jumbled (still compressed) content back.

File size: 1.3 KB
Line 
1#ifndef STORE_H
2#define STORE_H
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8#include <stdlib.h>
9#include "render_config.h"
10    int tile_read(const char *tilepath, const char *xmlconfig, int x, int y, int z, unsigned char *buf, int sz, int * compressed, unsigned char * err_msg);
11
12#define META_MAGIC "META"
13#define META_MAGIC_COMPRESSED "METZ"
14//static const char meta_magic[4] = { 'M', 'E', 'T', 'A' };
15
16struct entry {
17    int offset;
18    int size;
19};
20
21struct meta_layout {
22    char magic[4];
23    int count; // METATILE ^ 2
24    int x, y, z; // lowest x,y of this metatile, plus z
25    struct entry index[]; // count entries
26    // Followed by the tile data
27    // The index offsets are measured from the start of the file
28};
29
30
31int read_from_file(const char *tilepath, const char *xmlconfig, int x, int y, int z, unsigned char *buf, size_t sz);
32
33#ifdef METATILE
34    int read_from_meta(const char *tilepath, const char *xmlconfig, int x, int y, int z, unsigned char *buf, size_t sz, int * compressed, unsigned char * log_msg);
35    void process_meta(const char *tilepath, const char *xmlconfig, int x, int y, int z);
36    void process_pack(const char *tilepath, const char *name);
37    void process_unpack(const char *tilepath, const char *name);
38#endif
39
40#ifdef __cplusplus
41}
42#endif
43#endif
Note: See TracBrowser for help on using the repository browser.