|
mod_tile 0.9.1
Renders map tiles with Mapnik and serves them using Apache HTTP Server
|
#include <algorithm>#include <cctype>#include <cstring>#include <glib.h>#include <mapnik/datasource.hpp>#include <mapnik/datasource_cache.hpp>#include <mapnik/layer.hpp>#include <mapnik/map.hpp>#include <mapnik/params.hpp>#include <mapnik/version.hpp>#include <sstream>#include <string>#include <unordered_map>#include <boost/optional.hpp>#include "g_logger.h"#include "parameterize_style.hpp"Functions | |
| static bool | is_valid_osm_lang_tag (const std::string &tok) |
| Validate that a language token is a safe OpenStreetMap name:* tag suffix. | |
| static void | parameterize_map_language (mapnik::Map &m, char *parameter) |
| Rewrite Mapnik layer SQL queries to localize name columns using a fallback chain of language tags. | |
| static void | parameterize_map_toggle_layer (mapnik::Map &m, char *parameter) |
| Enable or disable individual Mapnik layers by name based on a comma-separated directive list. | |
| parameterize_function_ptr | init_parameterization_function (const char *function_name) |
| Look up the Mapnik style parameterization callback corresponding to a configuration name. | |
| parameterize_function_ptr init_parameterization_function | ( | const char * | function_name | ) |
Look up the Mapnik style parameterization callback corresponding to a configuration name.
Currently supports "language" (parameterize_map_language) and "toggle_layer" (parameterize_map_toggle_layer).
| function_name | Name of the parameterization function from renderd.conf (may be NULL or empty). |
|
static |
Validate that a language token is a safe OpenStreetMap name:* tag suffix.
Accepts the "_" default fallback as well as non-empty alphanumeric, underscore, or hyphen strings up to 32 characters (covering ISO 639 codes and IETF BCP 47 subtags) to prevent SQL injection into PostGIS tags->'name:...' expressions.
| tok | Candidate language token extracted from the comma-separated parameter string. |
|
static |
Rewrite Mapnik layer SQL queries to localize name columns using a fallback chain of language tags.
Parses a comma-separated list of language codes (capped at 256 bytes, e.g., "de,en,_"), validates each token via is_valid_osm_lang_tag(), builds a SQL , coalesce(tags->'name:de',tags->'name:en',name) as name projection, and replaces the first ,name occurrence in each datasource's "table" parameter.
| m | Mapnik Map instance whose layer datasources are updated in place. |
| parameter | Null-terminated comma-separated language fallback list (no-op if NULL, empty, over 256 bytes, or containing no valid tokens). |
|
static |
Enable or disable individual Mapnik layers by name based on a comma-separated directive list.
Parses comma-separated layer tokens (capped at 1024 bytes): a leading '+' enables the named layer, a leading '-' disables it, and an unprefixed name defaults to disabling it. Later tokens for the same layer name override earlier ones.
| m | Mapnik Map instance whose layers are toggled in place. |
| parameter | Null-terminated comma-separated list of layer directives (e.g., "+roads,-buildings,labels"). |