geoserver中SLD样式 点 随比例尺缩放而变化

时间:2023-02-01 10:07:10

在小付同学的帮助下,完成了SLD样式中点随着比例尺缩放而变化的效果。

涉及的主要是三个属性,MAXSCALEDENOMINATOR,MINSCALEDENOMINATOR和SCALE。

另外,点的样式<WellKnownName>triangle</WellKnownName>,可以有circle,square,triangle,cross,X,star,等其他。

实现的整个点样式具体如下

 

geoserver中SLD样式 点 随比例尺缩放而变化geoserver中SLD样式 点 随比例尺缩放而变化sld样式
   
   
   
<? 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 > Simple point </ Name >
< UserStyle >
< Title > GeoServer SLD Cook Book: Simple point </ Title >
< FeatureTypeStyle >
< Rule >
< MaxScaleDenominator > 200000 </ MaxScaleDenominator >
< MinScaleDenominator > 150000 </ MinScaleDenominator >
< PointSymbolizer >
< Graphic >
< Mark >
< WellKnownName > triangle </ WellKnownName >
< Fill >
< CssParameter name ="fill" > #FF0000 </ CssParameter >
</ Fill >
</ Mark >
< Size > 4 </ Size >
</ Graphic >
</ PointSymbolizer >
</ Rule >
< Rule >
< MaxScaleDenominator > 150000 </ MaxScaleDenominator >
< MinScaleDenominator > 100000 </ MinScaleDenominator >
< PointSymbolizer >
< Graphic >
< Mark >
< WellKnownName > triangle </ WellKnownName >
< Fill >
< CssParameter name ="fill" > #FF0000 </ CssParameter >
</ Fill >
</ Mark >
< Size > 6 </ Size >
</ Graphic >
</ PointSymbolizer >
</ Rule >
< Rule >
< MaxScaleDenominator > 100000 </ MaxScaleDenominator >
< MinScaleDenominator > 50000 </ MinScaleDenominator >
< PointSymbolizer >
< Graphic >
< Mark >
< WellKnownName > triangle </ WellKnownName >
< Fill >
< CssParameter name ="fill" > #FF0000 </ CssParameter >
</ Fill >
</ Mark >
< Size > 8 </ Size >
</ Graphic >
</ PointSymbolizer >
</ Rule >
< Rule >
< MaxScaleDenominator > 50000 </ MaxScaleDenominator >
< MinScaleDenominator > 10000 </ MinScaleDenominator >
< PointSymbolizer >
< Graphic >
< Mark >
< WellKnownName > triangle </ WellKnownName >
< Fill >
< CssParameter name ="fill" > #FF0000 </ CssParameter >
</ Fill >
</ Mark >
< Size > 10 </ Size >
</ Graphic >
</ PointSymbolizer >
</ Rule >
< Rule >
< MaxScaleDenominator > 10000 </ MaxScaleDenominator >
< MinScaleDenominator > 5000 </ MinScaleDenominator >
< PointSymbolizer >
< Graphic >
< Mark >
< WellKnownName > triangle </ WellKnownName >
< Fill >
< CssParameter name ="fill" > #FF0000 </ CssParameter >
</ Fill >
</ Mark >
< Size > 12 </ Size >
</ Graphic >
</ PointSymbolizer >
</ Rule >
< Rule >
< MaxScaleDenominator > 5000 </ MaxScaleDenominator >
< MinScaleDenominator > 1000 </ MinScaleDenominator >
< PointSymbolizer >
< Graphic >
< Mark >
< WellKnownName > triangle </ WellKnownName >
< Fill >
< CssParameter name ="fill" > #FF0000 </ CssParameter >
</ Fill >
</ Mark >
< Size > 14 </ Size >
</ Graphic >
</ PointSymbolizer >
</ Rule >
</ FeatureTypeStyle >
</ UserStyle >
</ NamedLayer >
</ StyledLayerDescriptor >