Yes, you can try styling your data with QGIS.
But if you want to create a rule based sld or an sld with more options (fill opacity, rules, outline etc) I recommend you to use uDig. With you uDig you can style your data with many options and then export slds that will work 99,9% when uploaded on geoserver.
More about sld editor and uDig here.
The <Size>
setting of 20
in your XML specifies an arrow length of 10 pixels followed by a gap of 10 pixels before the next arrow starts being drawn.
If you add a dasharray to the XML inside the <sld:Stroke>
tag as follows:
<sld:Stroke>
<sld:CssParameter name="stroke">#0000FF</sld:CssParameter>
<sld:CssParameter name="stroke-width">1</sld:CssParameter>
<sld:CssParameter name="stroke-dasharray">11 0</sld:CssParameter>
</sld:Stroke>
Then each arrow will be 10 pixels long with a 1 pixel gap between them.
If you then modify the XML inside the <sld:Stroke>
tag as follows:
<sld:Stroke>
<sld:CssParameter name="stroke">#0000FF</sld:CssParameter>
<sld:CssParameter name="stroke-width">1</sld:CssParameter>
<sld:CssParameter name="stroke-dasharray">11 29</sld:CssParameter>
</sld:Stroke>
Then each arrow will be 10 pixels long with a 30 pixel gap between them. The two values in the dash array indicate, respectively, the number of pixels pen-down, then number of pixels pen-up.
If you want to make the gap between arrows proportional to your map scale then you could try this:
<sld:Stroke>
<sld:CssParameter name="stroke">#0000FF</sld:CssParameter>
<sld:CssParameter name="stroke-width">1</sld:CssParameter>
<sld:CssParameter name="stroke-dasharray">11
<ogc:Div>
<ogc:Literal>377953</ogc:Literal>
<ogc:Function name="env">
<ogc:Literal>wms_scale_denominator</ogc:Literal>
</ogc:Function>
</ogc:Div>
</sld:CssParameter>
</sld:Stroke>
Which aims for approx 100m gaps.
Best Answer
The GeoServer documentations states how to extract start and end points with geometry transformations (just use the end- point rule). The code example provided uses
square
as marks, but you could always replace this with e.g. the shape symbolshape://oarrow
.EDIT: I forgot to mention how to rotate the triangle correctly (couldn't find it in the documentation, but took it from page 38 in this presentation)!
EDIT2: Just wanted to make sure everything works as described, here is a code sample based on GeoServer's default blue line SLD style:
This is how it should look like: