วันจันทร์ที่ 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>


ไม่มีความคิดเห็น:

แสดงความคิดเห็น