GeoServer中使用SLD表现伪3D建筑

原文链接:pseudo-3D buildings in Geoserver
Pseudo-3D or 2.5D or 3/4 perspective can be done in Geoserver using isometric function.
GeoServer中使用SLD表现伪3D建筑
<FeatureTypeStyle>
  <Rule>
    <PolygonSymbolizer>
      <Geometry>
        <ogc:Function name="isometric">
          <ogc:PropertyName>geom</ogc:PropertyName>
          <ogc:Literal>7</ogc:Literal>
        </ogc:Function>
      </Geometry>
      <Fill>
        <CssParameter name="fill">#dddddd</CssParameter>
      </Fill>
      <Stroke>
        <CssParameter name="stroke">#999999</CssParameter>
      </Stroke>
    </PolygonSymbolizer>
  </Rule>
</FeatureTypeStyle>
房顶的样式
<FeatureTypeStyle>
  <Rule>
    <PolygonSymbolizer>
      <Geometry>
         <ogc:Function name="offset">
            <ogc:PropertyName>geom</ogc:PropertyName>
            <ogc:Literal>0</ogc:Literal>
            <ogc:Literal>7</ogc:Literal>
         </ogc:Function>
      </Geometry>
      <Fill>
        <CssParameter name="fill">#FFDCC7</CssParameter>
      </Fill>
      <Stroke>
        <CssParameter name="stroke">#999999</CssParameter>
      </Stroke>
    </PolygonSymbolizer>
  </Rule>
</FeatureTypeStyle>
完整的例子
<?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">
    <!-- a Named Layer is the basic building block of an SLD document -->
    <NamedLayer>
        <Name>default_polygon</Name>
        <UserStyle>
            <!-- Styles can have names, titles and abstracts -->
            <Title>Default Polygon</Title>
            <Abstract>A sample style that draws a polygon</Abstract>
            <!-- FeatureTypeStyles describe how to render different features -->
            <!-- A FeatureTypeStyle for rendering polygons -->
            <FeatureTypeStyle>
                <Rule>
                    <PolygonSymbolizer>
                        <Geometry>
                            <ogc:Function name="isometric">
                                <ogc:PropertyName>the_geom</ogc:PropertyName>
                                <ogc:Literal>5</ogc:Literal>
                            </ogc:Function>
                        </Geometry>
                        <Fill>
                            <CssParameter name="fill">#dddddd</CssParameter>
                        </Fill>
                        <Stroke>
                            <CssParameter name="stroke">#999999</CssParameter>
                            <CssParameter name="stroke-width">0.1</CssParameter>
                        </Stroke>
                    </PolygonSymbolizer>
                </Rule>
            </FeatureTypeStyle>
            <FeatureTypeStyle>
                <Rule>
                    <PolygonSymbolizer>
                        <Geometry>
                            <ogc:Function name="offset">
                                <ogc:PropertyName>the_geom</ogc:PropertyName>
                                <ogc:Literal>0</ogc:Literal>
                                <ogc:Literal>5</ogc:Literal>
                            </ogc:Function>
                        </Geometry>
                        <Fill>
                            <CssParameter name="fill">#cccccc</CssParameter>
                        </Fill>
                        <Stroke>
                            <CssParameter name="stroke">#999999</CssParameter>
                            <CssParameter name="stroke-width">0.1</CssParameter>
                        </Stroke>
                    </PolygonSymbolizer>
                </Rule>
            </FeatureTypeStyle>
        </UserStyle>
    </NamedLayer>
</StyledLayerDescriptor>

你可能感兴趣的:(Gis,geoserver,SLD)