Skip to content

Commit ff9a2c4

Browse files
committed
Removed non-METATILE code as it no longer seems to work
Remove unused reference to METATILEFALLBACK Rewrote `meta tile`/`meta-tile` to `metatile`
1 parent c7ffa83 commit ff9a2c4

14 files changed

+26
-149
lines changed

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ Apache file serving mechanisms to provide:
214214
5) Tile expiry. It estimates when the tile is next likely to be rendered and adds the appropriate HTTP cache expiry headers. This is a configurable heuristic.
215215

216216
To avoid problems with directories becoming too large and to avoid
217-
too many tiny files. They store the rendered tiles in "meta tiles" in a
217+
too many tiny files. They store the rendered tiles in "metatiles" in a
218218
special hashed directory structure. These combine 8x8 actual tiles into a
219219
single metatile file. This is a more efficient use of disk space and inodes.
220220

includes/render_config.h

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -102,28 +102,15 @@
102102
// default for number of rendering threads
103103
#define NUM_THREADS (4)
104104

105-
// Use this to enable meta-tiles which will render NxN tiles at once
105+
// Metatiles will render NxN tiles at once
106106
// Note: This should be a power of 2 (2, 4, 8, 16 ...)
107107
#define METATILE (8)
108-
//#undef METATILE
109-
110-
//Fallback to standard tiles if meta tile doesn't exist
111-
//Legacy - not needed on new installs
112-
//#undef METATILEFALLBACK
113108

114109
// Metatiles are much larger in size so we don't need big queues to handle large areas
115-
#ifdef METATILE
116110
#define QUEUE_MAX (64)
117111
#define REQ_LIMIT (256)
118112
#define DIRTY_LIMIT (8000)
119113

120-
#else
121-
#define QUEUE_MAX (1024)
122-
#define REQ_LIMIT (512)
123-
#define DIRTY_LIMIT (10000)
124-
#define HASHIDX_SIZE 22123
125-
#endif
126-
127114
// Penalty for client making an invalid request (in seconds)
128115
#define CLIENT_PENALTY (3)
129116

includes/store_file_utils.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,15 @@ extern "C" {
3333
int mkdirp(const char *path);
3434

3535
/* File path hashing. Used by both mod_tile and render daemon
36-
* The two must both agree on the file layout for meta-tiling
36+
* The two must both agree on the file layout for metatiling
3737
* to work
3838
*/
3939
void xyz_to_path(char *path, size_t len, const char *tile_dir, const char *xmlconfig, int x, int y, int z);
4040

4141
int path_to_xyz(const char *tilepath, const char *path, char *xmlconfig, int *px, int *py, int *pz);
4242

43-
#ifdef METATILE
44-
/* New meta-tile storage functions */
45-
/* Returns the path to the meta-tile and the offset within the meta-tile */
43+
/* Returns the path to the metatile and the offset within the metatile */
4644
int xyz_to_meta(char *path, size_t len, const char *tile_dir, const char *xmlconfig, int x, int y, int z);
47-
#endif
4845

4946
#ifdef __cplusplus
5047
}

src/gen_tile.cpp

Lines changed: 1 addition & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,7 @@ using namespace mapnik;
7272
#define RAD_TO_DEG (180/M_PI)
7373
#endif
7474

75-
#ifdef METATILE
7675
#define RENDER_SIZE (256 * (METATILE + 1))
77-
#else
78-
#define RENDER_SIZE (512)
79-
#endif
8076

8177
extern int foreground;
8278

@@ -245,7 +241,6 @@ static int check_xyz(int x, int y, int z, struct xmlmapconfig * map)
245241
return !oob;
246242
}
247243

