Sunday, 25 December 2016

Drawing arrow on line using SLD of GeoServer?


I have a line layer in geoserver as in the 1st image.


How can I draw an arrow on the line like in the 2nd image?


The line.rar includes a shapefile and a sld file.


Can edit a sample for me?


line.rar(download)


enter image description here enter image description here




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 symbol shape://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)!




the_geom



EDIT2: Just wanted to make sure everything works as described, here is a code sample based on GeoServer's default blue line SLD style:




xsi:schemaLocation="http://www.opengis.net/sld StyledLayerDescriptor.xsd"
xmlns="http://www.opengis.net/sld"
xmlns:ogc="http://www.opengis.net/ogc"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

Blue arrows


A blue line with end arrows


Blue_Arrow_Line


#0000FF
2






the_geom




shape://oarrow


#0000FF
0.5


#0000FF
2


30



the_geom











This is how it should look like:


Blue Arrow Example image


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...