[Geoserver-users] KML Reflector remote SLD problems

Hello all!

I should first start by saying I am not sure what I am trying to do is possible. Although geoserver is pretty sweet and haven’t found much that I could not do :slight_smile:

I am trying to use the KML reflector and attach a remote sld url in the request. The sld in question has an ExternalGraphic, but I have also tried with just a general color style and I get the same exception. The sld that is generated looks like this:



cite:mylayer

My Layer image/png 64

And the exception I get is:

15 Jul 15:50:10 ERROR [geoserver.ows] -
java.lang.NullPointerException
at org.geoserver.kml.decorator.PlacemarkStyleDecoratorFactory$PlacemarkStyleDecorator.setLiveIconStyle(PlacemarkStyleDecoratorFactory.java:259)
at org.geoserver.kml.decorator.PlacemarkStyleDecoratorFactory$PlacemarkStyleDecorator.setIconStyle(PlacemarkStyleDecoratorFactory.java:204)
at org.geoserver.kml.decorator.PlacemarkStyleDecoratorFactory$PlacemarkStyleDecorator.decorate(PlacemarkStyleDecoratorFactory.java:102)
at org.geoserver.kml.sequence.FeatureSequenceFactory$FeatureGenerator.next(FeatureSequenceFactory.java:121)
at org.geoserver.kml.sequence.FeatureSequenceFactory$FeatureGenerator.next(FeatureSequenceFactory.java:80)
at org.geoserver.kml.sequence.SequenceList$GeneratorIterator.(SequenceList.java:29)
at org.geoserver.kml.sequence.SequenceList.iterator(SequenceList.java:63)

A couple things:

  • The SLD works great when used in a simple WMS request with format=image/png
  • I was trying a more complex OnlineResource that had CQL, but moved to a simple google icon that I know is available

So the question is, can I use an SLD to generate icons with the KML reflector? Can the sld come from a remote server? If yes, any idea on what I might be doing wrong?

Thanks,
Shaun

Hi Shaun,
out of the box, and from a general point of view, I don’t believe this is feasible, because GeoServer will try to link
back to itself either to generate the actual KML only when you are zoomed in enough, using a static image when
you are too far away from the ground, and when it does, it will link back to itself for generality sake, in order to
render all types of graphics (not just ones that are already online, and even for those, it’s hard to tell if the
graphic is available only to the server, because it’s referencing some other server in DMZ, or also to the client).

For the restricted case where you are trying to get the KML features right away (dump mode) and you are telling
GeoServer that icons are available also to the client (under your responsibility) it could be made to work… but only
with some code changes, and adding a new request parameter to enable/disable “live icons” (that is, backlinks
to GeoServer that will make GS generate PNGs of the icons based on a local style reference).

If you are interested in such improvement read here:
https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer

Cheers
Andrea

···

On Sat, Jul 16, 2016 at 3:51 AM, Shaun Taggart <forumshaun8@anonymised.com> wrote:

Hello all!

I should first start by saying I am not sure what I am trying to do is possible. Although geoserver is pretty sweet and haven’t found much that I could not do :slight_smile:

I am trying to use the KML reflector and attach a remote sld url in the request. The sld in question has an ExternalGraphic, but I have also tried with just a general color style and I get the same exception. The sld that is generated looks like this:



cite:mylayer

My Layer image/png 64

And the exception I get is:

15 Jul 15:50:10 ERROR [geoserver.ows] -
java.lang.NullPointerException
at org.geoserver.kml.decorator.PlacemarkStyleDecoratorFactory$PlacemarkStyleDecorator.setLiveIconStyle(PlacemarkStyleDecoratorFactory.java:259)
at org.geoserver.kml.decorator.PlacemarkStyleDecoratorFactory$PlacemarkStyleDecorator.setIconStyle(PlacemarkStyleDecoratorFactory.java:204)
at org.geoserver.kml.decorator.PlacemarkStyleDecoratorFactory$PlacemarkStyleDecorator.decorate(PlacemarkStyleDecoratorFactory.java:102)
at org.geoserver.kml.sequence.FeatureSequenceFactory$FeatureGenerator.next(FeatureSequenceFactory.java:121)
at org.geoserver.kml.sequence.FeatureSequenceFactory$FeatureGenerator.next(FeatureSequenceFactory.java:80)
at org.geoserver.kml.sequence.SequenceList$GeneratorIterator.(SequenceList.java:29)
at org.geoserver.kml.sequence.SequenceList.iterator(SequenceList.java:63)

