`
cjx186
  • 浏览: 271956 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

GeoServer模仿GoogleMap风格写sld

    博客分类:
  • gis
 
阅读更多
Polygon:

<?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>masmap polygons</Name>
    <UserStyle>
      <Title>masmap polygons</Title>
      <Abstract>masmap polygons</Abstract>
      <FeatureTypeStyle>

        <Rule>
          <Name>park</Name>
          <ogc:Filter>
            <ogc:Or>
              <ogc:PropertyIsEqualTo>
              	<ogc:PropertyName>type</ogc:PropertyName>
              	<ogc:Literal>30</ogc:Literal>
              </ogc:PropertyIsEqualTo>
              <ogc:PropertyIsEqualTo>
              	<ogc:PropertyName>type</ogc:PropertyName>
              	<ogc:Literal>32</ogc:Literal>
              </ogc:PropertyIsEqualTo>
              <ogc:PropertyIsEqualTo>
              	<ogc:PropertyName>type</ogc:PropertyName>
              	<ogc:Literal>80</ogc:Literal>
              </ogc:PropertyIsEqualTo>
            </ogc:Or>
          </ogc:Filter>
          <PolygonSymbolizer>
            <Fill>
            	<CssParameter name="fill">#B5D29C</CssParameter>
            </Fill>
          </PolygonSymbolizer>
        </Rule>

        <Rule>
          <Name>building</Name>
          <ogc:Filter>
            <ogc:Or>
              <ogc:PropertyIsEqualTo>
              	<ogc:PropertyName>type</ogc:PropertyName>
              	<ogc:Literal>8</ogc:Literal>
              </ogc:PropertyIsEqualTo>
              <ogc:PropertyIsEqualTo>
              	<ogc:PropertyName>type</ogc:PropertyName>
              	<ogc:Literal>13</ogc:Literal>
              </ogc:PropertyIsEqualTo>
              <ogc:PropertyIsEqualTo>
              	<ogc:PropertyName>type</ogc:PropertyName>
              	<ogc:Literal>16</ogc:Literal>
              </ogc:PropertyIsEqualTo>
              <ogc:PropertyIsEqualTo>
              	<ogc:PropertyName>type</ogc:PropertyName>
              	<ogc:Literal>17</ogc:Literal>
              </ogc:PropertyIsEqualTo>
              <ogc:PropertyIsEqualTo>
              	<ogc:PropertyName>type</ogc:PropertyName>
              	<ogc:Literal>18</ogc:Literal>
              </ogc:PropertyIsEqualTo>
              <ogc:PropertyIsEqualTo>
              	<ogc:PropertyName>type</ogc:PropertyName>
              	<ogc:Literal>19</ogc:Literal>
              </ogc:PropertyIsEqualTo>
            </ogc:Or>
          </ogc:Filter>
          <PolygonSymbolizer>
            <Fill>
            	<CssParameter name="fill">#C6C5C2</CssParameter>
            </Fill>
            <Stroke>
            	<CssParameter name="stroke">#999999</CssParameter>
            	<CssParameter name="stroke-width">1</CssParameter>
            </Stroke>
          </PolygonSymbolizer>
        </Rule>

        <Rule>
          <Name>water</Name>
          <ogc:Filter>
            <ogc:Or>
              <ogc:PropertyIsEqualTo>
              	<ogc:PropertyName>type</ogc:PropertyName>
              	<ogc:Literal>73</ogc:Literal>
              </ogc:PropertyIsEqualTo>
              <ogc:PropertyIsBetween>
                <ogc:PropertyName>type</ogc:PropertyName>
                <ogc:LowerBoundary>
                	<ogc:Literal>50</ogc:Literal>
                </ogc:LowerBoundary>
                <ogc:UpperBoundary>
                	<ogc:Literal>79</ogc:Literal>
                </ogc:UpperBoundary>
              </ogc:PropertyIsBetween>
            </ogc:Or>
          </ogc:Filter>
          <PolygonSymbolizer>
            <Fill>
            	<CssParameter name="fill">#99B3CC</CssParameter>
            </Fill>
            <Stroke>
            	<CssParameter name="stroke">#99B3CC</CssParameter>
            	<CssParameter name="stroke-width">1</CssParameter>
            </Stroke>
          </PolygonSymbolizer>
        </Rule>

        <Rule>
          <Name>label</Name>
          <MaxScaleDenominator>31780</MaxScaleDenominator>
          <TextSymbolizer>
            <Label><ogc:PropertyName>label</ogc:PropertyName></Label>
            <Font>
            	<CssParameter name="font-family">Tahoma</CssParameter>
            	<CssParameter name="font-style">Normal</CssParameter>
            	<CssParameter name="font-size">10</CssParameter>
            </Font>
            <LabelPlacement>
            	<PointPlacement>
            		<AnchorPoint>
            			<AnchorPointX>0.5</AnchorPointX>
            			<AnchorPointY>0.5</AnchorPointY>
            		</AnchorPoint>
	            	<Displacement>
	            		<DisplacementX>0</DisplacementX>
	            		<DisplacementY>0</DisplacementY>
	            	</Displacement>
	            </PointPlacement>
	           </LabelPlacement>
            <Halo>
            	<Radius>
            		<ogc:Literal>2</ogc:Literal>
            	</Radius>
            	<Fill>
            		<CssParameter name="fill">#FFFFFF</CssParameter>
            		<CssParameter name="fill-opacity">0.85</CssParameter>
            	</Fill>
            </Halo>
            <Fill>
            	<CssParameter name="fill">#003366</CssParameter>
            </Fill>
            <VendorOption name="spaceAround">5</VendorOption>
            <VendorOption name="group">yes</VendorOption>
            <VendorOption name="autoWrap">75</VendorOption>
          </TextSymbolizer>
        </Rule>

      </FeatureTypeStyle>
    </UserStyle>
  </NamedLayer>
</StyledLayerDescriptor>
Roads:

<?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>masmap roads</Name>
    <UserStyle>
      <Title>masmap roads</Title>
      <Abstract>masmap roads</Abstract>
      <FeatureTypeStyle>

        <Rule>
          <Name>Text and polyline for major_highways</Name>
          <ogc:Filter>
            <ogc:PropertyIsBetween>
              <ogc:PropertyName>type</ogc:PropertyName>
              <ogc:LowerBoundary>
                <ogc:Literal>1</ogc:Literal>
              </ogc:LowerBoundary>
              <ogc:UpperBoundary>
                <ogc:Literal>3</ogc:Literal>
              </ogc:UpperBoundary>
            </ogc:PropertyIsBetween>
          </ogc:Filter>
          <LineSymbolizer>
            <Stroke>
              <CssParameter name="stroke">#FFC345</CssParameter>
              <CssParameter name="stroke-width">6</CssParameter>
              <CssParameter name="stroke-linecap">
                <ogc:Literal>butt</ogc:Literal>
              </CssParameter>
              <CssParameter name="stroke-linejoin">
                <ogc:Literal>miter</ogc:Literal>
              </CssParameter>
            </Stroke>
          </LineSymbolizer>
          <TextSymbolizer>
            <Label><ogc:PropertyName>label</ogc:PropertyName></Label>
            <Font>
              <CssParameter name="font-family">Tahoma</CssParameter>
              <CssParameter name="font-style">Normal</CssParameter>
              <CssParameter name="font-size">10</CssParameter>
            </Font>
            <LabelPlacement>
              <LinePlacement>
                <PerpendicularOffset>1</PerpendicularOffset>
              </LinePlacement>
            </LabelPlacement>
            <Halo>
              <Radius>
                <ogc:Literal>2</ogc:Literal>
              </Radius>
              <Fill>
                <CssParameter name="fill">#FFFFFF</CssParameter>
                <CssParameter name="fill-opacity">0.85</CssParameter>
              </Fill>
            </Halo>
            <Fill>
              <CssParameter name="fill">#000000</CssParameter>
            </Fill>
            <VendorOption name="group">yes</VendorOption>
            <VendorOption name="followLine">true</VendorOption>
          </TextSymbolizer>
        </Rule>

        <Rule>
          <Name>Text label for non highway</Name>
          <ogc:Filter>
            <ogc:PropertyIsBetween>
              <ogc:PropertyName>type</ogc:PropertyName>
              <ogc:LowerBoundary>
                <ogc:Literal>4</ogc:Literal>
              </ogc:LowerBoundary>
              <ogc:UpperBoundary>
                <ogc:Literal>22</ogc:Literal>
              </ogc:UpperBoundary>
            </ogc:PropertyIsBetween>
          </ogc:Filter>
          <TextSymbolizer>
            <Label><ogc:PropertyName>label</ogc:PropertyName></Label>
            <Font>
              <CssParameter name="font-family">Tahoma</CssParameter>
              <CssParameter name="font-style">Normal</CssParameter>
              <CssParameter name="font-size">9</CssParameter>
            </Font>
            <LabelPlacement>
              <LinePlacement>
                <PerpendicularOffset>1</PerpendicularOffset>
              </LinePlacement>
            </LabelPlacement>
            <Halo>
              <Radius>
                <ogc:Literal>2</ogc:Literal>
              </Radius>
              <Fill>
                <CssParameter name="fill">#FFFFFF</CssParameter>
                <CssParameter name="fill-opacity">0.85</CssParameter>
              </Fill>
            </Halo>
            <Fill>
              <CssParameter name="fill">#000000</CssParameter>
            </Fill>
            <VendorOption name="group">yes</VendorOption>
            <VendorOption name="followLine">true</VendorOption>
          </TextSymbolizer>
        </Rule>

        <Rule>
          <Name>0x05, 0x04, collector, arterial</Name>
          <ogc:Filter>
            <!-- 4 - 5 -->
            <ogc:PropertyIsBetween>
              <ogc:PropertyName>type</ogc:PropertyName>
              <ogc:LowerBoundary>
                <ogc:Literal>4</ogc:Literal>
              </ogc:LowerBoundary>
              <ogc:UpperBoundary>
                <ogc:Literal>5</ogc:Literal>
              </ogc:UpperBoundary>
            </ogc:PropertyIsBetween>
          </ogc:Filter>
          <LineSymbolizer>
            <Stroke>
              <CssParameter name="stroke">#FFFD8B</CssParameter>
              <CssParameter name="stroke-width">4</CssParameter>
              <CssParameter name="stroke-linecap">
                <ogc:Literal>butt</ogc:Literal>
              </CssParameter>
              <CssParameter name="stroke-linejoin">
                <ogc:Literal>miter</ogc:Literal>
              </CssParameter>
            </Stroke>
          </LineSymbolizer>
        </Rule>

        <Rule>
          <Name>0x09, 0x08, 0xc ramps, roundabouts</Name>
          <ogc:Filter>
            <!-- 8 - 12 -->
            <ogc:PropertyIsBetween>
              <ogc:PropertyName>type</ogc:PropertyName>
              <ogc:LowerBoundary>
                <ogc:Literal>8</ogc:Literal>
              </ogc:LowerBoundary>
              <ogc:UpperBoundary>
                <ogc:Literal>12</ogc:Literal>
              </ogc:UpperBoundary>
            </ogc:PropertyIsBetween>
          </ogc:Filter>
          <LineSymbolizer>
            <Stroke>
              <CssParameter name="stroke">#FFE068</CssParameter>
              <CssParameter name="stroke-width">4</CssParameter>
              <CssParameter name="stroke-linecap">
                <ogc:Literal>butt</ogc:Literal>
              </CssParameter>
              <CssParameter name="stroke-linejoin">
                <ogc:Literal>miter</ogc:Literal>
              </CssParameter>
            </Stroke>
          </LineSymbolizer>
        </Rule>

        <Rule>
          <Name>0x06_residential_road</Name>
          <ogc:Filter>
            <!-- 6 -->
            <ogc:PropertyIsEqualTo>
              <ogc:PropertyName>type</ogc:PropertyName>
              <ogc:Literal>6</ogc:Literal>
            </ogc:PropertyIsEqualTo>
          </ogc:Filter>
          <LineSymbolizer>
            <Stroke>
              <CssParameter name="stroke">#ffffff</CssParameter>
              <CssParameter name="stroke-width">2</CssParameter>
              <CssParameter name="stroke-linecap">
                <ogc:Literal>butt</ogc:Literal>
              </CssParameter>
              <CssParameter name="stroke-linejoin">
                <ogc:Literal>miter</ogc:Literal>
              </CssParameter>
            </Stroke>
          </LineSymbolizer>
        </Rule>

        <Rule>
          <Name>all else</Name>
          <ogc:Filter>
            <ogc:Or>
              <!-- 7 -->
              <ogc:PropertyIsEqualTo>
                <ogc:PropertyName>type</ogc:PropertyName>
                <ogc:Literal>7</ogc:Literal>
              </ogc:PropertyIsEqualTo>
              <!-- >12 -->
              <ogc:PropertyIsGreaterThan>
                <ogc:PropertyName>type</ogc:PropertyName>
                <ogc:Literal>13</ogc:Literal>
              </ogc:PropertyIsGreaterThan>
            </ogc:Or>
          </ogc:Filter>
          <LineSymbolizer>
            <Stroke>
              <CssParameter name="stroke">#999999</CssParameter>
              <CssParameter name="stroke-width">1</CssParameter>
              <CssParameter name="stroke-linecap">
                <ogc:Literal>butt</ogc:Literal>
              </CssParameter>
              <CssParameter name="stroke-linejoin">
                <ogc:Literal>miter</ogc:Literal>
              </CssParameter>
            </Stroke>
          </LineSymbolizer>
        </Rule>

      </FeatureTypeStyle>
    </UserStyle>
  </NamedLayer>
</StyledLayerDescriptor>
Road border:
<?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>masmap road border</Name>
    <UserStyle>
      <Title>masmap road border</Title>
      <Abstract>masmap road border</Abstract>
      <FeatureTypeStyle>

        <Rule>
          <Name>0x06_residential_road</Name>
          <ogc:Filter>
            <ogc:PropertyIsEqualTo>
              <ogc:PropertyName>type</ogc:PropertyName>
              <ogc:Literal>6</ogc:Literal>
            </ogc:PropertyIsEqualTo>
          </ogc:Filter>
          <LineSymbolizer>
            <Stroke>
              <CssParameter name="stroke">#999999</CssParameter>
              <CssParameter name="stroke-width">3</CssParameter>
              <CssParameter name="stroke-linecap">
              	<ogc:Literal>butt</ogc:Literal>
              </CssParameter>
              <CssParameter name="stroke-linejoin">
              	<ogc:Literal>miter</ogc:Literal>
              </CssParameter>
            </Stroke>
          </LineSymbolizer>
        </Rule>

        <Rule>
          <Name>0x05, 0x04, collector, arterial</Name>
          <ogc:Filter>
            <ogc:PropertyIsBetween>
              <ogc:PropertyName>type</ogc:PropertyName>
              <ogc:LowerBoundary>
              	<ogc:Literal>4</ogc:Literal>
              </ogc:LowerBoundary>
              <ogc:UpperBoundary>
              	<ogc:Literal>5</ogc:Literal>
              </ogc:UpperBoundary>
            </ogc:PropertyIsBetween>
          </ogc:Filter>
          <LineSymbolizer>
            <Stroke>
              <CssParameter name="stroke">#000000</CssParameter>
              <CssParameter name="stroke-width">5</CssParameter>
              <CssParameter name="stroke-linecap">
              	<ogc:Literal>butt</ogc:Literal>
              </CssParameter>
              <CssParameter name="stroke-linejoin">
              	<ogc:Literal>miter</ogc:Literal>
              </CssParameter>
            </Stroke>
          </LineSymbolizer>
        </Rule>

        <Rule>
          <Name>0x09, 0x08, 0xc ramps, roundabouts</Name>
          <ogc:Filter>
            <ogc:PropertyIsBetween>
              <ogc:PropertyName>type</ogc:PropertyName>
              <ogc:LowerBoundary>
              	<ogc:Literal>8</ogc:Literal>
              </ogc:LowerBoundary>
              <ogc:UpperBoundary>
              	<ogc:Literal>12</ogc:Literal>
              </ogc:UpperBoundary>
            </ogc:PropertyIsBetween>
          </ogc:Filter>
          <LineSymbolizer>
            <Stroke>
              <CssParameter name="stroke">#000000</CssParameter>
              <CssParameter name="stroke-width">5</CssParameter>
              <CssParameter name="stroke-linecap">
              	<ogc:Literal>butt</ogc:Literal>
              </CssParameter>
              <CssParameter name="stroke-linejoin">
              	<ogc:Literal>miter</ogc:Literal>
              </CssParameter>
            </Stroke>
          </LineSymbolizer>
        </Rule>

        <Rule>
          <Name>0x01, 0x02, 0x03 major_highways</Name>
          <ogc:Filter>
            <ogc:PropertyIsBetween>
              <ogc:PropertyName>type</ogc:PropertyName>
              <ogc:LowerBoundary>
              	<ogc:Literal>1</ogc:Literal>
              </ogc:LowerBoundary>
              <ogc:UpperBoundary>
              	<ogc:Literal>3</ogc:Literal>
              </ogc:UpperBoundary>
            </ogc:PropertyIsBetween>
          </ogc:Filter>
          <LineSymbolizer>
            <Stroke>
              <CssParameter name="stroke">#000000</CssParameter>
              <CssParameter name="stroke-width">7</CssParameter>
              <CssParameter name="stroke-linecap">
              	<ogc:Literal>butt</ogc:Literal>
              </CssParameter>
              <CssParameter name="stroke-linejoin">
              	<ogc:Literal>miter</ogc:Literal>
              </CssParameter>
            </Stroke>
          </LineSymbolizer>
        </Rule>

      </FeatureTypeStyle>
    </UserStyle>
  </NamedLayer>
</StyledLayerDescriptor>
合成后的风格
  • 大小: 149.5 KB
  • 大小: 31.6 KB
  • 大小: 170.7 KB
  • 大小: 274.1 KB
分享到:
评论

相关推荐

    同google map的geoserver用sld

    同google map的geoserver用sld geoserver用的,可以拿来学习,也可以直接使用,覆盖掉原先的geoserver自带的sld就可以了 画出来的效果不错的说o(∩_∩)o...

    geoserver中Google地图样式SLD.rar

    这个压缩包“geoserver中Google地图样式SLD.rar”显然是为GeoServer定制的,旨在模拟Google地图的风格,使得用户可以在GeoServer上看到与Google地图相似的视觉效果。 SLD(Styled Layer Descriptor)是OGC定义的一...

    google map 的sld标签

    在Google Map的场景下,仿造其SLD标签意味着我们要模仿Google的风格来创建自己的地图样式。例如,我们可以创建一个道路图层,设置不同级别的道路使用不同的颜色和宽度,主干道用深色粗线,小路则用浅色细线。同样,...

    使用geoserver SLD配置Google地图样式下载 (包含公路铁路等道路信息,公园绿化建筑等等 共24项),由于下载次数较多,所需积分上去了,我已下调

    本主题聚焦于如何使用GeoServer结合SLD(Styled Layer Descriptor)配置Google地图的样式,以便呈现包括公路、铁路在内的道路信息,以及公园绿化、建筑等多种地物要素。以下是对这个过程的详细解释: 1. **...

    geoServer_offline_map_data

    9. **集成其他服务**:GeoServer 可以与其他GIS服务(如Google Maps、OpenLayers等)集成,实现更丰富的地图应用功能。 10. **监控与性能优化**:定期监控 GeoServer 的性能,例如查看日志、监控资源使用情况,根据...

    仿照Google和Baidu的样式写出来的一些SLD样式表

    本资源"仿照Google和Baidu的样式写出来的一些SLD样式表"显然是为了帮助用户理解如何为GeoServer这样的地理服务器配置类似Google地图或百度地图的视觉样式。GeoServer是一款开源的GIS服务器,支持WMS(Web Map ...

    openLayers geoserver常见问题

    GeoServer集成Google Map可以通过添加Google Maps图层,或利用GeoExt等库实现。 GWC地图切片的缓存路径通常在GeoServer配置文件中设定。 实现地图查询,可以通过WFS服务结合前端交互,查询特定地理要素。 SLD文件...

    geoserver-2.17.2.zip

    GeoServer是GeoTools项目的一部分,基于Java技术栈,遵循开放地理空间联盟(OGC)的标准,如WMS(Web Map Service)、WFS(Web Feature Service)等。在本案例中,我们讨论的是GeoServer的2.17.2版本,这是该软件的...

    geoserver与OpenLayers配置入门

    4. **加上GOOGLEMAP图层**:为了提供更丰富的底图,可以集成Google Maps API。首先,需要在Google Developers Console中申请API Key,并将本地开发环境的IP地址添加到允许的来源列表。 5. **编辑HTML**:在HTML中...

    Geoserver用户手册

    4 GeoServer Data Directory 43 4.1 Creating a New Data Directory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 4.2 Setting the Data Directory . . . . . . . . . . . . . . . ...

    GeoServer地图开发解决方案.doc

    GeoServer 还兼容 WMS(Web Map Service)和 WFS(Web Feature Service)标准,使得地图服务可以通过网络以各种格式(如 JPEG、GIF、PNG、SVG 和 KML)提供给客户端。 GeoServer 的部署通常涉及以下几个步骤: 1. ...

    OpenLayers的地质灾害预警信息在线分析服务系统.zip

    1. **地图瓦片服务**:OpenLayers可以与各种地图瓦片服务集成,如Google Maps、OpenStreetMap、Bing Maps等,或者自定义瓦片服务。这些瓦片通常按照层级和坐标系统组织,以便在不同缩放级别下加载适当的地图细节。 ...

Global site tag (gtag.js) - Google Analytics