[Geoserver-users] Using external .svg image from the database in SLD file

Hello everyone, I need some help here, please...

I am using GEOServer and I have:
1. My own .sld style with external graphics (svg), which works totally fine
while it getting image from the local directory: "file:/d:/images"
2. I have table in database with .svg images. I can get this image by
following request to my server in the Internet browser:
http://127.0.0.1:3333/getImage.rsc?name=123. And it works perfect.

Then I am trying to get this image from SLD file. Here is a sld fragment:

<sld:Graphic>
              <sld:ExternalGraphic>
                <sld:OnlineResource xlink:type="simple"
xmlns:xlink="http://www.w3.org/1999/xlink&quot;
xlink:href="http://127.0.0.1:3333/getImage.rsc?name=123&quot;/&gt;
                <sld:Format>image/svg+xml</sld:Format>
              </sld:ExternalGraphic>
            </sld:Graphic>

And as a result I have nothing instead of image. Not any mistakes.. just
nothing. Style is still working, but In legend i have empty space instead
of pic. I am checking my server with images, it looks like GeoServer is not
sending any request to my server. So problem is not in response, but in the
request.

So my question is *Can i provide this href
(http://127.0.0.1:3333/getImage.rsc?name=123) as a href to svg image?* Is it
any mistake in it? Or any other ideas why it happens?
Thank you.

--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Using-external-svg-image-from-the-database-in-SLD-file-tp5060881.html
Sent from the GeoServer - User mailing list archive at Nabble.com.

Hi Amiala,

Although the actual tag is “Externalgraphic”, you typically refer in your SLD to the SVG image using the paths on the local file system as you describe in use case 1. Not sure whether the setup in use case 2 using a small script to retrieve an image from a small database table is something catered for in the current code. Andrea?

Best,

Edward

Date: Tue, 18 Jun 2013 07:05:05 -0700
From: belka91@anonymised.com
To: geoserver-users@lists.sourceforge.net
Subject: [Geoserver-users] Using external .svg image from the database in SLD file

Hello everyone, I need some help here, please…

I am using GEOServer and I have:

  1. My own .sld style with external graphics (svg), which works totally fine
    while it getting image from the local directory: “file:/d:/images”
  2. I have table in database with .svg images. I can get this image by
    following request to my server in the Internet browser:
    http://127.0.0.1:3333/getImage.rsc?name=123. And it works perfect.

Then I am trying to get this image from SLD file. Here is a sld fragment:

sld:Graphic
sld:ExternalGraphic
<sld:OnlineResource xlink:type=“simple”
xmlns:xlink=“http://www.w3.org/1999/xlink
xlink:href=“http://127.0.0.1:3333/getImage.rsc?name=123”/>
sld:Formatimage/svg+xml</sld:Format>
</sld:ExternalGraphic>
</sld:Graphic>

And as a result I have nothing instead of image. Not any mistakes… just
nothing. Style is still working, but In legend i have empty space instead
of pic. I am checking my server with images, it looks like GeoServer is not
sending any request to my server. So problem is not in response, but in the
request.

So my question is Can i provide this href
(http://127.0.0.1:3333/getImage.rsc?name=123) as a href to svg image?
Is it
any mistake in it? Or any other ideas why it happens?
Thank you.


View this message in context: http://osgeo-org.1560.x6.nabble.com/Using-external-svg-image-from-the-database-in-SLD-file-tp5060881.html
Sent from the GeoServer - User mailing list archive at Nabble.com.


This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev


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

On Tue, Jun 18, 2013 at 4:21 PM, Edward Mac Gillavry <
emacgillavry@anonymised.com> wrote:

Hi Amiala,

Although the actual tag is "Externalgraphic", you typically refer in your
SLD to the SVG image using the paths on the local file system as you
describe in use case 1. Not sure whether the setup in use case 2 using a
small script to retrieve an image from a small database table is something
catered for in the current code. Andrea?

It may well be that the Apache Batik code doing the parsing cannot handle
the remote resource, we normally just give it a string representing
the path to the file, so it might be that it just works on local files.
I see the code could also be modified to give it a stream instead, maybe
that would work even with remote sources... it's something that needs
to be tested.

Can anybody open a ticket on jira.codehaus.org? If anybody is interested in
trying a fix out, the class to be modified is SVGGraphicFactory
back in GeoTools gt-svg module

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

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

Edward, Andrea,
Thank you a lot for your answers, now everything is clear for me.

I am new here... So if we finally decide to modified SVGGraphicFactory as
you said, should i post it later somewhere?

--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Using-external-svg-image-in-SLD-file-from-the-database-tp5060881p5061028.html
Sent from the GeoServer - User mailing list archive at Nabble.com.

On Wed, Jun 19, 2013 at 10:16 AM, Amiala <belka91@anonymised.com> wrote:

Edward, Andrea,
Thank you a lot for your answers, now everything is clear for me.

I am new here... So if we finally decide to modified SVGGraphicFactory as
you said, should i post it later somewhere?

The ideal way is to fork geotools in your github repo, make the change, and
create a pull request out of it.
A less ideal, but still workable solution is to attach a patch file to
jira.codehaus.org,
in a GeoTools related improvement request

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

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