plepe / pgmapcss

PGMapCSS is a library for PostgreSQL/PostGIS which works between an osm2pgsql based database and Mapnik (and maybe other renderers). It processes database (usually OpenStreetMap) objects according to MapCSS rules and calculates resulting colors, widths and other properties for Symbolizers, even geometric modifications.
GNU Affero General Public License v3.0
35 stars 8 forks source link

(Global) variables #104

Open plepe opened 9 years ago

plepe commented 9 years ago

It would be great if it would be possible to use (global) variables. Similar to less these could be prefixed by '@'. So that a variable gets global, it should first be used in global space. Example (similar to #77, but rather extending it):

/* initialize variable @list with an empty list, making it global */
@list: list();

/* process all peaks ordered by elevation downward */
node[natural=peak]:order-numerical-desc(ele) {
  /* to @list append the name of the current map feature */
  @list: append(@list, tag("name"));
}

/* print current @list to stderr, which should be the names of all peaks 
 * in current bounding box, ordered by elevation downward */
debug(@list);

The following things need to be implemented:

How to do?