A couple things:

  • The SLD works great when used in a simple WMS request with format=image/png
  • I was trying a more complex OnlineResource that had CQL, but moved to a simple google icon that I know is available

So the question is, can I use an SLD to generate icons with the KML reflector? Can the sld come from a remote server? If yes, any idea on what I might be doing wrong?

Thanks,
Shaun


What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are
consuming the most bandwidth. Provides multi-vendor support for NetFlow,
J-Flow, sFlow and other flows. Make informed decisions using capacity planning
reports.http://sdm.link/zohodev2dev


Geoserver-users mailing list
Geoserver-users@anonymised.comsts.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.


Andrea,

Sorry for the duplicate email, forgot to reply all :confused:

Thanks so much for the response. I am still a bit confused. I am using the following SLD for KML output as a simple test:

<StyledLayerDescriptor xmlns="[http://www.opengis.net/sld](http://www.opengis.net/sld)" xmlns:ogc="[http://www.opengis.net/ogc](http://www.opengis.net/ogc)" xmlns:xlink="[http://www.w3.org/1999/xlink](http://www.w3.org/1999/xlink)" xmlns:xsi="[http://www.w3.org/2001/XMLSchema-instance](http://www.w3.org/2001/XMLSchema-instance)" version="1.0.0" xsi:schemaLocation="[http://www.opengis.net/sld](http://www.opengis.net/sld) StyledLayerDescriptor.xsd">
<NamedLayer>
    <Name>cite:mylayer</Name>
    <UserStyle>
        <Title>My Layer</Title>
        <FeatureTypeStyle>
            <Rule>
                <PointSymbolizer>
                    <Graphic>
                        <Mark>
                            <Fill>
                                <CssParameter name="fill">#ff0000</CssParameter>
                            </Fill>
                        </Mark>
                    </Graphic>
                </PointSymbolizer>
            </Rule>
        </FeatureTypeStyle>
    </UserStyle>
</NamedLayer>
</StyledLayerDescriptor>

