地理服务器插值参数
Geoserver interpolation parameters
<?xml version="1.0"?>
<StyledLayerDescriptor 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" xmlns:gml="http://www.opengis.net/gml" version="1.0.0" xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd">
<NamedLayer>
<Name>USA states population</Name>
<UserStyle>
<Name>population</Name>
<Title>Population in the United States</Title>
<Abstract>A sample filter that filters the United States into three
categories of population, drawn in different colors</Abstract>
<FeatureTypeStyle>
<Rule>
<Title>< 2M</Title>
<PolygonSymbolizer>
<Fill>
<CssParameter name="fill">
<ogc:Function name="Interpolate">
<!-- Property to transform -->
<ogc:PropertyName>t_p</ogc:PropertyName>
<!-- Mapping curve definition pairs (input, output) -->
<ogc:Function name="env">
<ogc:Literal>interval1</ogc:Literal>
<ogc:Literal>685430</ogc:Literal>
</ogc:Function>
<ogc:Function name="env">
<ogc:Literal>color1</ogc:Literal>
<ogc:Literal>#06E852</ogc:Literal>
</ogc:Function>
<ogc:Function name="env">
<ogc:Literal>interval2</ogc:Literal>
<ogc:Literal>1000000</ogc:Literal>
</ogc:Function>
<ogc:Function name="env">
<ogc:Literal>color2</ogc:Literal>
<ogc:Literal>#FF0303</ogc:Literal>
</ogc:Function>
<!-- Interpolation method -->
<ogc:Literal>color</ogc:Literal>
<!-- Interpolation mode - defaults to linear -->
</ogc:Function>
</CssParameter>
</Fill>
</PolygonSymbolizer>
</Rule>
<Rule>
<Title>Boundary</Title>
<LineSymbolizer>
<Stroke>
<CssParameter name="stroke-width">0.2</CssParameter>
</Stroke>
</LineSymbolizer>
<TextSymbolizer>
<Label>
<ogc:PropertyName>label</ogc:PropertyName>
</Label>
<Halo>
<Radius>3</Radius>
<Fill>
<CssParameter name="fill">#FFFFFF</CssParameter>
</Fill>
</Halo>
<Font>
<CssParameter name="font-family">Times New Roman</CssParameter>
<CssParameter name="font-style">Normal</CssParameter>
<CssParameter name="font-size">14</CssParameter>
</Font>
<LabelPlacement>
<PointPlacement>
<AnchorPoint>
<AnchorPointX>0.5</AnchorPointX>
<AnchorPointY>0.5</AnchorPointY>
</AnchorPoint>
</PointPlacement>
</LabelPlacement>
</TextSymbolizer>
</Rule>
</FeatureTypeStyle>
</UserStyle>
</NamedLayer>
</StyledLayerDescriptor>
我层的 SLD 看起来像这样,其中我以两个 ogc 函数的形式给出了两个变量 minpop
和 maxpop
。
在此 SLD 中,我为变量赋值,这些值被用作 ogc 函数的参数,但 ogc 函数似乎无法正常工作。
我试过不在文字中包含环境,但颜色仍然不起作用?能否请您指出上述SLD中的错误?
通过将您的函数包含在 <Literal>
块中,您要求 GeoServer 将其用作文本。您的 XML 应如下所示:
<Fill>
<CssParameter name="fill">
<ogc:Function name="Interpolate">
<!-- Property to transform -->
<ogc:PropertyName>POP</ogc:PropertyName>
<!-- Mapping curve definition pairs (input, output) -->
<ogc:Function name="env">
<ogc:Literal>minpop</ogc:Literal>
<ogc:Literal>64000</ogc:Literal>
</ogc:Function>
<ogc:Literal>#06E852</ogc:Literal>
<ogc:Function name="env">
<ogc:Literal>maxpop</ogc:Literal>
<ogc:Literal>100000000</ogc:Literal>
</ogc:Function>
<ogc:Literal>#FF0303</ogc:Literal>
<!-- Interpolation method -->
<ogc:Literal>color</ogc:Literal>
<!-- Interpolation mode - defaults to linear -->
</ogc:Function>
</CssParameter>
</Fill>
<?xml version="1.0"?>
<StyledLayerDescriptor 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" xmlns:gml="http://www.opengis.net/gml" version="1.0.0" xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd">
<NamedLayer>
<Name>USA states population</Name>
<UserStyle>
<Name>population</Name>
<Title>Population in the United States</Title>
<Abstract>A sample filter that filters the United States into three
categories of population, drawn in different colors</Abstract>
<FeatureTypeStyle>
<Rule>
<Title>< 2M</Title>
<PolygonSymbolizer>
<Fill>
<CssParameter name="fill">
<ogc:Function name="Interpolate">
<!-- Property to transform -->
<ogc:PropertyName>t_p</ogc:PropertyName>
<!-- Mapping curve definition pairs (input, output) -->
<ogc:Function name="env">
<ogc:Literal>interval1</ogc:Literal>
<ogc:Literal>685430</ogc:Literal>
</ogc:Function>
<ogc:Function name="env">
<ogc:Literal>color1</ogc:Literal>
<ogc:Literal>#06E852</ogc:Literal>
</ogc:Function>
<ogc:Function name="env">
<ogc:Literal>interval2</ogc:Literal>
<ogc:Literal>1000000</ogc:Literal>
</ogc:Function>
<ogc:Function name="env">
<ogc:Literal>color2</ogc:Literal>
<ogc:Literal>#FF0303</ogc:Literal>
</ogc:Function>
<!-- Interpolation method -->
<ogc:Literal>color</ogc:Literal>
<!-- Interpolation mode - defaults to linear -->
</ogc:Function>
</CssParameter>
</Fill>
</PolygonSymbolizer>
</Rule>
<Rule>
<Title>Boundary</Title>
<LineSymbolizer>
<Stroke>
<CssParameter name="stroke-width">0.2</CssParameter>
</Stroke>
</LineSymbolizer>
<TextSymbolizer>
<Label>
<ogc:PropertyName>label</ogc:PropertyName>
</Label>
<Halo>
<Radius>3</Radius>
<Fill>
<CssParameter name="fill">#FFFFFF</CssParameter>
</Fill>
</Halo>
<Font>
<CssParameter name="font-family">Times New Roman</CssParameter>
<CssParameter name="font-style">Normal</CssParameter>
<CssParameter name="font-size">14</CssParameter>
</Font>
<LabelPlacement>
<PointPlacement>
<AnchorPoint>
<AnchorPointX>0.5</AnchorPointX>
<AnchorPointY>0.5</AnchorPointY>
</AnchorPoint>
</PointPlacement>
</LabelPlacement>
</TextSymbolizer>
</Rule>
</FeatureTypeStyle>
</UserStyle>
</NamedLayer>
</StyledLayerDescriptor>
我层的 SLD 看起来像这样,其中我以两个 ogc 函数的形式给出了两个变量 minpop
和 maxpop
。
在此 SLD 中,我为变量赋值,这些值被用作 ogc 函数的参数,但 ogc 函数似乎无法正常工作。
我试过不在文字中包含环境,但颜色仍然不起作用?能否请您指出上述SLD中的错误?
通过将您的函数包含在 <Literal>
块中,您要求 GeoServer 将其用作文本。您的 XML 应如下所示:
<Fill>
<CssParameter name="fill">
<ogc:Function name="Interpolate">
<!-- Property to transform -->
<ogc:PropertyName>POP</ogc:PropertyName>
<!-- Mapping curve definition pairs (input, output) -->
<ogc:Function name="env">
<ogc:Literal>minpop</ogc:Literal>
<ogc:Literal>64000</ogc:Literal>
</ogc:Function>
<ogc:Literal>#06E852</ogc:Literal>
<ogc:Function name="env">
<ogc:Literal>maxpop</ogc:Literal>
<ogc:Literal>100000000</ogc:Literal>
</ogc:Function>
<ogc:Literal>#FF0303</ogc:Literal>
<!-- Interpolation method -->
<ogc:Literal>color</ogc:Literal>
<!-- Interpolation mode - defaults to linear -->
</ogc:Function>
</CssParameter>
</Fill>