แสดงบทความที่มีป้ายกำกับ SLD แสดงบทความทั้งหมด
แสดงบทความที่มีป้ายกำกับ SLD แสดงบทความทั้งหมด

วันพฤหัสบดีที่ 9 ตุลาคม พ.ศ. 2557

complex SLD

 <Rule>
          <Name>Point</Name>
          <ogc:Filter>
          <ogc:PropertyIsEqualTo>
            <ogc:PropertyName>nPOITYPEID</ogc:PropertyName>
            <ogc:Literal>10</ogc:Literal>
          </ogc:PropertyIsEqualTo>
          </ogc:Filter>
          <PointSymbolizer>
          <Geometry>
             <ogc:PropertyName>geom</ogc:PropertyName>
          </Geometry>
          <Graphic>
            <ExternalGraphic>
            <OnlineResource
              xmlns:xlink="http://www.w3.org/1999/xlink"
              xlink:type="simple"  
              xlink:href="file:D:\icon\cpall\${cIcon}"  />
            <Format>image/png</Format>
            </ExternalGraphic>
          </Graphic>
          </PointSymbolizer>
          <TextSymbolizer>
          <Label>
            <ogc:Function name="numberFormat">
            <ogc:Literal>@</ogc:Literal>
            <ogc:PropertyName>nCost</ogc:PropertyName>
            </ogc:Function>
          </Label>
          <Font>
            <CssParameter name="font-family">Serif</CssParameter>
            <CssParameter name="font-size">11</CssParameter>
            <CssParameter name="font-style">normal</CssParameter>
            <CssParameter name="font-weight">bold</CssParameter>
          </Font>
          <LabelPlacement>
            <PointPlacement>
            <AnchorPoint>
              <AnchorPointX>0.5</AnchorPointX> // 0 right, 0.5 middle, 1 left
              <AnchorPointY>0.5</AnchorPointY> // 0 top, 0.5 middle, 1 bottom
            </AnchorPoint>
            <Displacement>
              <DisplacementX>0</DisplacementX>
              <DisplacementY>-17</DisplacementY>
            </Displacement>
            </PointPlacement>
          </LabelPlacement>
          <Halo>
            <Fill>
            <CssParameter name="fill">#FFFFFF</CssParameter>
            </Fill>
          </Halo>
          <Fill>
            <CssParameter name="fill">#FF0000</CssParameter>
          </Fill>
          </TextSymbolizer>    
        </Rule>
        
          <Rule>
          <Name>Line</Name>
          <Title>Line</Title>
          <Abstract>Line style</Abstract>
          <ogc:Filter>
            <ogc:And>
              <ogc:PropertyIsEqualTo>
                <ogc:PropertyName>nPOITYPEID</ogc:PropertyName>
                <ogc:Literal>20</ogc:Literal>
              </ogc:PropertyIsEqualTo>
              <ogc:PropertyIsEqualTo>
                <ogc:Function name="geometryType">
                <ogc:PropertyName>cGeometryLine</ogc:PropertyName>
                </ogc:Function>
                <ogc:Literal>LineString</ogc:Literal>
              </ogc:PropertyIsEqualTo>
            </ogc:And>
          </ogc:Filter>
          <LineSymbolizer>
            <Geometry>
              <ogc:PropertyName>cGeometryLine</ogc:PropertyName>
            </Geometry>
            <Stroke>
              <CssParameter name="stroke">#14d9f6</CssParameter>
              <CssParameter name="stroke-opacity">0.35</CssParameter>
              <CssParameter name="stroke-width">3</CssParameter>
            </Stroke>
          </LineSymbolizer>
        </Rule>

Use symbols from an online resource