248-
#ifdef METATILE
249244
mapnik::box2d<double> tile2prjbounds(struct projectionconfig * prj, int x, int y, int z)
250245
{
251246

@@ -299,7 +294,7 @@ static enum protoCmd render(struct xmlmapconfig * map, int x, int y, int z, char
299294
return cmdNotDone;
300295
}
301296

302-
// Split the meta tile into an NxN grid of tiles
297+
// Split the metatile into an NxN grid of tiles
303298
unsigned int xx, yy;
304299

305300
for (yy = 0; yy < render_size_ty; yy++) {
@@ -312,52 +307,6 @@ static enum protoCmd render(struct xmlmapconfig * map, int x, int y, int z, char
312307

313308
return cmdDone; // OK
314309
}
315-
#else //METATILE
316-
static enum protoCmd render(Map &m, const char *tile_dir, char *xmlname, projection &prj, int x, int y, int z, char* outputFormat)
317-
{
318-
char filename[PATH_MAX];
319-
char tmp[PATH_MAX];
320-
double p0x = x * 256.0;
321-
double p0y = (y + 1) * 256.0;
322-
double p1x = (x + 1) * 256.0;
323-
double p1y = y * 256.0;
324-
325-
tiling.fromPixelToLL(p0x, p0y, z);
326-
tiling.fromPixelToLL(p1x, p1y, z);
327-
328-
prj.forward(p0x, p0y);
329-
prj.forward(p1x, p1y);
330-
331-
mapnik::box2d<double> bbox(p0x, p0y, p1x, p1y);
332-
bbox.width(bbox.width() * 2);
333-
bbox.height(bbox.height() * 2);
334-
m.zoomToBox(bbox);
335-
336-
mapnik::image_32 buf(RENDER_SIZE, RENDER_SIZE);
337-
mapnik::agg_renderer<mapnik::image_32> ren(m, buf);
338-
ren.apply();
339-
340-
xyz_to_path(filename, sizeof(filename), tile_dir, xmlname, x, y, z);
341-
342-
if (mkdirp(filename)) {
343-
return cmdNotDone;
344-
}
345-
346-
snprintf(tmp, sizeof(tmp), "%s.tmp", filename);
347-
348-
mapnik::image_view<mapnik::image_data_32> vw(128, 128, 256, 256, buf.data());
349-
g_logger(G_LOG_LEVEL_DEBUG, "Render %i %i %i %s", z, x, y, filename)
350-
mapnik::save_to_file(vw, tmp, outputFormat);
351-
352-
if (rename(tmp, filename)) {
353-
perror(tmp);
354-
return cmdNotDone;
355-
}
356-
357-
return cmdDone; // OK
358-
}
359-
#endif //METATILE
360-
361310

362311
void render_init(const char *plugins_dir, const char* font_dir, int font_dir_recurse)
363312
{
@@ -449,7 +398,6 @@ void *render_thread(void * arg)
449398

450399
if (item) {
451400
struct protocol *req = &item->req;
452-
#ifdef METATILE
453401
// At very low zoom the whole world may be smaller than METATILE
454402
unsigned int size = MIN(METATILE, 1 << req->z);
455403

@@ -501,13 +449,6 @@ void *render_thread(void * arg)
501449
request_exit();
502450
}
503451
}
504-
505-
#else //METATILE
506-
ret = render(maps[i].map, maps[i].tile_dir, req->xmlname, maps[i].prj, req->x, req->y, req->z, maps[i].output_format);
507-
#ifdef HTCP_EXPIRE_CACHE
508-
cache_expire(maps[i].htcpsock, maps[i].host, maps[i].xmluri, req->x, req->y, req->z);
509-
#endif
510-
#endif //METATILE
511452
} else {
512453
g_logger(G_LOG_LEVEL_WARNING, "Received request for map layer %s is outside of acceptable bounds z(%i), x(%i), y(%i)",
513454
req->xmlname, req->z, req->x, req->y);

src/metatile.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ const std::string metaTile::get(int x, int y)
5353
return tile[x][y];
5454
}
5555

56-
// Returns the offset within the meta-tile index table
56+
// Returns the offset within the metatile index table
5757
int metaTile::xyz_to_meta_offset(int x, int y, int z)
5858
{
5959
unsigned char mask = METATILE - 1;

src/render_expired.c

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ const char * tile_dir_default = RENDERD_TILE_DIR;
4343

4444
// macros handling our tile marking arrays (these are essentially bit arrays
4545
// that have one bit for each tile on the repsective zoom level; since we only
46-
// need them for meta tile levels, even if someone were to render level 20,
46+
// need them for metatile levels, even if someone were to render level 20,
4747
// we'd still only use 4^17 bits = 2 GB RAM (plus a little for the lower zoom
4848
// levels) - this saves us the hassle of working with a tree structure.
4949

@@ -52,16 +52,6 @@ const char * tile_dir_default = RENDERD_TILE_DIR;
5252
#define SET_TILE_REQUESTED(z,x,y) \
5353
tile_requested[z][((x)*twopow[z]+(y))/(8*sizeof(int))] |= (0x01 << (((x)*twopow[z]+(y))%(8*sizeof(int))));
5454

55-
56-
#ifndef METATILE
57-
#warning("render_expired not implemented for non-metatile mode. Feel free to submit fix")
58-
int main(int argc, char **argv)
59-
{
60-
fprintf(stderr, "render_expired not implemented for non-metatile mode. Feel free to submit fix!\n");
61-
return -1;
62-
}
63-
#else
64-
6555
// tile marking arrays
6656
unsigned int **tile_requested;
6757

@@ -112,7 +102,7 @@ int main(int argc, char **argv)
112102
char name[PATH_MAX];
113103

114104
// excess_zoomlevels is how many zoom levels at the large end
115-
// we can ignore because their tiles will share one meta tile.
105+
// we can ignore because their tiles will share one metatile.
116106
// with the default METATILE==8 this is 3.
117107
int excess_zoomlevels = 0;
118108
int mt = METATILE;
@@ -399,7 +389,7 @@ int main(int argc, char **argv)
399389
{
400390
gettimeofday(&end, NULL);
401391
printf("\n");
402-
printf("Meta tiles rendered: ");
392+
printf("Metatiles rendered: ");
403393
display_rate(start, end, num_render);
404394
printf("Total tiles rendered: ");
405395
display_rate(start, end, num_render * METATILE * METATILE);
@@ -443,16 +433,15 @@ int main(int argc, char **argv)
443433

444434
gettimeofday(&end, NULL);
445435
printf("\nTotal for all tiles rendered\n");
446-
printf("Meta tiles rendered: ");
436+
printf("Metatiles rendered: ");
447437
display_rate(start, end, num_render);
448438
printf("Total tiles rendered: ");
449439
display_rate(start, end, num_render * METATILE * METATILE);
450440
printf("Total tiles in input: %d\n", num_read);
451441
printf("Total tiles expanded from input: %d\n", num_all);
452-
printf("Total meta tiles deleted: %d\n", num_unlink);
453-
printf("Total meta tiles touched: %d\n", num_touch);
442+
printf("Total metatiles deleted: %d\n", num_unlink);
443+
printf("Total metatiles touched: %d\n", num_touch);
454444
printf("Total tiles ignored (not on disk): %d\n", num_ignore);
455445

456446
return 0;
457447
}
458-
#endif

src/render_list.c

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,6 @@
4444

4545
const char * tile_dir_default = RENDERD_TILE_DIR;
4646

47-
#ifndef METATILE
48-
#warning("render_list not implemented for non-metatile mode. Feel free to submit fix")
49-
int main(int argc, char **argv)
50-
{
51-
fprintf(stderr, "render_list not implemented for non-metatile mode. Feel free to submit fix!\n");
52-
return -1;
53-
}
54-
#else
55-
5647
static int minZoom = 0;
5748
static int maxZoom = MAX_ZOOM;
5849
static int verbose = 0;
@@ -364,7 +355,7 @@ int main(int argc, char **argv)
364355
if (!(num_render % 10)) {
365356
gettimeofday(&end, NULL);
366357
printf("\n");
367-
printf("Meta tiles rendered: ");
358+
printf("Metatiles rendered: ");
368359
display_rate(start, end, num_render);
369360
printf("Total tiles rendered: ");
370361
display_rate(start, end, (num_render) * METATILE * METATILE);
@@ -398,7 +389,7 @@ int main(int argc, char **argv)
398389
printf("\n*****************************************************\n");
399390
printf("*****************************************************\n");
400391
printf("Total for all tiles rendered\n");
401-
printf("Meta tiles rendered: ");
392+
printf("Metatiles rendered: ");
402393
display_rate(start, end, num_render);
403394
printf("Total tiles rendered: ");
404395
display_rate(start, end, num_render * METATILE * METATILE);
@@ -408,4 +399,3 @@ int main(int argc, char **argv)
408399

409400
return 0;
410401
}
411-
#endif

src/render_old.c

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,6 @@
4646

4747
const char * tile_dir_default = RENDERD_TILE_DIR;
4848

49-
#ifndef METATILE
50-
#warning("render_old not implemented for non-metatile mode. Feel free to submit fix")
51-
int main(int argc, char **argv)
52-
{
53-
fprintf(stderr, "render_old not implemented for non-metatile mode. Feel free to submit fix!\n");
54-
return -1;
55-
}
56-
#else
57-
5849
#define INILINE_MAX 256
5950
static int minZoom = 0;
6051
static int maxZoom = MAX_ZOOM;
@@ -400,7 +391,7 @@ int main(int argc, char **argv)
400391

401392
gettimeofday(&end, NULL);
402393
printf("\nTotal for all tiles rendered\n");
403-
printf("Meta tiles rendered: ");
394+
printf("Metatiles rendered: ");
404395
display_rate(start, end, num_render);
405396
printf("Total tiles rendered: ");
406397
display_rate(start, end, num_render * METATILE * METATILE);
@@ -409,4 +400,3 @@ int main(int argc, char **argv)
409400

410401
return 0;
411402
}
412-
#endif

src/render_speedtest.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,6 @@
4141
#define DEG_TO_RAD (M_PI/180)
4242
#define RAD_TO_DEG (180/M_PI)
4343

44-
#ifndef METATILE
45-
#warning("Speed test not implemented for non-metatile mode. Feel free to submit fix")
46-
int main(int argc, char **argv)
47-
{
48-
fprintf(stderr, "Speed test not implemented for non-metatile mode. Feel free to submit fix!\n");
49-
return -1;
50-
}
51-
#else
52-
5344
#if 1
5445
static double boundx0 = -0.5;
5546
static double boundy0 = 51.25;
@@ -295,4 +286,3 @@ int main(int argc, char **argv)
295286

296287
return ret;
297288
}
298-
#endif

src/renderd.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -168,17 +168,12 @@ enum protoCmd rx_request(struct protocol *req, int fd)
168168
item->duplicates = NULL;
169169
item->fd = (req->cmd == cmdDirty) ? FD_INVALID : fd;
170170

171-
#ifdef METATILE
172171
/* Round down request co-ordinates to the neareast N (should be a power of 2)
173172
* Note: request path is no longer consistent but this will be recalculated
174173
* when the metatile is being rendered.
175174
*/
176175
item->mx = item->req.x & ~(METATILE - 1);
177176
item->my = item->req.y & ~(METATILE - 1);
178-
#else
179-
item->mx = item->req.x;
180-
item->my = item->req.y;
181-
#endif
182177

183178
return request_queue_add_request(render_request_queue, item);
184179
}

0 commit comments

Comments
 (0)