[Qgis-developer] SLD export not compliant due to unit attribute in the root element
Alessandro Pasotti
apasotti at gmail.com
Mon Jul 25 00:12:45 PDT 2016
On Sat, Jul 23, 2016 at 2:53 PM, Andrea Aime <andrea.aime at geo-solutions.it>
wrote:
> Hi,
> I'm looking into improving the SLD export, and stumbled into a schema
> violation
> that, if fixed, may cause other regression.
> In particular, the root element StyledLayerDescriptor contains a "units"
> attribute that
> is not part of the SLD/SE specification, and thus makes validation fail:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <StyledLayerDescriptor xmlns="http://www.opengis.net/sld" xmlns:ogc="
> http://www.opengis.net/ogc" xmlns:xsi="
> http://www.w3.org/2001/XMLSchema-instance" version="1.1.0" xmlns:xlink="
> http://www.w3.org/1999/xlink" *units="mm" *xsi:schemaLocation="
> http://www.opengis.net/sld
> http://schemas.opengis.net/sld/1.1.0/StyledLayerDescriptor.xsd" xmlns:se="
> http://www.opengis.net/se">
> ...
> </StyledLayerDescriptor>
>
> It's in particular the units="mm" element. Checking the git history I
> found it has been introduced by this commit:
>
> ---------------------
>
> b54b159 - rldhont <rldhont at gmail.com> 23-ott-2015
> [BUGFIX] Set default units to mm in exportSld
>
> The default units in QgsMapRenderer is Millimeters. The default units in
> SLD
> is Pixel but exportSld does not convert all millimeters in pixels.
>
> We notes this bug by comparing default QGS Server rendering and rendering
> with
> the SLD generated by QGIS.
>
> To resolve it, we just have to add units to the document element.
>
> ---------------------
>
> The above comments seems to suggest something is actually using that
> attribute, but I'm not sure what.
>
> Mind, GeoServer can parse the file the same, but if users try to validate
> it (there is a validation button in the style editor), they will get the
> following error:
>
> "ine 2: cvc-complex-type.3.2.2: Attribute 'units' is not allowed to appear
> in element 'StyledLayerDescriptor'."
>
> Also, the attribute per se does nothing in a compliant client, since SLD
> 1.1 lacks the very concept of "on screen unit", the uom allowed
> are pixel (on screen), meter (on ground), feet (on ground).
> A SLD export trying to be compliant should convert mm to pixels assuming
> some DPI conversion factor (which means,
> making many changes around... bummer). I see there is already a uomScale
> in the conversion properties, but I see it's not
> used for point symbol sizes (as the commit message says.. I actually don't
> see it being used anywhere).
>
> Would it be ok to remove that attribute and use uomScale to properly adapt
> sizes from mm to px instead?
>
> Cheers
> Andrea
>
> --
> ==
> GeoServer Professional Services from the experts! Visit
> http://goo.gl/it488V for more information.
> ==
>
> Ing. Andrea Aime
> @geowolf
> Technical Lead
>
> GeoSolutions S.A.S.
> Via di Montramito 3/A
> 55054 Massarosa (LU)
> phone: +39 0584 962313
> fax: +39 0584 1660272
> mob: +39 339 8844549
>
> http://www.geo-solutions.it
> http://twitter.com/geosolutions_it
>
>
Hi,
I noticed the same 'uom' mm problem when I tested the SLD converting
routines used by GeoServer Explorer plugin a couple of months ago, thank
for bringing up this issue.
Your proposed solution makes perfectly sense to me.
Did you check if is there already an issue on hub.qgis.org?
--
Alessandro Pasotti
w3: www.itopen.it
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20160725/e57fcab2/attachment.html>
More information about the Qgis-developer
mailing list