2

When publishing a WMS in geoserver using a custom SLD file, I'm seeing the WMS preview correctly on my local geoserver. However, doing everything the same on a remote hosted geoserver, my seeing an incorrect font family displayed.

Local geoserver version (open geo suite community edition) = Version 2.1-SNAPSHOT, Subversion Revision -1, Build Date 24-May-2012 21:47, GeoTools Version 2.7-SNAPSHOT (rev -1)

Remote geoserver version = Version: 2.1.4 Subversion Revision: 17150 Build Date: 01-Jun-2012 17:02 GeoTools Version: 2.7.5 (rev 38793)

What I’ve done:

  • I’ve downloaded and used an SLD file to style some points with some labels. I got the SLD from the Geoserver SLD cookbook here, modified the sld (code below) to read my shape file field ‘myname’ in the this shape file
  • I’ve added the sld in both the local and remote geoserver instances using the browse to file, upload, validate and submit options in the styles menu.
  • I’ve created a new workspace, datastore and published a WMS layer via both my local and remote Geoserver. I’ve selected the correct sld when publishing the layers.
  • The Problem = the remote Geoserver layer preview is not displaying the font family (arial) that is specified in my SLD file. See screeshots below of the previews from the local (correct font) and remote (incorrect font) geoservers respectively:

enter image description here enter image description here

<?xml version="1.0" encoding="ISO-8859-1"?>    
<StyledLayerDescriptor version="1.0.0" 
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">
<NamedLayer>
<Name>Point with styled label</Name>
<UserStyle>
<Title>GeoServer SLD Cook Book: Point with styled label</Title>
<FeatureTypeStyle>
<Rule>
<PointSymbolizer>
<Graphic>
<Mark>
<WellKnownName>circle</WellKnownName>
<Fill>
<CssParameter name="fill">#FF0000</CssParameter>
</Fill>
</Mark>
<Size>6</Size>
</Graphic>
</PointSymbolizer>
<TextSymbolizer>
<Label>
<ogc:PropertyName>myname</ogc:PropertyName>
</Label>
<Font>
<CssParameter name="font-family">Arial</CssParameter>
<CssParameter name="font-size">12</CssParameter>
<CssParameter name="font-style">normal</CssParameter>
<CssParameter name="font-weight">bold</CssParameter>
</Font>
<LabelPlacement>
<PointPlacement>
<AnchorPoint>
<AnchorPointX>0.5</AnchorPointX>
<AnchorPointY>0.0</AnchorPointY>
</AnchorPoint>
<Displacement>
<DisplacementX>0</DisplacementX>
<DisplacementY>5</DisplacementY>
</Displacement>
</PointPlacement>
</LabelPlacement>
<Fill>
<CssParameter name="fill">#000000</CssParameter>
</Fill>
</TextSymbolizer>
</Rule>
</FeatureTypeStyle>
</UserStyle>
</NamedLayer>
</StyledLayerDescriptor>

1 Answer 1

4

I think it's most likely due to the server not having the MS Windows fonts installed and available to the JVM. I think you can see a list of available fonts from the Server Status page of the GeoServer admin console.

You should also be able to install additional fonts, see How do I use custom fonts for labelling in Geoserver?.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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