Yes, that is something you can do with style factory.

Explicitly for marks:

-
http://docs.geotools.org/latest/javadocs/org/geotools/styling/StyleFactory.html#createMark-org.opengis.filter.expression.Expression-org.geotools.styling.Stroke-org.geotools.styling.Fill-org.opengis.filter.expression.Expression-org.opengis.filter.expression.Expression-

And using an embedded CQL expression for external graphics:
-
http://docs.geotools.org/latest/javadocs/org/geotools/styling/StyleFactory.html#createExternalGraphic-java.net.URL-java.lang.String-

See example at the end of the page here
https://docs.geoserver.org/latest/en/user/styling/sld/extensions/pointsymbols.html#dynamic-symbolizers


--
Jody Garnett


On Thu, 11 Nov 2021 at 09:01, lum_h--- via GeoTools-GT2-Users <
geotools-gt2-users@lists.sourceforge.net> wrote:

> Hi folks,
>
>
>
> From the geotools user guide Styling features for display — GeoTools
> 27-SNAPSHOT User Guide
> <https://docs.geotools.org/latest/userguide/library/render/style.html>
> example:
>
>
>
>         *//*
>
>         *// create the graphical mark used to represent a city*
>
>         Stroke stroke = sf.stroke(ff.literal("#000000"), *null*, *null*,
> *null*, *null*, *null*, *null*);
>
>         Fill fill = sf.fill(*null*, ff.literal(Color.BLUE), ff.literal(1.0
> ));
>
>
>
>         *// OnLineResource implemented by gt-metadata - so no factory!*
>
>         OnLineResourceImpl svg = *new* OnLineResourceImpl(*new* URI(
> "file:city.svg"));
>
>         svg.freeze(); *// freeze to prevent modification at runtime*
>
>
>
>         OnLineResourceImpl png = *new* OnLineResourceImpl(*new* URI(
> "file:city.png"));
>
>         png.freeze(); *// freeze to prevent modification at runtime*
>
>
>
>         *//*
>
>         *// List of symbols is considered in order with the rendering
> engine choosing*
>
>         *// the first one it can handle. Allowing for svg, png, mark
> order*
>
>         List<GraphicalSymbol> symbols = *new* ArrayList<>();
>
>         symbols.add(sf.externalGraphic(svg, "svg", *null*)); *// svg
> preferred*
>
>         symbols.add(sf.externalGraphic(png, "png", *null*)); *// png
> preferred*
>
>         symbols.add(sf.mark(ff.literal("circle"), fill, stroke)); *//
> simple circle backup plan*
>
>
>
>         Expression opacity = *null*; *// use default*
>
>         Expression size = ff.literal(10);
>
>         Expression rotation = *null*; *// use default*
>
>         AnchorPoint anchor = *null*; *// use default*
>
>         Displacement displacement = *null*; *// use default*
>
>
>
>         *// define a point symbolizer of a small circle*
>
>         Graphic circle = sf.graphic(symbols, opacity, size, rotation,
> anchor, displacement);
>
>         PointSymbolizer pointSymbolizer =
>
>                 sf.pointSymbolizer("point", ff.property("the_geom"),
> *null*, *null*, circle);
>
>
>
> Would it be possible to specify the SVG graphic dynamically using
> “Expression” ?
>
> I would like the SVG to be specified via ff.property() ?
>
>
>
> Appreciate your help.
>
>
> _______________________________________________
> GeoTools-GT2-Users mailing list
> GeoTools-GT2-Users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to