<?xml version="1.0" encoding="UTF-8"?>
<StyledLayerDescriptor version="1.0.0"
  xmlns="http://www.opengis.net/sld"
  xmlns:sld="http://www.opengis.net/sld"
  xmlns:ogc="http://www.opengis.net/ogc"
  xmlns:gml="http://www.opengis.net/gml"
  xmlns:xlink="http://www.w3.org/1999/xlink"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation=
    "http://www.opengis.net/sld
     http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd">
    <NamedLayer>
        <Name>POI Thailand</Name>
        <UserStyle>
            <Title>POI Thailand</Title>
            <Abstract>Point Of Interest</Abstract>
            <FeatureTypeStyle>
       
                <Rule>
                  <Name>GOVERNMENT</Name>
                  <Title>CityHall</Title>
                  <ogc:Filter>
                    <ogc:PropertyIsEqualTo>
                      <ogc:PropertyName>subclass1</ogc:PropertyName>
                      <ogc:Literal>1000</ogc:Literal>
                    </ogc:PropertyIsEqualTo>
                  </ogc:Filter>
                  <MinScaleDenominator>350001</MinScaleDenominator>
                  <MaxScaleDenominator>750000</MaxScaleDenominator>
                  <PointSymbolizer>
                    <Graphic>
                      <ExternalGraphic>
                         // เรียกบน local
                        <OnlineResource xlink:href="file:c:\icon
                         \scg\1000-1.png"/>
                        <Format>image/png</Format>
                      </ExternalGraphic>
                    </Graphic>
                  </PointSymbolizer>
                </Rule>   
                               
                <Rule>
                  <Name>Transportation</Name>
                  <Title>Railway Station</Title>
                  <ogc:Filter>
                    <ogc:PropertyIsEqualTo>
                      <ogc:PropertyName>subclass2</ogc:PropertyName>
                      <ogc:Literal>4024</ogc:Literal>
                    </ogc:PropertyIsEqualTo>
                  </ogc:Filter>
                  <MinScaleDenominator>0</MinScaleDenominator>
                  <MaxScaleDenominator>750000</MaxScaleDenominator>
                  <PointSymbolizer>
                    <Graphic>
                      <ExternalGraphic>
                        // เรียกจาก online
                        <OnlineResource xlink:href="https://svn.osgeo.org                            /qgis/branches/Version-1_0/images/svg/symbol                                   /Cross1.svg"/>
                        <Format>image/svg+xml</Format>
                      </ExternalGraphic>
                      <Size>15</Size>
                    </Graphic>
                  </PointSymbolizer>
                </Rule>

            </FeatureTypeStyle>
        </UserStyle>
    </NamedLayer>
</StyledLayerDescriptor>

วันพุธที่ 8 ตุลาคม พ.ศ. 2557

SLD Script the start and the end tags

<?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">
    <NamedLayer>
        <Name>Collection</Name>
        <UserStyle>
            <Title>Collection</Title>
            <Abstract>POINT LINE POLYGON CIRCLE</Abstract>
            <FeatureTypeStyle>
                .
                .
                .
                . 
               
            </FeatureTypeStyle>
        </UserStyle>
    </NamedLayer>
</StyledLayerDescriptor>

วันพุธที่ 30 มกราคม พ.ศ. 2556

Geoserver cut off point symbols

That's because of tiled requests.

A workaround would be to add a {singleTile: true} option at
OpenLayers.Layer.WMS instantiation.
2011/1/19 Robert Buckley <robertdbuck...@yahoo.com>:
> Hi,
>
> in my point SLD there are certain points which never get rendered fully.
> Either the circle is not rendered, or the labels are cut out.
>
>
> Is there a work-around for this behaviour?
>
> thanks,
>
> Rob
 
http://www.mail-archive.com/geoserver-users@lists.sourceforge.net/msg02916.html 


วันจันทร์ที่ 7 มกราคม พ.ศ. 2556

OGC Filter - การกำหนดเงือนไข

Equal
<ogc:Filter>
     <ogc:PropertyIsEqualTo>
          <ogc:PropertyName>Zone</ogc:PropertyName>
          <ogc:Literal>3</ogc:Literal>
     </ogc:PropertyIsEqualTo>
</ogc:Filter>

Less Than
<ogc:Filter>
     <ogc:PropertyIsLessThan>
          <ogc:PropertyName>Zone</ogc:PropertyName>
          <ogc:Literal>9</ogc:Literal>
     </ogc:PropertyIsLessThan>
</ogc:Filter>

Greater Than
<ogc:Filter>
     <ogc:PropertyIsGreaterThan>
          <ogc:PropertyName>Zone</ogc:PropertyName>
          <ogc:Literal>4</ogc:Literal>
     </ogc:PropertyIsGreaterThan>
