geoserver可以为发布矢量图层并为矢量图层指定样式
geoserver使用sld文件编写图层样式
新建样式
可以自己编写样式,也可以使用QGIS导出的sld文件,上传后点击upload
选择图层,在指定的图层发布模块中选择对应的style样式
使用图片作为shp图层的样式
为面图层赋予样式
<?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>Default PolygonName> <UserStyle> <Title>A boring default styleTitle> <Abstract>A sample style that just prints out a transparent red interior with a red outlineAbstract> <FeatureTypeStyle> <Rule> <Name>Rule 1Name> <Title>RedFill RedOutlineTitle> <Abstract>50% transparent red fill with a red outline 1 pixel in widthAbstract> <PolygonSymbolizer> <Fill> <GraphicFill> <Graphic> <ExternalGraphic> <OnlineResource xlink:type="simple" xlink:href="ld.png" /> <Format>image/pngFormat> ExternalGraphic> <Size>20Size> Graphic> GraphicFill> Fill> <Stroke> <CssParameter name="stroke">#000000CssParameter> <CssParameter name="stroke-width">1CssParameter> Stroke> PolygonSymbolizer> Rule> FeatureTypeStyle> UserStyle> NamedLayer>StyledLayerDescriptor>
图片需要放置在指定文件夹下:
D:\GeoServer\GeoServer2.13.1\data_dir\workspaces\wzf\styles\images
图片格式可以修改(如png/jpeg)
图层标注在指定层级显示
<se:Rule> <se:MaxScaleDenominator>18000se:MaxScaleDenominator> <se:TextSymbolizer> <se:Label> <ogc:PropertyName>DLMCogc:PropertyName> se:Label> <se:Font> <se:SvgParameter name="font-family">SimSunse:SvgParameter> <se:SvgParameter name="font-size">13se:SvgParameter> se:Font> <se:LabelPlacement> <se:PointPlacement> <se:AnchorPoint> <se:AnchorPointX>0se:AnchorPointX> <se:AnchorPointY>0.5se:AnchorPointY> se:AnchorPoint> se:PointPlacement> se:LabelPlacement> <se:Fill> <se:SvgParameter name="fill">#000000se:SvgParameter> se:Fill> <se:VendorOption name="maxDisplacement">1se:VendorOption> se:TextSymbolizer> se:Rule>