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

Improvements to the 'highest peaks' example #77

Open plepe opened 10 years ago

plepe commented 10 years ago

The 'highest peaks' example does not scale well with higher distances, resp. more peaks, as more and more distances have to be calculated. A different approach would be to order all peaks in the current view port by elevation descending and then process them one by one:

  1. the highest peak will be shown in any case
  2. the next highest peak only, if none of the already shown peaks is in the given range
  3. continue with 2.

This is currently not possible -> it requires (at least):

How could/should this code look like? Ideas?

plepe commented 10 years ago
node[natural=peak].order-numerical(ele) {
...
}

Possible pseudo classes: .order-numerical(), .order-alphabetical(), .order-natural(). Expression in brackets is either a tag key or an eval expression. An optional second argument could specify order direction, e.g. 'asc' or 'desc'. -> .order-numerical(ele, desc).

plepe commented 9 years ago

Pseudo classes for sure are prepended by ':', so the correct list should be :order-numerical(), :order-alphabetical(), :order-natural().

A third parameter could define the default value (if the first parameter evaluates to none) -> :order-numerical(ele, desc, 0).