Hello,
We have a problem with Geoserver 2.1.2 REST and SLD.
I have used the default styles from Geoserver (nothing changed). When I request the SLD through REST (/geoserver/rest/styles/…) we get a different SLD. For example:
This is the original from Geoserver
<?xml version="1.0" encoding="iso-8859-1"?>
Default Line
A boring default style
A sample style that just prints out a green line
Rule 1
Green1 Line
A green line with a 2 pixel width
#000000
1
This is after request through REST
<?xml version="1.0" encoding="UTF-8"?>
<sld:StyledLayerDescriptor xmlns=“http://www.opengis.net/sld” xmlns:sld=“http://www.opengis.net/sld” xmlns:ogc=“http://www.opengis.net/ogc” xmlns:gml=“http://www.opengis.net/gml” version=“1.0.0”>
sld:NamedLayer
sld:Nametemp</sld:Name>
sld:UserStyle
sld:Nametemp</sld:Name>
sld:TitleA boring default style</sld:Title>
sld:AbstractA sample style that just prints out a green line</sld:Abstract>
sld:FeatureTypeStyle
sld:Namename</sld:Name>
sld:Rule
sld:NameRule 1</sld:Name>
sld:TitleGreen1 Line</sld:Title>
sld:AbstractA green line with a 2 pixel width</sld:Abstract>
sld:PolygonSymbolizer
sld:Stroke/
</sld:PolygonSymbolizer>
</sld:Rule>
</sld:FeatureTypeStyle>
</sld:UserStyle>
</sld:NamedLayer>
</sld:StyledLayerDescriptor>
As you can see the Stroke is completely empty. Stroke and Stroke-Width aren’t there.
What is going wrong with requesting the SLD through REST?
···
Best regards,
Lucas Heezen
On 10 January 2012 12:43, Lucas Heezen - Covadis <heezen@anonymised.com> wrote:
Hello,
We have a problem with Geoserver 2.1.2 REST and SLD.
I have used the default styles from Geoserver (nothing changed). When I
request the SLD through REST (/geoserver/rest/styles/…) we get a different
SLD. For example:
They are actually the same as strokes default to 1px black lines if
nothing is set in them, Odd that they are formatted differently though
- are there two serialization paths in use here?
Ian
--
Ian Turton
Is this a bug, that REST won't load the complete SLD if the parameters are default values? This isn't easy to use this way in external applications because the sld is incomplete.
Met vriendelijke groet,
Lucas Heezen
Covadis b.v.
t: 026 3616600
Geograaf 12
f: 026 3612317
6921 EW Duiven
e: heezen@...4103...
-----Oorspronkelijk bericht-----
Van: Ian Turton [mailto:ijturton@…84…]
Verzonden: dinsdag 10 januari 2012 14:15
Aan: Lucas Heezen - Covadis
CC: geoserver-users@lists.sourceforge.net
Onderwerp: Re: [Geoserver-users] Geoserver 2.1.2 REST and SLD
On 10 January 2012 12:43, Lucas Heezen - Covadis <heezen@...4103...> wrote:
Hello,
We have a problem with Geoserver 2.1.2 REST and SLD.
I have used the default styles from Geoserver (nothing changed). When
I request the SLD through REST (/geoserver/rest/styles/…) we get a
different SLD. For example:
They are actually the same as strokes default to 1px black lines if nothing is set in them, Odd that they are formatted differently though
- are there two serialization paths in use here?
Ian
--
Ian Turton
Lucas wrote:
> We have a problem with Geoserver 2.1.2 REST and SLD.
>
> I have used the default styles from Geoserver (nothing changed). When
I
> request the SLD through REST (/geoserver/rest/styles/…) we get a
different
> SLD. For example:
>
Ian wrote:
They are actually the same as strokes default to 1px black lines if
nothing is set in them, Odd that they are formatted differently though
- are there two serialization paths in use here?
Correct, when using non-default values, REST will return the correct SLD (or at least, the values saved) but with a default value used, it will return the value as "none" or in XML terms, as node without value or children.
Best regards,
Martijn Coenen
On Tue, Jan 10, 2012 at 2:26 PM, Martijn Coenen <Martijn@anonymised.com…> wrote:
Lucas wrote:
We have a problem with Geoserver 2.1.2 REST and SLD.
I have used the default styles from Geoserver (nothing changed). When
I
request the SLD through REST (/geoserver/rest/styles/…) we get a
different
SLD. For example:
Ian wrote:
They are actually the same as strokes default to 1px black lines if
nothing is set in them, Odd that they are formatted differently though
- are there two serialization paths in use here?
Correct, when using non-default values, REST will return the correct SLD (or at least, the values saved) but with a default value used, it will return the value as “none” or in XML terms, as node without value or children.
The SLD is rewritten to reformat it, in the process all default values are “stripped”. Actually not
stripped, it’s just that to reformat it the SLD is parsed in its memory representation, and the
writer won’t ever write out the default values.
I don’t think skipping the reformat is possible with the current code
Cheers
Andrea
–
Ing. Andrea Aime
GeoSolutions S.A.S.
Tech lead
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 962313
mob: +39 339 8844549
http://www.geo-solutions.it
http://geo-solutions.blogspot.com/
http://www.youtube.com/user/GeoSolutionsIT
http://www.linkedin.com/in/andreaaime
http://twitter.com/geowolf
Thank you, now we know what to do.
···
Met vriendelijke groet,
Lucas Heezen
Covadis b.v.
t: 026 3616600
Geograaf 12
f: 026 3612317
6921 EW Duiven
e: heezen@anonymised.com
Van: Andrea Aime [mailto:andrea.aime@anonymised.com]
Verzonden: dinsdag 10 januari 2012 14:56
Aan: Martijn Coenen
CC: geoserver-users@lists.sourceforge.net
Onderwerp: Re: [Geoserver-users] Geoserver 2.1.2 REST and SLD
On Tue, Jan 10, 2012 at 2:26 PM, Martijn Coenen <Martijn@anonymised.com> wrote:
Lucas wrote:
We have a problem with Geoserver 2.1.2 REST and SLD.
I have used the default styles from Geoserver (nothing changed). When
I
request the SLD through REST (/geoserver/rest/styles/…) we get a
different
SLD. For example:
Ian wrote:
They are actually the same as strokes default to 1px black lines if
nothing is set in them, Odd that they are formatted differently though
- are there two serialization paths in use here?
Correct, when using non-default values, REST will return the correct SLD (or at least, the values saved) but with a default value used, it will return the value as “none” or in XML terms, as node without value or children.
The SLD is rewritten to reformat it, in the process all default values are “stripped”. Actually not
stripped, it’s just that to reformat it the SLD is parsed in its memory representation, and the
writer won’t ever write out the default values.
I don’t think skipping the reformat is possible with the current code
Cheers
Andrea
–
Ing. Andrea Aime
GeoSolutions S.A.S.
Tech lead
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 962313
mob: +39 339 8844549
http://www.geo-solutions.it
http://geo-solutions.blogspot.com/
http://www.youtube.com/user/GeoSolutionsIT
http://www.linkedin.com/in/andreaaime
http://twitter.com/geowolf