2011년 7월 12일 화요일

[WPS] Basic & Advanced Statistics Process

WPS(Web Processing Service)를 활용하는 KOPSS(국토공간계획지원체계) 및 타 프로젝트에서 활용이 가능하도록 구성한 Basic & Advanced Statistics Process들

1. 개요
- GeoTools와 GeoServer에서 운영되도록 구성
- XML은 Custom PPIO를 확장
- GML은 GeoServer에서 지원하는 GML2, GML3를 지원
- FeatureCollection의 Output Format은 GML, Shape-zip, GeoJSON 외 KML을 확장
- 프로세스들은 ArcGIS와 결과값 비교함
 : 공간통계 프로세스들은 ArcGIS - Float연산, WPS - Double연산, 소숫점 6자리까지 오차 없음

2. WPS Process - Basic & Advanced Statistics

3. GeoServer WPS Request Builder에서 실행한 몇가지 샘플
◎ SA_Classify
○ Request

<?xml version="1.0" encoding="UTF-8"?>
<wps:Execute version="1.0.0" service="WPS" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.opengis.net/wps/1.0.0" xmlns:wfs="http://www.opengis.net/wfs" xmlns:wps="http://www.opengis.net/wps/1.0.0" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc" xmlns:wcs="http://www.opengis.net/wcs/1.1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xsi:schemaLocation="http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd">
  <ows:Identifier>kopss:SA_Classify</ows:Identifier>
  <wps:DataInputs>
    <wps:Input>
      <ows:Identifier>inputFeatures</ows:Identifier>
      <wps:Reference mimeType="text/xml; subtype=wfs-collection/1.0" xlink:href="http://geoserver/wfs" method="POST">
        <wps:Body>
          <wfs:GetFeature service="WFS" version="1.0.0" outputFormat="GML2">
            <wfs:Query typeName="cite:local_gi"/>
          </wfs:GetFeature>
        </wps:Body>
      </wps:Reference>
    </wps:Input>
    <wps:Input>
      <ows:Identifier>inputCoverages</ows:Identifier>
      <wps:Reference mimeType="image/tiff" xlink:href="http://geoserver/wcs" method="POST">
        <wps:Body/>
      </wps:Reference>
    </wps:Input>
    <wps:Input>
      <ows:Identifier>fieldName</ows:Identifier>
      <wps:Data>
        <wps:LiteralData>eve_cnt</wps:LiteralData>
      </wps:Data>
    </wps:Input>
    <wps:Input>
      <ows:Identifier>methodName</ows:Identifier>
      <wps:Data>
        <wps:LiteralData>NaturalBreaks</wps:LiteralData>
      </wps:Data>
    </wps:Input>
    <wps:Input>
      <ows:Identifier>numClasses</ows:Identifier>
      <wps:Data>
        <wps:LiteralData>6</wps:LiteralData>
      </wps:Data>
    </wps:Input>
  </wps:DataInputs>
  <wps:ResponseForm>
    <wps:RawDataOutput mimeType="text/xml">
      <ows:Identifier>result</ows:Identifier>
    </wps:RawDataOutput>
  </wps:ResponseForm>
</wps:Execute>


○ Response

◎ SA_StandardDeviationalEllipse
○ Request



<?xml version="1.0" encoding="UTF-8"?>
<wps:Execute version="1.0.0" service="WPS" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.opengis.net/wps/1.0.0" xmlns:wfs="http://www.opengis.net/wfs" xmlns:wps="http://www.opengis.net/wps/1.0.0" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc" xmlns:wcs="http://www.opengis.net/wcs/1.1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xsi:schemaLocation="http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd">
  <ows:Identifier>kopss:SA_StandardDeviationalEllipse</ows:Identifier>
  <wps:DataInputs>
    <wps:Input>
      <ows:Identifier>inputFeatures</ows:Identifier>
      <wps:Reference mimeType="text/xml; subtype=wfs-collection/1.0" xlink:href="http://geoserver/wfs" method="POST">
        <wps:Body>
          <wfs:GetFeature service="WFS" version="1.0.0" outputFormat="GML2">
            <wfs:Query typeName="cite:seoul_bp_apt"/>
          </wfs:GetFeature>
        </wps:Body>
      </wps:Reference>
    </wps:Input>
    <wps:Input>
      <ows:Identifier>ellipseSize</ows:Identifier>
      <wps:Data>
        <wps:LiteralData>1_STANDARD_DEVIATION</wps:LiteralData>
      </wps:Data>
    </wps:Input>
    <wps:Input>
      <ows:Identifier>caseField</ows:Identifier>
      <wps:Data>
        <wps:LiteralData>SGG_NM</wps:LiteralData>
      </wps:Data>
    </wps:Input>
  </wps:DataInputs>
  <wps:ResponseForm>
    <wps:RawDataOutput mimeType="text/xml; subtype=wfs-collection/1.0">
      <ows:Identifier>result</ows:Identifier>
    </wps:RawDataOutput>
  </wps:ResponseForm>
</wps:Execute>


○ Response
 - 결과는 GML을 선택했으며 caseField 를 시군구로 설정함
 - 아래 지도는 GML을 GeoTools를 이용하여 원본 데이터와 함께 지도화