[Geoserver-users] Priority of the "space around symbols" in fills (originally, displacement)

Hi Andrea,
I’m now dabbling with the SLD Vendor Option - “graphic-margin” and have encountered an issue; before I file a JIRA for it as a bug I wanted to confirm if it’s desired or unintended.

My graphic-fills are SVG symbols of different sizes.

My SLD is:

se:PolygonSymbolizer
se:Fill
se:GraphicFill
se:Graphic
se:ExternalGraphic
<se:OnlineResource xlink:type=“simple” xlink:href=“file:///d:/GeoServer_Symbology/OSMM_SVG_symbols/smallConiferousTreeFillSymbol.svg”/>
se:Formatimage/svg+xml</se:Format>
</se:ExternalGraphic>
se:Size16</se:Size>
</se:Graphic>
</se:GraphicFill>
</se:Fill>
<se:VendorOption name=“graphic-margin”>15</se:VendorOption>
</se:PolygonSymbolizer>

se:PolygonSymbolizer
se:Fill
se:GraphicFill
se:Graphic
se:ExternalGraphic
<se:OnlineResource xlink:type=“simple” xlink:href=“file:///d:/GeoServer_Symbology/OSMM_SVG_symbols/scrubFillSymbol.svg”/>
se:Formatimage/svg+xml</se:Format>
</se:ExternalGraphic>
se:Size16</se:Size>
</se:Graphic>
</se:GraphicFill>
</se:Fill>
<se:VendorOption name=“graphic-margin”>15</se:VendorOption>
</se:PolygonSymbolizer>

As you can see I’m using the same numbers for both items; However the output is:
Inline images 4

The scrub pattern isn’t neatly gridded on the X axis because the scrub SVG isn’t as wide as the tree.

I know it’s possible to set specific margins, but that doesn’t help. For instance, if I change the scrub line to:
<se:VendorOption name=“graphic-margin”>17 15</se:VendorOption>

That gives:
Inline images 5

The Y is still correct, but the X is too short.

But if I increase the X to 18, it becomes too long:

Inline images 6

This seems to make it impossible to actually pattern multiple fills together neatly.

Am I doing something wrong or is this a bug?

image.png

···

Cheers,
Jonathan

On 23 August 2013 15:55, Andrea Aime <andrea.aime@anonymised.com> wrote:

On Fri, Aug 23, 2013 at 4:51 PM, Jonathan Moules <jonathanmoules@anonymised.com> wrote:

Thanks. We’re using 2.3.5 so should be fine.
Is there any documentation on it? I can’t seem to find anything.

http://docs.geoserver.org/stable/en/user/styling/sld-extensions/margins.html

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


On Wed, Dec 4, 2013 at 4:15 PM, Jonathan Moules <
jonathanmoules@anonymised.com> wrote:

Am I doing something wrong or is this a bug?

Unsure, since I don't have the SVGs in question, but I have the impression
there is some misunderstanding
on how this is supposed to work.

Each fill is independent of each other (in SLD, every symbolizer is
independent, unaware, of each other),
it's up to you to setup margin to organize them in such a way to obtain the
desired output effect.
Think of the space you're filling starting from top left of an ideal
rectangle containing all symbols,
and add margins so that the output ends up being synchronized the way you
want.
See the example here:
http://docs.geoserver.org/stable/en/user/styling/sld-extensions/margins.html

The way I reason about it, is to decide how my repeatable "block" should
look like,
and then move the symbols inside it using the margins, in such a way that
the
width(symbol) + left + rigth is the same for all symbols, and
height(symbol) + top + bottom
is again the same for all symbols (this ensure you have no drift like in
the symbols above).
Using SVGs might make things a bit complicated if their overall size is not
an integer number
(being vector, they could be, for example, 10.3 pixels large).

====

Couple of other observations:
(b) - The doc says: "top-bottom,right-left (two values, top and bottom
sharing the same value)", but as you can see above, it seems to actually be
right-left, top-bottom. I've not tried the three and four values to see if
they agree with the docs.

Nope, the doc is correct, it matches the standard CSS margin option:
http://www.w3schools.com/css/css_margin.asp

(c) - Using a single symbol, size 16, with a pattern of "5 17", I get this:
As you can see, it's cutting off the tree - should it do that? I thought
it was just adding whitespace around it before drawing the next tree. If I
change it to "5 25", then the tree disappears altogether!

This indeed sounds like a bug. And it is, I have one bit in the code that
switches X and Y takes the top as left, and left as top (just one line
among many
others that get it right) and this results in the cut.

http://jira.codehaus.org/browse/GEOT-4643

This one I've just fixed. Any chance you can try the next nightly build?
The planned release is only 3 days away, but no one has time to do it, so
it may get skipped...

http://ares.boundlessgeo.com/geoserver/2.4.x/

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

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