This SLD comes the KML styling documentation here: [http://docs.geoserver.org/2.3.2/user/googleearth/kmlstyling.html#kml-styling-sld-structure](http://docs.geoserver.org/2.3.2/user/googleearth/kmlstyling.html#kml-styling-sld-structure)

Shouldn't that work?

That SLD throws the same exception:
java.lang.NullPointerException
	at org.geoserver.kml.decorator.PlacemarkStyleDecoratorFactory$PlacemarkStyleDecorator.setLiveIconStyle(PlacemarkStyleDecoratorFactory.java:259)
	at org.geoserver.kml.decorator.PlacemarkStyleDecoratorFactory$PlacemarkStyleDecorator.setIconStyle(PlacemarkStyleDecoratorFactory.java:204)
	at org.geoserver.kml.decorator.PlacemarkStyleDecoratorFactory$PlacemarkStyleDecorator.decorate(PlacemarkStyleDecoratorFactory.java:102)
	at org.geoserver.kml.sequence.FeatureSequenceFactory$FeatureGenerator.next(FeatureSequenceFactory.java:121)
	at org.geoserver.kml.sequence.FeatureSequenceFactory$FeatureGenerator.next(FeatureSequenceFactory.java:80)
	at org.geoserver.kml.sequence.SequenceList$GeneratorIterator.<init>(SequenceList.java:29)
	at org.geoserver.kml.sequence.SequenceList.iterator(SequenceList.java:63)


Sorry if I am missing something obvious, and thanks again for the quick response.
···

On Sun, Jul 17, 2016 at 6:25 AM, Andrea Aime <andrea.aime@anonymised.com…> wrote:

Hi Shaun,
out of the box, and from a general point of view, I don’t believe this is feasible, because GeoServer will try to link
back to itself either to generate the actual KML only when you are zoomed in enough, using a static image when
you are too far away from the ground, and when it does, it will link back to itself for generality sake, in order to
render all types of graphics (not just ones that are already online, and even for those, it’s hard to tell if the
graphic is available only to the server, because it’s referencing some other server in DMZ, or also to the client).

For the restricted case where you are trying to get the KML features right away (dump mode) and you are telling
GeoServer that icons are available also to the client (under your responsibility) it could be made to work… but only
with some code changes, and adding a new request parameter to enable/disable “live icons” (that is, backlinks
to GeoServer that will make GS generate PNGs of the icons based on a local style reference).

If you are interested in such improvement read here:
https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer

Cheers
Andrea

On Sat, Jul 16, 2016 at 3:51 AM, Shaun Taggart <forumshaun8@anonymised.com> wrote:

Hello all!

I should first start by saying I am not sure what I am trying to do is possible. Although geoserver is pretty sweet and haven’t found much that I could not do :slight_smile:

I am trying to use the KML reflector and attach a remote sld url in the request. The sld in question has an ExternalGraphic, but I have also tried with just a general color style and I get the same exception. The sld that is generated looks like this:



cite:mylayer

My Layer image/png 64

And the exception I get is:

15 Jul 15:50:10 ERROR [geoserver.ows] -
java.lang.NullPointerException
at org.geoserver.kml.decorator.PlacemarkStyleDecoratorFactory$PlacemarkStyleDecorator.setLiveIconStyle(PlacemarkStyleDecoratorFactory.java:259)
at org.geoserver.kml.decorator.PlacemarkStyleDecoratorFactory$PlacemarkStyleDecorator.setIconStyle(PlacemarkStyleDecoratorFactory.java:204)
at org.geoserver.kml.decorator.PlacemarkStyleDecoratorFactory$PlacemarkStyleDecorator.decorate(PlacemarkStyleDecoratorFactory.java:102)
at org.geoserver.kml.sequence.FeatureSequenceFactory$FeatureGenerator.next(FeatureSequenceFactory.java:121)
at org.geoserver.kml.sequence.FeatureSequenceFactory$FeatureGenerator.next(FeatureSequenceFactory.java:80)
at org.geoserver.kml.sequence.SequenceList$GeneratorIterator.(SequenceList.java:29)
at org.geoserver.kml.sequence.SequenceList.iterator(SequenceList.java:63)

A couple things:

  • The SLD works great when used in a simple WMS request with format=image/png
  • I was trying a more complex OnlineResource that had CQL, but moved to a simple google icon that I know is available

So the question is, can I use an SLD to generate icons with the KML reflector? Can the sld come from a remote server? If yes, any idea on what I might be doing wrong?

Thanks,
Shaun


What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are
consuming the most bandwidth. Provides multi-vendor support for NetFlow,
J-Flow, sFlow and other flows. Make informed decisions using capacity planning
reports.http://sdm.link/zohodev2dev


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.


On Mon, Jul 18, 2016 at 5:45 PM, Shaun Taggart <forumshaun8@anonymised.com>
wrote:

This SLD comes the KML styling documentation here: http://docs.geoserver.org/2.3.2/user/googleearth/kmlstyling.html#kml-styling-sld-structure

Shouldn't that work?

Not if you are sending the SLD along with the request or referring to a
remote one, it's going to work only if the style is configured in GeoServer
as a local style
and you are referring to it by name instead.

The NPE is happening because the code tries to find the style in the local
configured styles, and cannot find it
(since your style is remote).

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.

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