Dynamic symbolizers not evaluated in KML output for relative path 
ExternalGraphics
----------------------------------------------------------------------------------

                 Key: GEOS-4608
                 URL: http://jira.codehaus.org/browse/GEOS-4608
             Project: GeoServer
          Issue Type: Bug
          Components: Google Earth KML Output
    Affects Versions: 2.1.0
            Reporter: Christopher S. Dillard
            Assignee: Andrea Aime
         Attachments: bad_eval.sld

An SLD with an ExternalGraphic that has a relative filename containing a ${...} 
expression does not get evaluated.  This is related in spirit to prior bug 
GEOS-2670, but I think it's a different problem.

A minimalist SLD demonstrating the problem is attached.  Use it with any point 
features.  It requires that you have a "foo/bar.png" image in your GeoServer's 
styles directory.  (My real-world SLD uses a custom-written function evaluated 
on various feature properties to determine which image to display for each 
feature.)  The KML that results from the attached SLD has the following in it:

<IconStyle>
  <colorMode>normal</colorMode>
  <Icon>
    
<href>http://localhost:8080/geoserver-2.1.0/styles/foo/$%7B'bar'%7D.png</href>
  </Icon>
</IconStyle>

This SLD works great outputting images in the WMS, just not KML.  (I'm not 
familiar enough with the WMS rendering code to figure out what's different.)

I stepped through the debugger, and here's what I observed:

If the SLD's ExternalGraphic has a relative path (e.g. 
xlink:href="somedir/somefile.png") then it apparently gets converted to an 
absolute "file:" URL.  So in KMLMapTransformer.java's encodePointStyle method, 
you get into the "if" branch that deals with "file:" URLs.  At line 703 of 
KMLMapTransformer.java the bad thing happens: ResponseUtils.buildURL is 
invoked, which URL-encodes the "{" and "}" characters.  So when 
evaluateDynamicSymbolizer is called, it can't find any "${...}" strings (since 
they now look like "$%7B...%7D").  And in fact, an exception gets dumped to the 
console complaining about the bare "$".

You can work around this behavior by changing the SLD to use absolute URLs 
instead.  This makes the KMLMapTransformer.java "if" block that encodes the URL 
get skipped.  Then KML works, but the WMS stops rendering the icons.  (I 
suppose I could have one style and/or layer for each: KML and images.  But that 
seems unsatisfactory.)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
Geoserver-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

Reply via email to