mod_tile 0.9.1
Renders map tiles with Mapnik and serves them using Apache HTTP Server
Loading...
Searching...
No Matches
render_old.c File Reference
#include <dirent.h>
#include <errno.h>
#include <getopt.h>
#include <glib.h>
#include <limits.h>
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <time.h>
#include <unistd.h>
#include "config.h"
#include "g_logger.h"
#include "protocol.h"
#include "render_config.h"
#include "render_submit_queue.h"
#include "renderd_config.h"
#include "store_file_utils.h"

Functions

static void descend (const char *tile_dir, const char *search, int verbose)
 Recursively traverse a tile cache directory tree and enqueue outdated .meta metatiles.
void render_layer (const char *tile_dir, const char *mapname, int min_zoom, int max_zoom, int verbose)
 Scan and re-render outdated metatiles for a single map style across a zoom range.
int main (int argc, char **argv)
 Entry point for the render_old stale-metatile re-rendering CLI utility.

Variables

static int num_render = 0
 Total count of outdated .meta metatiles enqueued for re-rendering (num_render) and scanned (num_all).
static int num_all = 0
static time_t planet_timestamp = 0
 Cutoff UNIX timestamp (planet-import-complete mtime or --timestamp override); older metatiles are re-rendered.
static struct timeval start end
 Wall-clock timestamps marking the start and end of the tile scan and submission run.

Function Documentation

◆ descend()

void descend ( const char * tile_dir,
const char * search,
int verbose )
static

Recursively traverse a tile cache directory tree and enqueue outdated .meta metatiles.

Walks subdirectories under search, throttles via check_load(), inspects the st_mtime of each .meta file against planet_timestamp, decodes its coordinates via path_to_xyz(), and submits stale metatiles to renderd via enqueue().

Parameters
tile_dirRoot tile cache directory path used to strip the prefix in path_to_xyz().
searchCurrent directory path being traversed.
verboseNon-zero to log directory open errors and progress messages.

◆ main()

int main ( int argc,
char ** argv )

Entry point for the render_old stale-metatile re-rendering CLI utility.

Parses command-line options (-c/--config, -m/--map, -l/--max-load, -Z/--max-zoom, -z/--min-zoom, -n/--num-threads, -s/--socket, -t/--tile-dir, -T/--timestamp, -v/--verbose, -h/--help, -V/--version), loads renderd INI configuration, determines the planet import cutoff timestamp via --timestamp or get_planet_time(), spawns worker threads, scans all configured map layers (or the single --map style) via render_layer(), and prints throughput statistics upon completion.

Parameters
argcCommand-line argument count.
argvCommand-line argument vector.
Returns
0 on completion, or 1 on invalid CLI options, missing config/map, or bad timestamp.

◆ render_layer()

void render_layer ( const char * tile_dir,
const char * mapname,
int min_zoom,
int max_zoom,
int verbose )

Scan and re-render outdated metatiles for a single map style across a zoom range.

Iterates from min_zoom through max_zoom inclusive, constructing <tile_dir>/<mapname>/<z> for each zoom level and invoking descend() to find stale .meta files.

Parameters
tile_dirRoot tile cache directory path.
mapnameConfigured map style name (xmlname).
min_zoomLowest zoom level to scan (inclusive).
max_zoomHighest zoom level to scan (inclusive).
verboseNon-zero to log each zoom level as it is scanned.

Variable Documentation

◆ end

struct timeval start end
static

Wall-clock timestamps marking the start and end of the tile scan and submission run.

◆ num_all

int num_all = 0
static

◆ num_render

int num_render = 0
static

Total count of outdated .meta metatiles enqueued for re-rendering (num_render) and scanned (num_all).

◆ planet_timestamp

time_t planet_timestamp = 0
static

Cutoff UNIX timestamp (planet-import-complete mtime or --timestamp override); older metatiles are re-rendered.