[Geoserver-users] error on using svg or png in style

Hi all.
I’ve tried to create a sld style using an external graphic:

se:Rule
se:NameSingle symbol</se:Name>
se:PointSymbolizer
se:Graphic
se:ExternalGraphic
<se:OnlineResource xlink:type=“simple” xlink:href=“file:///var/www/geonode/static/img/ico/poi_tower_communications.svg”/>
se:Formatimage/svg+xml</se:Format>
</se:ExternalGraphic>
se:Size15</se:Size>
</se:Graphic>
</se:PointSymbolizer>
</se:Rule>


and than:

se:Rule
se:NameSingle symbol</se:Name>
se:PointSymbolizer
se:Graphic
se:ExternalGraphic
<se:OnlineResource xlink:type=“simple” xlink:href=“http://geomap.arpa.veneto.it/static/img/ico/antenna-with-signal-transmission.png”/>
se:Formatimage/png</se:Format>
</se:ExternalGraphic>
se:Size15</se:Size>
</se:Graphic>
</se:PointSymbolizer>
</se:Rule>

In both cases, into style editor the preview works fine, but the layer preview of geoserver returns an error:

java.io.IOException: java.lang.RuntimeException: Parsing failed for UserStyle: java.lang.ClassCastException: java.util.HashMap cannot be cast to org.opengis.util.International

Geoserver ver.: 2.7.4 (with Geonode project, ver. 2.4)

It is the first time I try to use external graphics. Any ideas to resolve error?

Thanks

Hi Annalisa,
I’m a little unclear on the question - you’re saying that the SLD works in the legend preview? (which i guess is a form of GetLegendRequest).
But when you try and view it on a map (Layer Preview) you’re getting an exception?

Do you have the rest of the exception? That might help someone on the list determine what’s happening.

Cheers,
Jonathan

---- On Thu, 07 Jul 2016 13:48:29 +0100 Annalisa Schiavon<annalisa.schiavon@anonymised.com…> wrote ----

Hi all.
I’ve tried to create a sld style using an external graphic:

se:Rule
se:NameSingle symbol</se:Name>
se:PointSymbolizer
se:Graphic
se:ExternalGraphic
<se:OnlineResource xlink:type=“simple” xlink:href=“file:///var/www/geonode/static/img/ico/poi_tower_communications.svg”/>
se:Formatimage/svg+xml</se:Format>
</se:ExternalGraphic>
se:Size15</se:Size>
</se:Graphic>
</se:PointSymbolizer>
</se:Rule>


and than:

se:Rule
se:NameSingle symbol</se:Name>
se:PointSymbolizer
se:Graphic
se:ExternalGraphic
<se:OnlineResource xlink:type=“simple” xlink:href=“http://geomap.arpa.veneto.it/static/img/ico/antenna-with-signal-transmission.png”/>
se:Formatimage/png</se:Format>
</se:ExternalGraphic>
se:Size15</se:Size>
</se:Graphic>
</se:PointSymbolizer>
</se:Rule>

In both cases, into style editor the preview works fine, but the layer preview of geoserver returns an error:

java.io.IOException: java.lang.RuntimeException: Parsing failed for UserStyle: java.lang.ClassCastException: java.util.HashMap cannot be cast to org.opengis.util.International

Geoserver ver.: 2.7.4 (with Geonode project, ver. 2.4)

It is the first time I try to use external graphics. Any ideas to resolve error?

Thanks


Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape_______________________________________________
Geoserver-users mailing list
Geoserver-users@anonymised.comge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Ciao Annalisa,
the exception is not familiar to me, could you check the GeoServer logs and find the full
stack trace for that issue?

Hi all.
I’ve tried to create a sld style using an external graphic:

se:Rule
se:NameSingle symbol</se:Name>
se:PointSymbolizer
se:Graphic
se:ExternalGraphic
<se:OnlineResource xlink:type=“simple” xlink:href=“file:///var/www/geonode/static/img/ico/poi_tower_communications.svg”/>
se:Formatimage/svg+xml</se:Format>
</se:ExternalGraphic>
se:Size15</se:Size>
</se:Graphic>
</se:PointSymbolizer>
</se:Rule>


and than:

se:Rule
se:NameSingle symbol</se:Name>
se:PointSymbolizer
se:Graphic
se:ExternalGraphic
<se:OnlineResource xlink:type=“simple” xlink:href=“http://geomap.arpa.veneto.it/static/img/ico/antenna-with-signal-transmission.png”/>
se:Formatimage/png</se:Format>
</se:ExternalGraphic>
se:Size15</se:Size>
</se:Graphic>
</se:PointSymbolizer>
</se:Rule>

In both cases, into style editor the preview works fine, but the layer preview of geoserver returns an error:

java.io.IOException: java.lang.RuntimeException: Parsing failed for UserStyle: java.lang.ClassCastException: java.util.HashMap cannot be cast to org.opengis.util.International

Geoserver ver.: 2.7.4 (with Geonode project, ver. 2.4)

It is the first time I try to use external graphics. Any ideas to resolve error?

Thanks


Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape


Geoserver-users mailing list
Geoserver-users@anonymised.comsts.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Hi all, sorry for the late reply.
I attach the full log after having applied the PNG symbol.
The full sld file is:

Name
srb_nero

<?xml version="1.0" encoding="UTF-8"?> srb_nero srb_nero srb_nero Single symbol image/png 15

On the Style Editor page, with this style select, if I choose “validate” button, it’s ok and if I choose “Preview legend” button, I correctly view the symbol.

Thank you so much

Annalisa

geoserver.log (36.8 KB)

···

2016-07-11 21:15 GMT+02:00 Andrea Aime <andrea.aime@anonymised.com>:

Ciao Annalisa,
the exception is not familiar to me, could you check the GeoServer logs and find the full
stack trace for that issue?

Hi all.
I’ve tried to create a sld style using an external graphic:

se:Rule
se:NameSingle symbol</se:Name>
se:PointSymbolizer
se:Graphic
se:ExternalGraphic
<se:OnlineResource xlink:type=“simple” xlink:href=“file:///var/www/geonode/static/img/ico/poi_tower_communications.svg”/>
se:Formatimage/svg+xml</se:Format>
</se:ExternalGraphic>
se:Size15</se:Size>
</se:Graphic>
</se:PointSymbolizer>
</se:Rule>


and than:

se:Rule
se:NameSingle symbol</se:Name>
se:PointSymbolizer
se:Graphic
se:ExternalGraphic
<se:OnlineResource xlink:type=“simple” xlink:href=“http://geomap.arpa.veneto.it/static/img/ico/antenna-with-signal-transmission.png”/>
se:Formatimage/png</se:Format>
</se:ExternalGraphic>
se:Size15</se:Size>
</se:Graphic>
</se:PointSymbolizer>
</se:Rule>

In both cases, into style editor the preview works fine, but the layer preview of geoserver returns an error:

java.io.IOException: java.lang.RuntimeException: Parsing failed for UserStyle: java.lang.ClassCastException: java.util.HashMap cannot be cast to org.opengis.util.International

Geoserver ver.: 2.7.4 (with Geonode project, ver. 2.4)

It is the first time I try to use external graphics. Any ideas to resolve error?

Thanks


Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape


Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Hi Annalisa,
weird, I’ve tried the style on a 2.9.x (2.7.x is not supported anymore) and I get this validation error:

