[Geoserver-users] TextSymbolizer without a Label

I have a feature with the attached style. I don’t see any problems until I try to export the feature to google earth. Then I see the following errors in geoserver. I debugged the issue and it turns out I don’t have a Label tag under the TextSymbolizer element in the SLD. The documentation states the Label element isn’t required. Is that not the case in google earth?

From the code:

org.geoserver.kml.decorator.PlacemarkNameDecoratorFactory.java:64 calls

org.geotools.styling.SLD line 1171 which returns a null:

Symbolizer = null

From the logs:

22:28:57,754 ERROR [org.geoserver.ows] (http-/0.0.0.0:8443-6) : java.lang.NullPointerException

at org.geoserver.kml.decorator.PlacemarkNameDecoratorFactory$PlacemarkNameDecorator.decorate(PlacemarkNameDecoratorFactory.java:64) [gs-kml-2.7.2.jar:2.7.2]

at org.geoserver.kml.sequence.FeatureSequenceFactory$FeatureGenerator.next(FeatureSequenceFactory.java:121) [gs-kml-2.7.2.jar:2.7.2]

at org.geoserver.kml.sequence.FeatureSequenceFactory$FeatureGenerator.next(FeatureSequenceFactory.java:80) [gs-kml-2.7.2.jar:2.7.2]

at org.geoserver.kml.sequence.SequenceList$GeneratorIterator.(SequenceList.java:29) [gs-kml-2.7.2.jar:2.7.2]

at org.geoserver.kml.sequence.SequenceList.iterator(SequenceList.java:63) [gs-kml-2.7.2.jar:2.7.2]

geoserver url from google earth:

http://localhost/geoserver/wms?crs=CRS:84&time=2015-12-24T00:00:00.000Z&height=1024&bbox=-163.2354539790473,15.57941628804031,-147.6617927872543,27.65836991454673&layers=tracks:pimTrack-indicator5&width=1024&request=GetMap&service=WMS&styles=&format_options=SUPEROVERLAY:false;KMPLACEMARK:false;KMSCORE:40;KMATTR:true;&format=application/vnd.google-earth.kmz&transparent=false&version=1.3.0

Dominique Bessette

gis_pim_posit.sld (7.3 KB)

On Wed, Dec 23, 2015 at 12:00 AM, Bessette-Halsema, Dominique E <
Dominique.Bessette@anonymised.com> wrote:

I have a feature with the attached style. I don’t see any problems until
I try to export the feature to google earth. Then I see the following
errors in geoserver. I debugged the issue and it turns out I don’t have a
Label tag under the TextSymbolizer element in the SLD. The documentation
states the Label element isn’t required.

This is a surprise to me, but checking the SLD schema, you are right, the
Label element is indeed optional.

Is that not the case in google earth?

I think you already answered yourself, no? :slight_smile:

From the code:

org.geoserver.kml.decorator.PlacemarkNameDecoratorFactory.java:64 calls

org.geotools.styling.SLD line 1171 which returns a null:

Symbolizer = <TextSymbolizerImp property=posit_geom label=null>null

From the logs:

22:28:57,754 ERROR [org.geoserver.ows] (http-/0.0.0.0:8443-6) :
java.lang.NullPointerException

        at
org.geoserver.kml.decorator.PlacemarkNameDecoratorFactory$PlacemarkNameDecorator.decorate(PlacemarkNameDecoratorFactory.java:64)
[gs-kml-2.7.2.jar:2.7.2]

        at
org.geoserver.kml.sequence.FeatureSequenceFactory$FeatureGenerator.next(FeatureSequenceFactory.java:121)
[gs-kml-2.7.2.jar:2.7.2]

        at
org.geoserver.kml.sequence.FeatureSequenceFactory$FeatureGenerator.next(FeatureSequenceFactory.java:80)
[gs-kml-2.7.2.jar:2.7.2]

        at
org.geoserver.kml.sequence.SequenceList$GeneratorIterator.<init>(SequenceList.java:29)
[gs-kml-2.7.2.jar:2.7.2]

        at
org.geoserver.kml.sequence.SequenceList.iterator(SequenceList.java:63)
[gs-kml-2.7.2.jar:2.7.2]

geoserver url from google earth:

