[Mapcss] Associating overpass result sets with MapCSS, was: Re: Example for "set"
Richard Fairhurst
richard at systemeD.net
Fri May 12 20:26:10 UTC 2017
On 12/05/2017 21:00, tom.davie at gmail.com wrote:
> In general, this feature causes problems for implement its. It stops
> MapCSS being a declarative language, and makes it procedural instead.
> That closes off a bunch of avenues for implementing the language in a
> way that works fast enough for real time applications.
>
> There's a reason that css doesn't have this feature.
There's also a reason why MapCSS does have this feature, though whether
you agree with that reasoning is your call!
The original reason was to fulfil a significant use case which the
emerging Mapnik rendering setup (i.e. .mml + Carto(CSS)) could cope
with, but purely declarative CSS couldn't - i.e. remapping tags.
It's fairly common for an .mml file to contain procedural logic
implemented in SQL, and a lot of the time that's a very sensible way to
cope with the exigencies of OSM tagging. That isn't an option when
you're applying MapCSS directly to an OSM dataset. So that's why the
'set' directive and 'eval' function exist - as a replacement for
rationalising tags with SQL.
OSM data pipelines have moved in interesting directions since then, not
least the increasing use of scripting (in particular Lua) to preprocess
data in osm2pgsql, OSRM and tilemaker. In many situations, scripting on
database load has replaced the need to remap tags on render. Certainly
neither the routing nor cartography I use on cycle.travel would be
achievable without Lua scripting.
In this light, it would seem sensible to encourage as MapCSS good
practice: make your set and eval instructions isolable.
In other words, design your stylesheet such that clients can run these
instructions when loading the data into the datastore, and that the
renderer can be purely declarative.
I don't know whether any real-world clients exist, or might exist, where
this would be relevant. But MapCSS does appear to have settled into
quite a significant niche, so it's certainly worth discussing.
cheers
Richard
P.S. hello Tom, long time no see!
More information about the Mapcss
mailing list