场景
GeoServer简介、下载、配置启动、发布shapefile全流程(图文实践):
https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/109636080
geoserver在预览图层时,当发大图层时内容不显示。
比如文字text图层,放大到指定层级(比例尺变小时)不显示文字内容。
这是因为该图层对应的样式文件为自定义的Style,这个样式文件中未设置放大即比例尺缩小范围时对应的样式,
所以文字图层在该比例尺下不显示。
比例尺为预览时左下角的Scale = 1:5000
查看图层对应的样式文件,在图层-发布-WMS Setting-Deafult Style下
在Styles中找到该样式的具体代码
补充样式中缺失比例尺下的样式设置。
Geoserver的Style的样式中MinScaleDenominator与MaxScaleDenominator分别代表最小比例尺和最大比例尺下
的样式设置。
示例代码如下:
<Rule> <MinScaleDenominator>5000</MinScaleDenominator> <MaxScaleDenominator>11000</MaxScaleDenominator> <Name>rule1</Name> <Title>Red Square</Title> <Abstract>A 6 pixel square with a red fill and no stroke</Abstract> <PointSymbolizer> <Graphic> <Mark> <WellKnownName>square</WellKnownName> <Fill> <CssParameter name="fill">#CCCCCC</CssParameter> <CssParameter name="fill-opacity">0</CssParameter> </Fill> </Mark> <Size>6</Size> </Graphic> </PointSymbolizer> <TextSymbolizer> <Label> <ogc:PropertyName>TEXTSTRING</ogc:PropertyName> </Label> <Font> <CssParameter name="font-family">宋体</CssParameter> <CssParameter name="font-size">18</CssParameter> <CssParameter name="font-style">normal</CssParameter> <CssParameter name="font-weight">bold</CssParameter> </Font> <LabelPlacement> <PointPlacement> <Rotation> <ogc:PropertyName>TEXT_ANGLE</ogc:PropertyName> </Rotation> </PointPlacement> </LabelPlacement> <Fill> <CssParameter name="fill">#CCCCCC</CssParameter> </Fill> <VendorOption name="spaceAround">15</VendorOption> <VendorOption name="group">yes</VendorOption> <VendorOption name="autoWrap">200</VendorOption> <VendorOption name="maxDisplacement">5</VendorOption> </TextSymbolizer> </Rule>
比如这里的
<MinScaleDenominator>5000</MinScaleDenominator> <MaxScaleDenominator>11000</MaxScaleDenominator>
就代表设置比例尺在5000到11000下的样式。
具体样式的属性说明可自行搜索。
下面附完整样式示例:
<?xml version="1.0" encoding="GBK"?> <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"> <!-- a Named Layer is the basic building block of an SLD document --> <NamedLayer> <Name>default_point</Name> <UserStyle> <!-- Styles can have names, titles and abstracts --> <Title>Default Point</Title> <Abstract>A sample style that draws a point</Abstract> <!-- FeatureTypeStyles describe how to render different features --> <!-- A FeatureTypeStyle for rendering points --> <FeatureTypeStyle> <Rule> <MinScaleDenominator>11000</MinScaleDenominator> <MaxScaleDenominator>16500</MaxScaleDenominator> <Name>rule1</Name> <Title>Red Square</Title> <Abstract>A 6 pixel square with a red fill and no stroke</Abstract> <PointSymbolizer> <Graphic> <Mark> <WellKnownName>square</WellKnownName> <Fill> <CssParameter name="fill">#CCCCCC</CssParameter> <CssParameter name="fill-opacity">0</CssParameter> </Fill> </Mark> <Size>6</Size> </Graphic> </PointSymbolizer> <TextSymbolizer> <Label> <ogc:PropertyName>TEXTSTRING</ogc:PropertyName> </Label> <Font> <CssParameter name="font-family">宋体</CssParameter> <CssParameter name="font-size">16</CssParameter> <CssParameter name="font-style">normal</CssParameter> <CssParameter name="font-weight">bold</CssParameter> </Font> <LabelPlacement> <PointPlacement> <Rotation> <ogc:PropertyName>TEXT_ANGLE</ogc:PropertyName> </Rotation> </PointPlacement> </LabelPlacement> <Fill> <CssParameter name="fill">#CCCCCC</CssParameter> </Fill> <VendorOption name="spaceAround">15</VendorOption> <VendorOption name="group">yes</VendorOption> <VendorOption name="autoWrap">200</VendorOption> <VendorOption name="maxDisplacement">5</VendorOption> </TextSymbolizer> </Rule> <Rule> <MinScaleDenominator>5000</MinScaleDenominator> <MaxScaleDenominator>11000</MaxScaleDenominator> <Name>rule1</Name> <Title>Red Square</Title> <Abstract>A 6 pixel square with a red fill and no stroke</Abstract> <PointSymbolizer> <Graphic> <Mark> <WellKnownName>square</WellKnownName> <Fill> <CssParameter name="fill">#CCCCCC</CssParameter> <CssParameter name="fill-opacity">0</CssParameter> </Fill> </Mark> <Size>6</Size> </Graphic> </PointSymbolizer> <TextSymbolizer> <Label> <ogc:PropertyName>TEXTSTRING</ogc:PropertyName> </Label> <Font> <CssParameter name="font-family">宋体</CssParameter> <CssParameter name="font-size">18</CssParameter> <CssParameter name="font-style">normal</CssParameter> <CssParameter name="font-weight">bold</CssParameter> </Font> <LabelPlacement> <PointPlacement> <Rotation> <ogc:PropertyName>TEXT_ANGLE</ogc:PropertyName> </Rotation> </PointPlacement> </LabelPlacement> <Fill> <CssParameter name="fill">#CCCCCC</CssParameter> </Fill> <VendorOption name="spaceAround">15</VendorOption> <VendorOption name="group">yes</VendorOption> <VendorOption name="autoWrap">200</VendorOption> <VendorOption name="maxDisplacement">5</VendorOption> </TextSymbolizer> </Rule> <Rule> <MaxScaleDenominator>5000</MaxScaleDenominator> <Name>rule1</Name> <Title>Red Square</Title> <Abstract>A 6 pixel square with a red fill and no stroke</Abstract> <PointSymbolizer> <Graphic> <Mark> <WellKnownName>square</WellKnownName> <Fill> <CssParameter name="fill">#CCCCCC</CssParameter> <CssParameter name="fill-opacity">0</CssParameter> </Fill> </Mark> <Size>6</Size> </Graphic> </PointSymbolizer> <TextSymbolizer> <Label> <ogc:PropertyName>TEXTSTRING</ogc:PropertyName> </Label> <Font> <CssParameter name="font-family">宋体</CssParameter> <CssParameter name="font-size">22</CssParameter> <CssParameter name="font-style">normal</CssParameter> <CssParameter name="font-weight">bold</CssParameter> </Font> <LabelPlacement> <PointPlacement> <Rotation> <ogc:PropertyName>TEXT_ANGLE</ogc:PropertyName> </Rotation> </PointPlacement> </LabelPlacement> <Fill> <CssParameter name="fill">#CCCCCC</CssParameter> </Fill> <VendorOption name="spaceAround">15</VendorOption> <VendorOption name="group">yes</VendorOption> <VendorOption name="autoWrap">200</VendorOption> <VendorOption name="maxDisplacement">40</VendorOption> </TextSymbolizer> </Rule> <Rule> <MinScaleDenominator>16500</MinScaleDenominator> <MaxScaleDenominator>17500</MaxScaleDenominator> <Name>rule1</Name> <Title>Red Square</Title> <Abstract>A 6 pixel square with a red fill and no stroke</Abstract> <PointSymbolizer> <Graphic> <Mark> <WellKnownName>square</WellKnownName> <Fill> <CssParameter name="fill">#CCCCCC</CssParameter> <CssParameter name="fill-opacity">0</CssParameter> </Fill> </Mark> <Size>6</Size> </Graphic> </PointSymbolizer> <TextSymbolizer> <Label> <ogc:PropertyName>TEXTSTRING</ogc:PropertyName> </Label> <Font> <CssParameter name="font-family">宋体</CssParameter> <CssParameter name="font-size">12</CssParameter> <CssParameter name="font-style">normal</CssParameter> <CssParameter name="font-weight">bold</CssParameter> </Font> <LabelPlacement> <PointPlacement> <Rotation> <ogc:PropertyName>TEXT_ANGLE</ogc:PropertyName> </Rotation> </PointPlacement> </LabelPlacement> <Fill> <CssParameter name="fill">#CCCCCC</CssParameter> </Fill> <VendorOption name="spaceAround">25</VendorOption> <VendorOption name="group">yes</VendorOption> <VendorOption name="autoWrap">200</VendorOption> <VendorOption name="maxDisplacement">5</VendorOption> </TextSymbolizer> </Rule> <Rule> <MinScaleDenominator>17500</MinScaleDenominator> <MaxScaleDenominator>35000</MaxScaleDenominator> <Name>rule1</Name> <Title>Red Square</Title> <Abstract>A 6 pixel square with a red fill and no stroke</Abstract> <PointSymbolizer> <Graphic> <Mark> <WellKnownName>square</WellKnownName> <Fill> <CssParameter name="fill">#CCCCCC</CssParameter> <CssParameter name="fill-opacity">0</CssParameter> </Fill> </Mark> <Size>6</Size> </Graphic> </PointSymbolizer> <TextSymbolizer> <Label> <ogc:PropertyName>TEXTSTRING</ogc:PropertyName> </Label> <Font> <CssParameter name="font-family">宋体</CssParameter> <CssParameter name="font-size">10</CssParameter> <CssParameter name="font-style">normal</CssParameter> <CssParameter name="font-weight">bold</CssParameter> </Font> <LabelPlacement> <PointPlacement> <Rotation> <ogc:PropertyName>TEXT_ANGLE</ogc:PropertyName> </Rotation> </PointPlacement> </LabelPlacement> <Fill> <CssParameter name="fill">#CCCCCC</CssParameter> </Fill> <VendorOption name="spaceAround">25</VendorOption> <VendorOption name="group">yes</VendorOption> <VendorOption name="autoWrap">200</VendorOption> <VendorOption name="maxDisplacement">5</VendorOption> </TextSymbolizer> </Rule> <Rule> <MinScaleDenominator>35000</MinScaleDenominator> <MaxScaleDenominator>135000</MaxScaleDenominator> <Name>rule1</Name> <Title>Red Square</Title> <Abstract>A 6 pixel square with a red fill and no stroke</Abstract> <PointSymbolizer> <Graphic> <Mark> <WellKnownName>square</WellKnownName> <Fill> <CssParameter name="fill">#CCCCCC</CssParameter> <CssParameter name="fill-opacity">0</CssParameter> </Fill> </Mark> <Size>6</Size> </Graphic> </PointSymbolizer> <TextSymbolizer> <Label> <ogc:PropertyName>TEXTSTRING</ogc:PropertyName> </Label> <Font> <CssParameter name="font-family">宋体</CssParameter> <CssParameter name="font-size">8</CssParameter> <CssParameter name="font-style">normal</CssParameter> <CssParameter name="font-weight">bold</CssParameter> </Font> <LabelPlacement> <PointPlacement> <Rotation> <ogc:PropertyName>TEXT_ANGLE</ogc:PropertyName> </Rotation> </PointPlacement> </LabelPlacement> <Fill> <CssParameter name="fill">#CCCCCC</CssParameter> </Fill> <VendorOption name="spaceAround">25</VendorOption> <VendorOption name="group">yes</VendorOption> <VendorOption name="autoWrap">200</VendorOption> <VendorOption name="maxDisplacement">0</VendorOption> </TextSymbolizer> </Rule> </FeatureTypeStyle> </UserStyle> </NamedLayer> </StyledLayerDescriptor>
标签:Styles,square,样式,中未,宋体,CCCCCC,图层,比例尺 From: https://www.cnblogs.com/badaoliumangqizhi/p/16981796.html