2

I have a PostgreSQL table with fields:

  • 'id' with identificators of objects types (e.g. shops, cinemas etc),
  • 'graphic' with SVG codes of correcponding map symbols.

I want to create sld style with links to graphic in this table, instead any files.

EXAMPLE

Classic style:

<PointSybmolizer>
    ...
    <Graphic>
        <ExternalGraphic>
            <OnlineResource xlink:type="simple" xlink:href="sign.svg"/>
            <Format>image/svg+xml</Format>
        </ExternalGraphic>
    </Graphic>
</PointSymbolizer>

And style I want:

<PointSybmolizer>
    ...
    <Graphic>
        <!-- Link to database record with same sign.svg -->
    </Graphic>
<PointSymbolizer>

Are there methods to achieve this?

2

This can be done using something like: <ExternalGraphic> <OnlineResource xlink:type="simple" xlink:href="http://mysite.com/images/${graphic}.svg"/> <Format>image/svg+xml</Format> </ExternalGraphic>

You can check this usage on the Geoserver documentation.

Your graphic field can contain the name of the symbol, the filename, a path or a complete URL.

1

What you suggest cannot be done without changing GeoServer own code, see here in case you're interested in making changes: https://github.com/geoserver/geoserver/blob/master/src/main/src/main/java/org/geoserver/config/GeoServerDataDirectory.java#L1199

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.