geoserver之图片图标样式

geoserver之图片图标样式

 样式:

<?xml version="1.0" encoding="UTF-8"?>
<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>Red Square Point</Title>
      <Abstract>A sample style that draws a red square point</Abstract>
      <!-- FeatureTypeStyles describe how to render different features -->
      <!-- A FeatureTypeStyle for rendering points -->
      <FeatureTypeStyle>
        <Rule>
          <Name>rule1</Name>
          <Title>Red Square Point</Title>
          <Abstract>A 6 pixel square with a red fill and no stroke</Abstract>
            <PointSymbolizer>
              <Graphic>
                <ExternalGraphic xmlns="http://www.opengis.net/sld" xmlns:xlink="http://www.w3.org/1999/xlink">
                  <OnlineResource xlink:type="simple" xlink:href="project2.gif" />
                  <Format>image/gif</Format>
                </ExternalGraphic>
              <Size>25</Size>
            </Graphic>
          </PointSymbolizer>
        </Rule>
      </FeatureTypeStyle>
    </UserStyle>
  </NamedLayer>
</StyledLayerDescriptor>

注:图片需要转换为gif格式,经测试svg格式的图片会错误显示为灰色方块。

图片上传:

<ExternalGraphic xmlns="http://www.opengis.net/sld" xmlns:xlink="http://www.w3.org/1999/xlink">
                  <OnlineResource xlink:type="simple" xlink:href="project2.gif" />
                  <Format>image/gif</Format>
                </ExternalGraphic>

  将这部分代码删除,点击  insert Image,选择图片,确定。将在Graphic标签中自动生成代码。

 

 

 

 

 。。。。。。钻研不易,转载请注明出处。

 

posted @ 2025-03-14 15:05  莫小龙  阅读(108)  评论(0)    收藏  举报