</ogc:Filter>

Less Than or Equal
<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc" xmlns:gml="http://www.opengis.net/gml">
     <ogc:PropertyIsLessThanOrEqualTo>
          <ogc:PropertyName>propName</ogc:PropertyName>
          <ogc:Literal>5</ogc:Literal>
     </ogc:PropertyIsLessThanOrEqualTo>
</ogc:Filter>

Greater Than or Equal 
<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc" xmlns:gml="http://www.opengis.net/gml"> 
     <ogc:PropertyIsGreaterThanOrEqualTo>
          <ogc:PropertyName>propName</ogc:PropertyName>
          <ogc:Literal>5</ogc:Literal>
     </ogc:PropertyIsGreaterThanOrEqualTo>
</ogc:Filter>

Less Than and Greater Than
<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc" xmlns:gml="http://www.opengis.net/gml">
     <ogc:And>
          <ogc:PropertyIsLessThan>
               <ogc:PropertyName>propName</ogc:PropertyName>
               <ogc:Literal>25</ogc:Literal>
          </ogc:PropertyIsLessThan>
          <ogc:PropertyIsGreaterThan>
               <ogc:PropertyName>propName</ogc:PropertyName>
               <ogc:Literal>15</ogc:Literal>
          </ogc:PropertyIsGreaterThan>
     </ogc:And>
</ogc:Filter>

แสดง feature มากกว่า 1 ค่า เช่น แสดงพื้นที่ Zone 1 และ Zone 2
<ogc:Filter>
     <ogc:Or>
           <ogc:PropertyIsEqualTo>
                <ogc:PropertyName>Zone</ogc:PropertyName>
                <ogc:Literal>1</ogc:Literal>
           </ogc:PropertyIsEqualTo>
           <ogc:PropertyIsEqualTo>
                <ogc:PropertyName>Zone</ogc:PropertyName>
                <ogc:Literal>2</ogc:Literal>
           </ogc:PropertyIsEqualTo>
     </ogc:Or>
</ogc:Filter>

แสดง feature โดย feature นั้นจะต้องมีค่าทุกค่าตามที่ระบุในแต่ละ field
<ogc:Filter>
     <ogc:And>
           <ogc:PropertyIsEqualTo>
                <ogc:PropertyName>nPOITYPEID</ogc:PropertyName>
                <ogc:Literal>20</ogc:Literal>
           </ogc:PropertyIsEqualTo>
           <ogc:PropertyIsEqualTo>
                <ogc:PropertyName>LevelStyle</ogc:PropertyName>
                <ogc:Literal>1</ogc:Literal>
           </ogc:PropertyIsEqualTo>
           <ogc:PropertyIsGreaterThan>
                <ogc:PropertyName>nCost</ogc:PropertyName>
                <ogc:Literal>0</ogc:Literal>
           </ogc:PropertyIsGreaterThan>
     </ogc:And>
</ogc:Filter>

Specifying a range of values: 
<Filter>
     <And> 
          <PropertyIsGreaterThanOrEqualTo> 
               <PropertyName>ACRES</PropertyName> 
               <Literal>0.2</Literal> 
          </PropertyIsGreaterThanOrEqualTo> 
          <PropertyIsLessThanOrEqualTo> 
               <PropertyName>ACRES</PropertyName> 
               <Literal>0.99</Literal> 
          </PropertyIsLessThanOrEqualTo> 
     </And> 
</Filter>

Condition Select And OR
<Filter> 
     <And> 
          <PropertyIsEqualTo> 
               <PropertyName>TYPE</PropertyName> 
               <Literal>HIGH</Literal> 
          </PropertyIsEqualTo> 
          <Or> 
               <PropertyIsEqualTo> 
                    <PropertyName>CODE</PropertyName> 
                    <Literal>2</Literal> 
               </PropertyIsEqualTo> 
               <PropertyIsEqualTo> 
                    <PropertyName>CODE</PropertyName> 
                    <Literal>3</Literal> 
               </PropertyIsEqualTo> 
          </Or> 
     </And> 
</Filter>