line 7: cvc-complex-type.2.4.a: Invalid content was found starting with element ‘se:Title’. One of ‘{“http://www.opengis.net/se”:Description, “http://www.opengis.net/sld”:IsDefault, “http://www.opengis.net/se”:FeatureTypeStyle, “http://www.opengis.net/se”:CoverageStyle, “http://www.opengis.net/se”:OnlineResource}’ is expected.

This modified style appears to validate and work instead:

<?xml version="1.0" encoding="UTF-8"?> srb_nero Single symbol image/png 15

See this getmap:

http://demo.geo-solutions.it/geoserver/sf/wms?service=WMS&version=1.1.0&request=GetMap&layers=sf:archsites&styles=srb_nero&bbox=589851.4376666048,4914490.882968263,608346.4603107043,4926501.8980334345&width=768&height=498&srs=EPSG:26713&format=application/openlayers

The original symbol is really large compared to the target one, the scaled down version does not look so good… better use SVGs or a pre-scaled-down symbol that you can use at its native size instead (we could try with a different interpolation, but it’s hard/impossible to make everybody happy, we used to have a different one and people complained the output looked foggy…)… thinking out loud, could be a place for people to add a vendor option to tell us which rescaling algorithm to use.

Cheers
Andrea

···

On Mon, Jul 18, 2016 at 12:46 PM, Annalisa Schiavon <annalisa.schiavon@anonymised.com> wrote:

Hi all, sorry for the late reply.
I attach the full log after having applied the PNG symbol.
The full sld file is:

Name
srb_nero

<?xml version="1.0" encoding="UTF-8"?> srb_nero srb_nero srb_nero

se:Rule
se:NameSingle symbol</se:Name>
se:PointSymbolizer
se:Graphic
se:ExternalGraphic
<se:OnlineResource xlink:type=“simple” xlink:href=“http://geomap.arpa.veneto.it/static/img/ico/antenna-with-signal-transmission.png”/>
se:Formatimage/png</se:Format>
</se:ExternalGraphic>
se:Size15</se:Size>
</se:Graphic>
</se:PointSymbolizer>
</se:Rule>

</se:FeatureTypeStyle>


On the Style Editor page, with this style select, if I choose “validate” button, it’s ok and if I choose “Preview legend” button, I correctly view the symbol.

Thank you so much

Annalisa

2016-07-11 21:15 GMT+02:00 Andrea Aime <andrea.aime@anonymised.com>:

Ciao Annalisa,
the exception is not familiar to me, could you check the GeoServer logs and find the full
stack trace for that issue?

Hi all.
I’ve tried to create a sld style using an external graphic:

se:Rule
se:NameSingle symbol</se:Name>
se:PointSymbolizer
se:Graphic
se:ExternalGraphic
<se:OnlineResource xlink:type=“simple” xlink:href=“file:///var/www/geonode/static/img/ico/poi_tower_communications.svg”/>
se:Formatimage/svg+xml</se:Format>
</se:ExternalGraphic>
se:Size15</se:Size>
</se:Graphic>
</se:PointSymbolizer>
</se:Rule>


and than:

se:Rule
se:NameSingle symbol</se:Name>
se:PointSymbolizer
se:Graphic
se:ExternalGraphic
<se:OnlineResource xlink:type=“simple” xlink:href=“http://geomap.arpa.veneto.it/static/img/ico/antenna-with-signal-transmission.png”/>
se:Formatimage/png</se:Format>
</se:ExternalGraphic>
se:Size15</se:Size>
</se:Graphic>
</se:PointSymbolizer>
</se:Rule>

In both cases, into style editor the preview works fine, but the layer preview of geoserver returns an error:

java.io.IOException: java.lang.RuntimeException: Parsing failed for UserStyle: java.lang.ClassCastException: java.util.HashMap cannot be cast to org.opengis.util.International

Geoserver ver.: 2.7.4 (with Geonode project, ver. 2.4)

It is the first time I try to use external graphics. Any ideas to resolve error?

Thanks


Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape


Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

==
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

AVVERTENZE AI SENSI DEL D.Lgs. 196/2003

Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il loro utilizzo è consentito esclusivamente al destinatario del messaggio, per le finalità indicate nel messaggio stesso. Qualora riceviate questo messaggio senza esserne il destinatario, Vi preghiamo cortesemente di darcene notizia via e-mail e di procedere alla distruzione del messaggio stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso, divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità diverse, costituisce comportamento contrario ai principi dettati dal D.Lgs. 196/2003.

The information in this message and/or attachments, is intended solely for the attention and use of the named addressee(s) and may be confidential or proprietary in nature or covered by the provisions of privacy act (Legislative Decree June, 30 2003, no.196 - Italy’s New Data Protection Code).Any use not in accord with its purpose, any disclosure, reproduction, copying, distribution, or either dissemination, either whole or partial, is strictly forbidden except previous formal approval of the named addressee(s). If you are not the intended recipient, please contact immediately the sender by telephone, fax or e-mail and delete the information in this message that has been received in error. The sender does not give any warranty or accept liability as the content, accuracy or completeness of sent messages and accepts no responsibility for changes made after they were sent or for other risks which arise as a result of e-mail transmission, viruses, etc.


Oh, the matter was “se:Title” !!! I’ve added that line to the original sld saved by QGIS. Thank you so much!

Yes the scaled image was not very good … now I’ll try with an svg.

There is a suggested place where to download free svg / png for QGIS and / or for Geoserver?
Someone told me about a project to share free QGIS styles between users, maybe there is already something for geoserver?

Thanks

···

2016-07-18 13:57 GMT+02:00 Andrea Aime <andrea.aime@anonymised.com…>:

Hi Annalisa,
weird, I’ve tried the style on a 2.9.x (2.7.x is not supported anymore) and I get this validation error:

line 7: cvc-complex-type.2.4.a: Invalid content was found starting with element ‘se:Title’. One of ‘{“http://www.opengis.net/se”:Description, “http://www.opengis.net/sld”:IsDefault, “http://www.opengis.net/se”:FeatureTypeStyle, “http://www.opengis.net/se”:CoverageStyle, “http://www.opengis.net/se”:OnlineResource}’ is expected.

This modified style appears to validate and work instead:

<?xml version="1.0" encoding="UTF-8"?> srb_nero

se:FeatureTypeStyle
se:Rule
se:NameSingle symbol</se:Name>
se:PointSymbolizer
se:Graphic
se:ExternalGraphic
<se:OnlineResource xlink:type=“simple” xlink:href=“http://geomap.arpa.veneto.it/static/img/ico/antenna-with-signal-transmission.png”/>
se:Formatimage/png</se:Format>
</se:ExternalGraphic>
se:Size15</se:Size>
</se:Graphic>
</se:PointSymbolizer>
</se:Rule>
</se:FeatureTypeStyle>


See this getmap:

http://demo.geo-solutions.it/geoserver/sf/wms?service=WMS&version=1.1.0&request=GetMap&layers=sf:archsites&styles=srb_nero&bbox=589851.4376666048,4914490.882968263,608346.4603107043,4926501.8980334345&width=768&height=498&srs=EPSG:26713&format=application/openlayers

The original symbol is really large compared to the target one, the scaled down version does not look so good… better use SVGs or a pre-scaled-down symbol that you can use at its native size instead (we could try with a different interpolation, but it’s hard/impossible to make everybody happy, we used to have a different one and people complained the output looked foggy…)… thinking out loud, could be a place for people to add a vendor option to tell us which rescaling algorithm to use.

Cheers
Andrea

On Mon, Jul 18, 2016 at 12:46 PM, Annalisa Schiavon <annalisa.schiavon@anonymised.com> wrote:

Hi all, sorry for the late reply.
I attach the full log after having applied the PNG symbol.
The full sld file is:

Name
srb_nero

<?xml version="1.0" encoding="UTF-8"?> srb_nero srb_nero srb_nero

se:Rule
se:NameSingle symbol</se:Name>
se:PointSymbolizer
se:Graphic
se:ExternalGraphic
<se:OnlineResource xlink:type=“simple” xlink:href=“http://geomap.arpa.veneto.it/static/img/ico/antenna-with-signal-transmission.png”/>
se:Formatimage/png</se:Format>
</se:ExternalGraphic>
se:Size15</se:Size>
</se:Graphic>
</se:PointSymbolizer>
</se:Rule>

</se:FeatureTypeStyle>


On the Style Editor page, with this style select, if I choose “validate” button, it’s ok and if I choose “Preview legend” button, I correctly view the symbol.

Thank you so much

Annalisa

==
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

AVVERTENZE AI SENSI DEL D.Lgs. 196/2003

Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il loro utilizzo è consentito esclusivamente al destinatario del messaggio, per le finalità indicate nel messaggio stesso. Qualora riceviate questo messaggio senza esserne il destinatario, Vi preghiamo cortesemente di darcene notizia via e-mail e di procedere alla distruzione del messaggio stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso, divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità diverse, costituisce comportamento contrario ai principi dettati dal D.Lgs. 196/2003.

The information in this message and/or attachments, is intended solely for the attention and use of the named addressee(s) and may be confidential or proprietary in nature or covered by the provisions of privacy act (Legislative Decree June, 30 2003, no.196 - Italy’s New Data Protection Code).Any use not in accord with its purpose, any disclosure, reproduction, copying, distribution, or either dissemination, either whole or partial, is strictly forbidden except previous formal approval of the named addressee(s). If you are not the intended recipient, please contact immediately the sender by telephone, fax or e-mail and delete the information in this message that has been received in error. The sender does not give any warranty or accept liability as the content, accuracy or completeness of sent messages and accepts no responsibility for changes made after they were sent or for other risks which arise as a result of e-mail transmission, viruses, etc.


2016-07-11 21:15 GMT+02:00 Andrea Aime <andrea.aime@anonymised.com>:

Ciao Annalisa,
the exception is not familiar to me, could you check the GeoServer logs and find the full
stack trace for that issue?

Hi all.
I’ve tried to create a sld style using an external graphic:

se:Rule
se:NameSingle symbol</se:Name>
se:PointSymbolizer
se:Graphic
se:ExternalGraphic
<se:OnlineResource xlink:type=“simple” xlink:href=“file:///var/www/geonode/static/img/ico/poi_tower_communications.svg”/>
se:Formatimage/svg+xml</se:Format>
</se:ExternalGraphic>
se:Size15</se:Size>
</se:Graphic>
</se:PointSymbolizer>
</se:Rule>


and than:

se:Rule
se:NameSingle symbol</se:Name>
se:PointSymbolizer
se:Graphic
se:ExternalGraphic
<se:OnlineResource xlink:type=“simple” xlink:href=“http://geomap.arpa.veneto.it/static/img/ico/antenna-with-signal-transmission.png”/>
se:Formatimage/png</se:Format>
</se:ExternalGraphic>
se:Size15</se:Size>
</se:Graphic>
</se:PointSymbolizer>
</se:Rule>

In both cases, into style editor the preview works fine, but the layer preview of geoserver returns an error:

java.io.IOException: java.lang.RuntimeException: Parsing failed for UserStyle: java.lang.ClassCastException: java.util.HashMap cannot be cast to org.opengis.util.International

Geoserver ver.: 2.7.4 (with Geonode project, ver. 2.4)

It is the first time I try to use external graphics. Any ideas to resolve error?

Thanks


Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape


Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

On Mon, Jul 18, 2016 at 3:09 PM, Annalisa Schiavon <
annalisa.schiavon@anonymised.com> wrote:

Oh, the matter was "se:Title" !!!! I've added that line to the original
sld saved by QGIS. Thank you so much!

Yes the scaled image was not very good ... now I'll try with an svg.

There is a suggested place where to download free svg / png for QGIS and /
or for Geoserver?
Someone told me about a project to share free QGIS styles between users,
maybe there is already something for geoserver?

I'm not aware of a style repository, but I believe you can get a good
result if you take a dedicated image
processing tool (even just IrfanView), that icon, and scale it down to the
desired size using a high quality
filter, like the sinc/lanczos one.

I've taken your example in Gimp, and scaled it down with sync/lanczos and
it was still ugly,
the noticed it was using a color palette, expanded it to RGB, applied the
scaling again, and the
result is better (maybe not great, but it's hard to get a crisp looking
image with just 15 pixels):


I've attached the image to this mail, just in case.

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

*AVVERTENZE AI SENSI DEL D.Lgs. 196/2003*

Le informazioni contenute in questo messaggio di posta elettronica e/o
nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il
loro utilizzo è consentito esclusivamente al destinatario del messaggio,
per le finalità indicate nel messaggio stesso. Qualora riceviate questo
messaggio senza esserne il destinatario, Vi preghiamo cortesemente di
darcene notizia via e-mail e di procedere alla distruzione del messaggio
stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso,
divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od
utilizzarlo per finalità diverse, costituisce comportamento contrario ai
principi dettati dal D.Lgs. 196/2003.

The information in this message and/or attachments, is intended solely for
the attention and use of the named addressee(s) and may be confidential or
proprietary in nature or covered by the provisions of privacy act
(Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection
Code).Any use not in accord with its purpose, any disclosure, reproduction,
copying, distribution, or either dissemination, either whole or partial, is
strictly forbidden except previous formal approval of the named
addressee(s). If you are not the intended recipient, please contact
immediately the sender by telephone, fax or e-mail and delete the
information in this message that has been received in error. The sender
does not give any warranty or accept liability as the content, accuracy or
completeness of sent messages and accepts no responsibility for changes
made after they were sent or for other risks which arise as a result of
e-mail transmission, viruses, etc.

-------------------------------------------------------

antenna-with-signal-transmission-scaled.png

antenna-with-signal-transmission-scaled.png