[Geoserver-users] SVG Fill with an ExternalGraphic

Hi List,
I have some polygons I want to be filled with a SVG style. The documentation makes it clear GeoServer supports this: http://docs.geoserver.org/stable/en/user/styling/sld-reference/pointsymbolizer.html#externalgraphic

However I’m having issues getting it to work.

  • I’ve tried placing the SVG files onto a local web-server and accessing them like that, but all I get in the legend is grey boxes.
  • Then I placed them into /geoserver_data/styles/svgs - this resulted in a GeoServer console error.
  • Then I placed them in the styles directory itself, but I still get the GeoServer console error.

This page (http://docs.geoserver.org/stable/en/user/styling/sld-extensions/pointsymbols.html#external-graphics) makes it clear that my links are correct (well, maybe not the ./svgs/ one, but it follows convention).

My GeoServer error seems to imply it can’t find the files:

07 Jan 11:22:41 ERROR [org.geoserver.ows] -
org.geoserver.platform.ServiceException: java.io.IOException
at org.geoserver.wms.legendgraphic.GetLegendGraphicKvpReader.read(GetLegendGraphicKvpReader.java:163)
at org.geoserver.wms.legendgraphic.GetLegendGraphicKvpReader.read(GetLegendGraphicKvpReader.java:54)
at org.geoserver.ows.Dispatcher.parseRequestKVP(Dispatcher.java:1405)

And example of the applicable part of my SLD:

se:PolygonSymbolizer
se:Fill
se:GraphicFill
se:Graphic
se:ExternalGraphic

image/svg+xml
</se:ExternalGraphic>
se:Size3</se:Size>
se:Displacement
se:DisplacementX3</se:DisplacementX>
se:DisplacementY4</se:DisplacementY>
</se:Displacement>
</se:Graphic>
</se:GraphicFill>
</se:Fill>
10,10
</se:PolygonSymbolizer>

This one gives me grey boxes in my legend.


Other URL lines include:

Those three give me the GeoServer error.
They also fail GeoServer validation:
“Parsing failed for ExternalGraphic: java.lang.IllegalArgumentException: URI is not absolute”

But the documentation example includes a clearly relative URI.

Fails validation with:
“Parsing failed for href: java.net.URISyntaxException: Malformed escape pair at index 0: %GEOSERVER_DATA_DIR%/styles/svgs/boulderGeometry.svg”


TL;DR: How do I make SVG Fill work with an ExternalGraphic?

Thanks,
Jonathan

This transmission is intended for the named addressee(s) only and may contain sensitive or protectively marked material up to RESTRICTED and should be handled accordingly. Unless you are the named addressee (or authorised to receive it for the addressee) you may not copy or use it, or disclose it to anyone else. If you have received this transmission in error please notify the sender immediately. All email traffic sent to or from us, including without limitation all GCSX traffic, may be subject to recording and/or monitoring in accordance with relevant legislation.

Further,
I’ve now tried:
<se:OnlineResource xlink:type =“simple” xlink:href=“D:\Geoserver_data\styles\svgs\boulderGeometry.svg”/>

Which fails with:

Parsing failed for href: java.net.URISyntaxException: Illegal character in opaque part at index 2: D:\Geoserver_data\styles\svgs\boulderGeometry.svg


So I tried with the slashes the other (“wrong”) way:
<se:OnlineResource xlink:type=“simple” xlink:href=“D:/Geoserver_data/styles/svgs/boulderGeometry.svg”/>

which fails validation with:
“Parsing failed for ExternalGraphic: java.net.MalformedURLException: unknown protocol: d”


When trying to render the legend on the layers->Publishing page, they both fail with the same console error.

So I think I’ve tried every single possible combination and GeoServer fails them all. What am I missing?
Cheers,
Jonathan

On 7 January 2013 11:58, Jonathan Moules <jonathanmoules@anonymised.com> wrote:

Hi List,
I have some polygons I want to be filled with a SVG style. The documentation makes it clear GeoServer supports this: http://docs.geoserver.org/stable/en/user/styling/sld-reference/pointsymbolizer.html#externalgraphic

However I’m having issues getting it to work.

  • I’ve tried placing the SVG files onto a local web-server and accessing them like that, but all I get in the legend is grey boxes.
  • Then I placed them into /geoserver_data/styles/svgs - this resulted in a GeoServer console error.
  • Then I placed them in the styles directory itself, but I still get the GeoServer console error.

This page (http://docs.geoserver.org/stable/en/user/styling/sld-extensions/pointsymbols.html#external-graphics) makes it clear that my links are correct (well, maybe not the ./svgs/ one, but it follows convention).

My GeoServer error seems to imply it can’t find the files:

07 Jan 11:22:41 ERROR [org.geoserver.ows] -
org.geoserver.platform.ServiceException: java.io.IOException
at org.geoserver.wms.legendgraphic.GetLegendGraphicKvpReader.read(GetLegendGraphicKvpReader.java:163)
at org.geoserver.wms.legendgraphic.GetLegendGraphicKvpReader.read(GetLegendGraphicKvpReader.java:54)
at org.geoserver.ows.Dispatcher.parseRequestKVP(Dispatcher.java:1405)

And example of the applicable part of my SLD:

se:PolygonSymbolizer
se:Fill
se:GraphicFill
se:Graphic
se:ExternalGraphic

image/svg+xml
</se:ExternalGraphic>
se:Size3</se:Size>
se:Displacement
se:DisplacementX3</se:DisplacementX>
se:DisplacementY4</se:DisplacementY>
</se:Displacement>
</se:Graphic>
</se:GraphicFill>
</se:Fill>
10,10
</se:PolygonSymbolizer>

This one gives me grey boxes in my legend.


Other URL lines include:

Those three give me the GeoServer error.
They also fail GeoServer validation:
“Parsing failed for ExternalGraphic: java.lang.IllegalArgumentException: URI is not absolute”

But the documentation example includes a clearly relative URI.

Fails validation with:
“Parsing failed for href: java.net.URISyntaxException: Malformed escape pair at index 0: %GEOSERVER_DATA_DIR%/styles/svgs/boulderGeometry.svg”


TL;DR: How do I make SVG Fill work with an ExternalGraphic?

Thanks,
Jonathan

This transmission is intended for the named addressee(s) only and may contain sensitive or protectively marked material up to RESTRICTED and should be handled accordingly. Unless you are the named addressee (or authorised to receive it for the addressee) you may not copy or use it, or disclose it to anyone else. If you have received this transmission in error please notify the sender immediately. All email traffic sent to or from us, including without limitation all GCSX traffic, may be subject to recording and/or monitoring in accordance with relevant legislation.

Following my other thread with CSSParameter and SVGParameter and the revelation there’s a SVG 1.0 and 1.1, I’ve discovered this issue is caused because the stylesheet is 1.1.0, and apparently GeoServer can’t handle external SVG fills with that version yet.

I converted it to 1.0.0 and it now mostly works, but there’s one problem:
One of the key elements I was using was “”, which allows you to offset a fill by a specified number of pixels, but this doesn’t appear to be in 1.0.0. Is there any way around this or is it simply a case of waiting for that aspect of SLD 1.1 to be implemented into GeoServer?

Thanks,
Jonathan

On 7 January 2013 12:17, Jonathan Moules <jonathanmoules@anonymised.com> wrote:

Further,
I’ve now tried:
<se:OnlineResource xlink:type=“simple” xlink:href=“D:\Geoserver_data\styles\svgs\boulderGeometry.svg”/>

Which fails with:

Parsing failed for href: java.net.URISyntaxException: Illegal character in opaque part at index 2: D:\Geoserver_data\styles\svgs\boulderGeometry.svg


So I tried with the slashes the other (“wrong”) way:
<se:OnlineResource xlink:type=“simple” xlink:href=“D:/Geoserver_data/styles/svgs/boulderGeometry.svg”/>

which fails validation with:
“Parsing failed for ExternalGraphic: java.net.MalformedURLException: unknown protocol: d”


When trying to render the legend on the layers->Publishing page, they both fail with the same console error.

So I think I’ve tried every single possible combination and GeoServer fails them all. What am I missing?
Cheers,
Jonathan

On 7 January 2013 11:58, Jonathan Moules <jonathanmoules@anonymised.com> wrote:

Hi List,
I have some polygons I want to be filled with a SVG style. The documentation makes it clear GeoServer supports this: http://docs.geoserver.org/stable/en/user/styling/sld-reference/pointsymbolizer.html#externalgraphic

However I’m having issues getting it to work.

  • I’ve tried placing the SVG files onto a local web-server and accessing them like that, but all I get in the legend is grey boxes.
  • Then I placed them into /geoserver_data/styles/svgs - this resulted in a GeoServer console error.
  • Then I placed them in the styles directory itself, but I still get the GeoServer console error.

This page (http://docs.geoserver.org/stable/en/user/styling/sld-extensions/pointsymbols.html#external-graphics) makes it clear that my links are correct (well, maybe not the ./svgs/ one, but it follows convention).

My GeoServer error seems to imply it can’t find the files:

07 Jan 11:22:41 ERROR [org.geoserver.ows] -
org.geoserver.platform.ServiceException: java.io.IOException
at org.geoserver.wms.legendgraphic.GetLegendGraphicKvpReader.read(GetLegendGraphicKvpReader.java:163)
at org.geoserver.wms.legendgraphic.GetLegendGraphicKvpReader.read(GetLegendGraphicKvpReader.java:54)
at org.geoserver.ows.Dispatcher.parseRequestKVP(Dispatcher.java:1405)

And example of the applicable part of my SLD:

se:PolygonSymbolizer
se:Fill
se:GraphicFill
se:Graphic
se:ExternalGraphic

image/svg+xml
</se:ExternalGraphic>
se:Size3</se:Size>
se:Displacement
se:DisplacementX3</se:DisplacementX>
se:DisplacementY4</se:DisplacementY>
</se:Displacement>
</se:Graphic>
</se:GraphicFill>
</se:Fill>
10,10
</se:PolygonSymbolizer>

This one gives me grey boxes in my legend.


Other URL lines include:

Those three give me the GeoServer error.
They also fail GeoServer validation:
“Parsing failed for ExternalGraphic: java.lang.IllegalArgumentException: URI is not absolute”

But the documentation example includes a clearly relative URI.

Fails validation with:
“Parsing failed for href: java.net.URISyntaxException: Malformed escape pair at index 0: %GEOSERVER_DATA_DIR%/styles/svgs/boulderGeometry.svg”


TL;DR: How do I make SVG Fill work with an ExternalGraphic?

Thanks,
Jonathan

This transmission is intended for the named addressee(s) only and may contain sensitive or protectively marked material up to RESTRICTED and should be handled accordingly. Unless you are the named addressee (or authorised to receive it for the addressee) you may not copy or use it, or disclose it to anyone else. If you have received this transmission in error please notify the sender immediately. All email traffic sent to or from us, including without limitation all GCSX traffic, may be subject to recording and/or monitoring in accordance with relevant legislation.

On Wed, Jan 9, 2013 at 7:28 PM, Jonathan Moules <jonathanmoules@anonymised.com.4942…> wrote:

Following my other thread with CSSParameter and SVGParameter and the revelation there’s a SVG 1.0 and 1.1, I’ve discovered this issue is caused because the stylesheet is 1.1.0, and apparently GeoServer can’t handle external SVG fills with that version yet.

I converted it to 1.0.0 and it now mostly works, but there’s one problem:
One of the key elements I was using was “”, which allows you to offset a fill by a specified number of pixels, but this doesn’t appear to be in 1.0.0. Is there any way around this or is it simply a case of waiting for that aspect of SLD 1.1 to be implemented into GeoServer?

Hmm… displacement of the fill? Not of the polygon that’s to be filled?

Cheers
Andrea

==
Our support, Your Success! Visit http://opensdi.geo-solutions.it for more information.

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


Hi Andrea,
Yep, Displacement of the fill symbol itself.
It’s useful for when you have multiple symbols for a polygon fill - the Ordnance Survey use them for their MasterMap Product when a vegetation area has lots of types of vegetation - it mixes the symbols together to depict the type of vegetation visually.
Look at the light green areas here for a fairly bad example (top left and bottom right):
http://hub.qgis.org/attachments/4788/example4.png

Regards,
Jonathan

On 10 January 2013 11:32, Andrea Aime <andrea.aime@anonymised.com07…> wrote:

On Wed, Jan 9, 2013 at 7:28 PM, Jonathan Moules <jonathanmoules@anonymised.com> wrote:

Following my other thread with CSSParameter and SVGParameter and the revelation there’s a SVG 1.0 and 1.1, I’ve discovered this issue is caused because the stylesheet is 1.1.0, and apparently GeoServer can’t handle external SVG fills with that version yet.

I converted it to 1.0.0 and it now mostly works, but there’s one problem:
One of the key elements I was using was “”, which allows you to offset a fill by a specified number of pixels, but this doesn’t appear to be in 1.0.0. Is there any way around this or is it simply a case of waiting for that aspect of SLD 1.1 to be implemented into GeoServer?

Hmm… displacement of the fill? Not of the polygon that’s to be filled?

Cheers
Andrea

==
Our support, Your Success! Visit http://opensdi.geo-solutions.it for more information.

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


This transmission is intended for the named addressee(s) only and may contain sensitive or protectively marked material up to RESTRICTED and should be handled accordingly. Unless you are the named addressee (or authorised to receive it for the addressee) you may not copy or use it, or disclose it to anyone else. If you have received this transmission in error please notify the sender immediately. All email traffic sent to or from us, including without limitation all GCSX traffic, may be subject to recording and/or monitoring in accordance with relevant legislation.

On Thu, Jan 10, 2013 at 12:39 PM, Jonathan Moules <jonathanmoules@…4942…> wrote:

Hi Andrea,
Yep, Displacement of the fill symbol itself.
It’s useful for when you have multiple symbols for a polygon fill - the Ordnance Survey use them for their MasterMap Product when a vegetation area has lots of types of vegetation - it mixes the symbols together to depict the type of vegetation visually.
Look at the light green areas here for a fairly bad example (top left and bottom right):
http://hub.qgis.org/attachments/4788/example4.png

Ah, interesting. Nope, we don’t have any feature that can emulate this Displacement.

SLD 1.1 support has been what it is for quite some time now, it seems nobody is interested
in funding the development necessary to complete it

Cheers
Andrea

==
Our support, Your Success! Visit http://opensdi.geo-solutions.it for more information.

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