http://localhost/geoserver/wms?crs=CRS:84&time=2015-12-24T00:00:00.000Z&height=1024&bbox=-163.2354539790473,15.57941628804031,-147.6617927872543,27.65836991454673&layers=tracks:pimTrack-indicator5&width=1024&request=GetMap&service=WMS&styles=&format_options=SUPEROVERLAY:false;KMPLACEMARK:false;KMSCORE:40;KMATTR:true;&format=application/vnd.google-earth.kmz&transparent=false&version=1.3.0

Yep, makes sense, the code is not accounting for a missing label element,
only for an empty one.

Feel free to submit a bug report here:
https://osgeo-org.atlassian.net/projects/GEOS/summary
If you have programming skills a pull request fixing this, with a test,
against the master branch, would be much appreciated:
https://github.com/geoserver/geoserver/blob/master/CONTRIBUTING.md

Cheers
Andrea

--

GeoServer Professional Services from the experts! Visit
http://goo.gl/it488V for more information.

*Geosolutions' Winter Holidays from 24/12 to 6/1*

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

*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.

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

This leaves the question of what you expected the output to be in this case? The spec says:

"The Label element is used to provide text-label content. It is defined as follows:
<xs:element name=“Label” type=“sld:ParameterValueType”/
The ParameterValueType may refer to a complex value and the type of the
property/expression is unimportant as the system is expected to provide a text-string
version of the property/expression for rendering whatever its type. If a Label element is
not provided in a TextSymbol , then no text will be rendered." (My emphasis)

so that symbolizer will do nothing and can be deleted as a simple workaround.

Ian

···

On 23 December 2015 at 07:30, Andrea Aime <andrea.aime@anonymised.com> wrote:



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

On Wed, Dec 23, 2015 at 12:00 AM, Bessette-Halsema, Dominique E <Dominique.Bessette@anonymised.com> wrote:

I have a feature with the attached style. I don’t see any problems until I try to export the feature to google earth. Then I see the following errors in geoserver. I debugged the issue and it turns out I don’t have a Label tag under the TextSymbolizer element in the SLD. The documentation states the Label element isn’t required.

This is a surprise to me, but checking the SLD schema, you are right, the Label element is indeed optional.

Is that not the case in google earth?

I think you already answered yourself, no? :slight_smile:

From the code:

org.geoserver.kml.decorator.PlacemarkNameDecoratorFactory.java:64 calls

org.geotools.styling.SLD line 1171 which returns a null:

Symbolizer = null

From the logs:

22:28:57,754 ERROR [org.geoserver.ows] (http-/0.0.0.0:8443-6) : java.lang.NullPointerException

at org.geoserver.kml.decorator.PlacemarkNameDecoratorFactory$PlacemarkNameDecorator.decorate(PlacemarkNameDecoratorFactory.java:64) [gs-kml-2.7.2.jar:2.7.2]

at org.geoserver.kml.sequence.FeatureSequenceFactory$FeatureGenerator.next(FeatureSequenceFactory.java:121) [gs-kml-2.7.2.jar:2.7.2]

at org.geoserver.kml.sequence.FeatureSequenceFactory$FeatureGenerator.next(FeatureSequenceFactory.java:80) [gs-kml-2.7.2.jar:2.7.2]

at org.geoserver.kml.sequence.SequenceList$GeneratorIterator.(SequenceList.java:29) [gs-kml-2.7.2.jar:2.7.2]

at org.geoserver.kml.sequence.SequenceList.iterator(SequenceList.java:63) [gs-kml-2.7.2.jar:2.7.2]

geoserver url from google earth:

http://localhost/geoserver/wms?crs=CRS:84&time=2015-12-24T00:00:00.000Z&height=1024&bbox=-163.2354539790473,15.57941628804031,-147.6617927872543,27.65836991454673&layers=tracks:pimTrack-indicator5&width=1024&request=GetMap&service=WMS&styles=&format_options=SUPEROVERLAY:false;KMPLACEMARK:false;KMSCORE:40;KMATTR:true;&format=application/vnd.google-earth.kmz&transparent=false&version=1.3.0

Yep, makes sense, the code is not accounting for a missing label element, only for an empty one.

Feel free to submit a bug report here: https://osgeo-org.atlassian.net/projects/GEOS/summary
If you have programming skills a pull request fixing this, with a test, against the master branch, would be much appreciated:
https://github.com/geoserver/geoserver/blob/master/CONTRIBUTING.md

Cheers
Andrea

==
GeoServer Professional Services from the experts! Visit
http://goo.gl/it488V for more information.

Geosolutions’ Winter Holidays from 24/12 to 6/1

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

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.


Ian Turton