Thursday, 8 October 2015

How to add labels to a WMS layer using OpenLayers and GeoServer?


I have point of data in mysql server. I am displaying this layer as WMS using OpenLayers and GeoServer. How can I add label to this layer?




Answer



For labeling in WMS from geoserver, you will have to define which determines what text to display in the label,i.e. the field in your attribute table of the point layer (eg. 'Name' in the following example). You can define font family, color, size, weight and placement of the label. A simple example of style description for points with label is as follows:







circle

#FF0000



6






#000000





For more complex examples go through this link:


http://docs.geoserver.org/stable/en/user/styling/sld-cookbook/points.html#point-with-styled-label


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...