Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 5 down vote accepted

For labeling in WMS from geoserver, you will have to define <TextSymbolizer> 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:

               <CssParameter name="fill">#FF0000</CssParameter>
           <CssParameter name="fill">#000000</CssParameter>

For more complex examples go through this link:

share|improve this answer
If you need separate control of the point symbol and the point labels you should have two Layers in OL both pointing to the same published Layer in GeoServer but using two diferent SLD: one for rendering the point as <PointSymbolizer> and the other as TextSymbolizer. – Pedro Mendes Dec 23 '11 at 18:05

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.