O
2.9-C/3
Smrender
Smrender | |
---|---|
Smrender is a powerful, flexible, and modular rule-based rendering engine for OSM data. It is mainly intended to creater paper charts for print-out but can be used for tile creation and other tasks as well. | |
Contact | [[Project contact::User:Eagle]] |
Weblinks | http://www.abenteuerland.at/smrender/ |
People | Eagle |
Processed by assembly: | Cypherpunk.at |
Other Projects | |
Smrender reads an OSM file and applies a set of rules to this input data to create an output image. The input is an OSM file and a second file containing the rule set. The output (currently) is a PNG image having the desired resolution and density and probably additional output files. The latter is explained later. The primary goal of Smrender is to create a sea chart which is well-suited for print-out on paper. Nevertheless, it is a universal rendering engine and may be used for different tasks. The input file should be an OSM/XML file as defined by the OSM standard. The file is required to be well-formed in that sense because Smrender itself does no XML validation, thus the rendering process might fail if the file is not well-formed. The data should also be complete. This means that it should contain all nodes to which is referred by the ways. Smrender will remove nodes from ways which are missing. The rules are also defined in OSM format (see Section 5). The rules are applied iteratively in a loop depending on their version. Within the loop, Smrender always applies first all relation rules, then way rules, and then all node rules of the same version. All rules of the same version are applied in the order of their id.
Smrender is released under GPLv3.
Workshop Example
#include <stdlib.h> #include <stdio.h> #include "smrender.h" int act_count_ini(smrule_t *r) { int *count; if ((count = malloc(sizeof(int))) == NULL) return -1; *count = 0; r->data = count; return 0; } int act_count_main(smrule_t *r, osm_obj_t *o) { //int *count; (*((int*) r->data))++; //count = r->data; //(*count)++; return 0; } int act_count_fini(smrule_t *r) { char *s; int *count; int i; count = r->data; if ((s = get_param("rulename", NULL, r->act)) == NULL) s = "unknown"; printf("The rule '%s' counts %d objects\n", s, *count); free(r->data); return 0; } int act_osm2string_main(smrule_t *r, osm_obj_t *o) { int i; for (i = 0; i < o->tag_cnt; i++) { printf("%.*s=%.*s,", o->otag[i].k.len, o->otag[i].k.buf, o->otag[i].v.len, o->otag[i].v.buf); } printf("\n"); return 0; }