Hi,
the CSS documentation says that it’s possible to specify units along with a measure:
http://docs.geoserver.org/latest/en/user/extensions/css/values.html#numbers
However, in practice the translator ignores them and as a result it’s impossible to create
a CSS style that works in real world units.
I believe the reason for this is that CSS allows for mixing unit of measure in more than one
way, whilst SLD has a fixed and single unit for a given symbolizer… and this makes
a direct translation impossible.
Point in case:
- {
label: [name];
font-size: 50m;
label-offset: 10px 0px;
}
How do you turn the above into a uniform set of units? You can’t, because the translation
between pixels and meters can only be done once the output project and map scale is
determined, so only when GetMap is being executed.
So, it seems the only way forward is to keep the value un-translated until rendering time.
Which I believe is doable by some creative use of filter functions.
First, the current map pixel per meter value can be put into the env function, just like we are already
putting some of the GetMap request attributes. Let’s call it “gt_pixels_per_meter”.
And then we can apply a filter function around each value whose unit is not in pixels, e.g.:
The uom filter function knows internally that it has to go and look for the gt_pixels_per_meter env variable to
perform the translation to pixels for the current request.
This would allow for a translation, and as a side effect, it would make it possible for
SLD users to mix units in their style sheets too.
What do you think?
Cheers
Andrea
–
==
Our support, Your Success! Visit http://opensdi.geo-solutions.it for more information.
Ing. Andrea Aime
@geowolf
Technical Lead
GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549
http://www.geo-solutions.it
http://twitter.com/geosolutions_it