본문 바로가기
GIS

WFS - Operations(1) : GetFeature, GetCapabilites

by 드로니뚜벅이 2023. 3. 21.

WFS(Web Feature Service)는 HTTP를 사용하여 인터넷에서 벡터 형식 지리 정보를 생성, 수정 및 교환하기 위해 OGC(Open Geospatial Consortium)에서 만든 표준입니다. WFS는 XML의 하위 집합인 GML(Geography Markup Language)로 정보를 인코딩하고 전송합니다.

WFS 표준은기본 데이터 소스와 독립적인 방식으로 개별 지리적 피쳐(feature)에 대한 액세스를 제공하고 트랜젝션을 지원하기 위한 프레임워크를 정의합니다. 검색, 쿼리, 잠금 및 트랜젝션 작업의 조합을 통해 사용자는 개별 피쳐를 조사, 스타일 지정, 편집(생성, 업데이트 및 삭제)하고 다운로드할 수 있는 방식으로 소스 공간 및 속성 데이터에 액세스할 수 있습니다. WFS의 트랜젝션 기능은 협업 매핑 응용 프로그램의 개발 및 배포도 지원합니다.

 

WFS 서버에서 제공할 수 있는 작업(Operation) 유형에 대해 자세히 알아 보겠습니다.

Operation Option Description
GetCapabilities   지원되는 작업, 매개변수 그리고 사용 가능한 피쳐 타입 목록을 포함하여 서비스에 대한 메타데이터를 검색합니다.
DescribeFeatureType   WFS 인스턴스에서 제공하거나 허용하는 피쳐 유형 및 피쳐 속성의 구조에 대한 설명을 전달합니다.
GetFeature   WFS를 통해 게시된(published) 데이터 저장소에서 선택한 피쳐 인스턴스를 전달합니다.
ListStoredQueries   WFS 인스턴스 내에 저장된 질의(queries) 목록을 전달합니다.
DescribeStoredQueries   WFS 인스턴스 내에 저장된  질의(queries)에 대한 설명을 전달합니다.
GetPropertyValue Optional 일련의 피쳐 인스턴스에 대한 피처 속성 값 혹은 복잡한 피쳐 속성 값의 일부를 검색합니다.
GetFeatureWithLock Optional GetFeature 요청과 유사한 기능을 제공하지만 아마도 후속 업데이트나 변경을 위해 기능을 피쳐를 잠그는 추가 기능입니다.
LockFeature Optional 일련의 피쳐 인스턴스를 잠궈서 잠금이 설정된 동안에는 다른 작업이 데이터를 수정할 수 없도도록 합니다.
Transaction Optional 피쳐 인스턴스와 속성을 수정하거나 삭제할 수 있게 합니다.
CreateStoreadQuery Optional 나중에 클라이언트가 빠르고 쉽게 트리거할 수 있는 쿼리를 생성하고 저장합니다.
DropStoredQuery Optional 이전에 저장된 쿼리를 서버에서 삭제합니다.

 

GetCapabilites

Request

GetCapabilites 요청에 응답하는 WFS 서버는 지원하는 작업, 매개변수 그리고 사용 가능한 피쳐 타입 목록을 포함하여 서비스에 대한 메타데이터를 전달합니다.

사용 예:

http://cite.deegree.org/deegree-webservices-3.4-RC3/services/wfs200?
SERVICE=WFS&
REQUEST=GetCapabilities&
VERSION=2.0.0

WFS 서버에 전달되는 세 가지 파라미터는 SERVICE=WFS, VERSION=2.0.0, 그리고 REQUEST=GetCapabilites입니다.

  • SERVICE 파라미터는 서버에 WFS 요청이 예정되어(forthcomign) 있음을 알립니다.
  • VERSION 파라미터는 요청 중인 서비스 버전을 서버에 알려줍니다.
  • REQEST 파라미터는 요처된 작업이 GetCapabilites 작업임을 서버에 알립니다.

WFS 표준에서는 요청이 항상 이 세 가지 파라미터가 포함하도록 요구합니다. 다음 표는 요청을 수행하는 데 필요한 파라미터와 값이 요약되어 있습니다.

Parameter Required Description
SERVICE Yes 서비스 이름, 값은 WFS
VERSION Yes 서비스 버전, 값은 1.0.0, 1.1.0, 2.0.0, 2.0.2 중 하나
REQUEST Yes 작업 이름. 값은 GetCapabilites

Response

응답은 WFS 서비스에 대한 자세한 설명이 포함된 Capabilites XML 문서입니다. 여기에는 세 가지 주요 섹션이 포함되어 있습니다.

Service 서비스명, 키워드, 서비스를 운영하는 조직의 연락 정보와 같은 서비스 메타데이터를 포함합니다.
FeatureTypeList 서비스에서 제공하느 피쳐 타입들을 나열하고 설명합니다.
Operations 서비스로부터 요청될 수 있는 사용가능한 작업을 나열합니다.

응답 예:

<WFS_Capabilities version="2.0.0" xmlns="http://www.opengis.net/wfs/2.0" xmlns:wfs="http://www.opengis.net/wfs/2.0" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:ogc="http://www.opengis.net/ogc" xmlns:fes="http://www.opengis.net/fes/2.0" 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/wfs/2.0 http://schemas.opengis.net/wfs/2.0/wfs.xsd">
  <ows:ServiceIdentification>
    <ows:Title>WFS 2.0.0 CITE Setup</ows:Title>
    <ows:Abstract></ows:Abstract>
    <ows:ServiceType codeSpace="http://www.opengeospatial.org/">WFS</ows:ServiceType>
    <ows:ServiceTypeVersion>2.0.0</ows:ServiceTypeVersion>
  </ows:ServiceIdentification>
  <ows:OperationsMetadata>
    <ows:Operation name="GetCapabilities">
      <ows:DCP>
        <ows:HTTP>
          <ows:Get xlink:href="http://cite.deegree.org/deegree-webservices-3.4-RC3/services/wfs200?"/>
          <ows:Post xlink:href="http://cite.deegree.org/deegree-webservices-3.4-RC3/services/wfs200"/>
        </ows:HTTP>
      </ows:DCP>
      <ows:Parameter name="AcceptVersions">
        <ows:AllowedValues>
          <ows:Value>2.0.0</ows:Value>
        </ows:AllowedValues>
      </ows:Parameter>
    </ows:Operation>
    <ows:Operation name="GetFeature">
      <ows:DCP>
        <ows:HTTP>
          <ows:Get xlink:href="http://cite.deegree.org/deegree-webservices-3.4-RC3/services/wfs200?"/>
          <ows:Post xlink:href="http://cite.deegree.org/deegree-webservices-3.4-RC3/services/wfs200"/>
        </ows:HTTP>
      </ows:DCP>
    </ows:Operation>
</ows:OperationsMetadata>
  <FeatureTypeList>
    <FeatureType>
      <Name xmlns:gn="urn:x-inspire:specification:gmlas:GeographicalNames:3.0">gn:NamedPlace</Name>
      <Title>gn:NamedPlace</Title>
      <DefaultCRS>urn:ogc:def:crs:EPSG::4326</DefaultCRS>
      <OutputFormats>
        <Format>application/xml; subtype="gml/3.2.1"</Format>
      </OutputFormats>
      <ows:WGS84BoundingBox>
        <ows:LowerCorner>-180.000000 -90.000000</ows:LowerCorner>
        <ows:UpperCorner>180.000000 90.000000</ows:UpperCorner>
      </ows:WGS84BoundingBox>
    </FeatureType>
    <FeatureType>
      <Name xmlns:ps="urn:x-inspire:specification:gmlas:ProtectedSites:3.0">ps:ProtectedSite</Name>
      <Title>ps:ProtectedSite</Title>
      <DefaultCRS>urn:ogc:def:crs:EPSG::4326</DefaultCRS>
      <OutputFormats>
        <Format>application/xml; subtype="gml/3.2.1"</Format>
      </OutputFormats>
      <ows:WGS84BoundingBox>
        <ows:LowerCorner>4.486395 51.604992</ows:LowerCorner>
        <ows:UpperCorner>5.928631 51.680515</ows:UpperCorner>
      </ows:WGS84BoundingBox>
    </FeatureType>
  </FeatureTypeList>
  <fes:Spatial_Capabilities>
    <fes:GeometryOperands xmlns:gml="http://www.opengis.net/gml" xmlns:gml32="http://www.opengis.net/gml">
      <fes:GeometryOperand name="gml:Box"/>
      <fes:GeometryOperand name="gml:Envelope"/>
      <fes:GeometryOperand name="gml:Point"/>
      <fes:GeometryOperand name="gml:LineString"/>
      <fes:GeometryOperand name="gml:Curve"/>
      <fes:GeometryOperand name="gml:Polygon"/>
    </fes:GeometryOperands>
    <fes:SpatialOperators>
      <fes:SpatialOperator name="BBOX"/>
      <fes:SpatialOperator name="Intersects"/>
      <fes:SpatialOperator name="Contains"/>
      <fes:SpatialOperator name="Beyond"/>
    </fes:SpatialOperators>
  </fes:Spatial_Capabilities>
</WFS_Capabilities>

 

GetFeature

GetFeature 요청에 응답하는 WFS 서버는 요청 클라이언트가 설정한 기준에 따라 필터링된 지리 피쳐 인스턴스 모음(collection)을 전달합니다.

HTTP GET 혹은 HTTP POST를 통해 요청을 보낼 수 있습니다. 단순화를 위해 다음 예제 요청은 HTTP GET을 통해서만 전송됩니다.

 

Request

가장 단순한 GetFeature 요청은 컨텐츠를 필터하기 위한 어떤 조건도 없이 피쳐 모음을 다운로드하는 요청입니다. 이러한 요청 타입의 예는 다음과 같습니다.

GetFeature 요청은 전달받을 지리적 피쳐들을 설명하는 일련의 파라미터로 서버에게 쿼리합니다. TYPENAMES 파라미터는 반환할 피쳐 인스턴스 모음을 결정합니다.

http://cite.deegree.org/deegree-webservices-3.4-RC3/services/wfs200?
SERVICE=WFS&
VERSION=2.0.0&
REQUEST=GetFeature&
TYPENAMES=ps:ProtectedSite

 

Response

<wfs:FeatureCollection
   timeStamp="2017-09-21T18:59:13"
   numberMatched="16"
   numberReturned="16"
   next="https://wfst.axl.aero/AxlRest/wfs?SERVICE=WFS&amp;VERSION=2.0.2&amp;REQUEST=GetFeature&amp;TYPENAMES=ps:ProtectedSite&amp;STARTINDEX=2&amp;COUNT=1"
   xmlns:gts="http://www.isotc211.org/2005/gts"
   xmlns:wfs="http://www.opengis.net/wfs/2.0"
   xmlns:sch="http://purl.oclc.org/dsdl/schematron"
   xmlns:xml="http://www.w3.org/XML/1998/namespace"
   xmlns:base="urn:x-inspire:specification:gmlas:BaseTypes:3.2"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:gco="http://www.isotc211.org/2005/gco"
   xmlns:fes="http://www.opengis.net/fes/2.0"
   xmlns:xlink="http://www.w3.org/1999/xlink"
   xmlns:xs="http://www.w3.org/2001/XMLSchema"
   xmlns:ows="http://www.opengis.net/ows/1.1"
   xmlns:gmx="http://www.isotc211.org/2005/gmx"
   xmlns:gss="http://www.isotc211.org/2005/gss"
   xmlns:ps="urn:x-inspire:specification:gmlas:ProtectedSites:3.0"
   xmlns:gsr="http://www.isotc211.org/2005/gsr"
   xmlns:gn="urn:x-inspire:specification:gmlas:GeographicalNames:3.0"
   xmlns:smil20="http://www.w3.org/2001/SMIL20/"
   xmlns:sqm="http://axl.avitech.aero/aviWfsSqm/1.0"
   xmlns:gml="http://www.opengis.net/gml/3.2"
   xmlns:smil20lang="http://www.w3.org/2001/SMIL20/Language"
   xmlns:gmd="http://www.isotc211.org/2005/gmd"
   xsi:schemaLocation="http://www.opengis.net/wfs/2.0 http://schemas.opengis.net/wfs/2.0/wfs.xsd http://www.opengis.net/gml/3.2 http://schemas.opengis.net/gml/3.2.1/gml.xsd">
<wfs:member xmlns:wfs="http://www.opengis.net/wfs/2.0">
  <!-- oldId=none ;oldTime=1487178040 ; oldExpiry=0 ;  ; currentTime=1506020133 ; expired=true;-->
  <ps:ProtectedSite xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:ps="urn:x-inspire:specification:gmlas:ProtectedSites:3.0" gml:id="PS_PROTECTEDSITE_16cbb8db-cce1-4e8b-8733-83d53a910ebe">
...
  </ps:ProtectedSite>
</wfs:member></wfs:FeatureCollection>

 

Count paramenter

추가 파라미터를 추가하여 WFS 의 응답을 필터링하거나 변환할 수 있습니다. 아래에서 소개할 다른 파라미터를 포함하여 파라미터 값을 지정하는 데 필요한 정보는 피쳐 문서에서 얻을 수 있습니다.

위의 GetFeature 요청에 추가 파라미터를 포함하려면 URL 끝에 앰퍼샌드(&)를 추가한 다음 파라미터 이름, 등호(=) 및 파라미터에 할당할 값을 추가하세요. 예를 들어, 다음 GetFeautre 요청은 서버에서 반환되는 피쳐 수를 단을 피쳐 인스턴스로 제한합니다. 응답을 제한하는 숫자는 count 매개변수의 값으로 결정됩니다.

https://wfst.axl.aero/AxlRest/wfs?
service=WFS&
version=2.0.0&
request=GetFeature&
TypeNames=ps:ProtectedSite&
count=1

위 요청에 대해 생성된 응답은 아래와 같습니다. 반환된 피쳐 인스턴스의 수는 1 입니다. (루트 wfs:FeatureCollection 요소의 nuberReturned 특성으로 표시됩니다)

<wfs:FeatureCollection
   timeStamp="2017-09-21T18:55:33"
   numberMatched="16"
   numberReturned="1"
   next="https://wfst.axl.aero/AxlRest/wfs?SERVICE=WFS&amp;VERSION=2.0.2&amp;REQUEST=GetFeature&amp;TYPENAMES=ps:ProtectedSite&amp;STARTINDEX=2&amp;COUNT=1"
   xmlns:gts="http://www.isotc211.org/2005/gts"
   xmlns:wfs="http://www.opengis.net/wfs/2.0"
   xmlns:sch="http://purl.oclc.org/dsdl/schematron"
   xmlns:xml="http://www.w3.org/XML/1998/namespace"
   xmlns:base="urn:x-inspire:specification:gmlas:BaseTypes:3.2"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:gco="http://www.isotc211.org/2005/gco"
   xmlns:fes="http://www.opengis.net/fes/2.0"
   xmlns:xlink="http://www.w3.org/1999/xlink"
   xmlns:xs="http://www.w3.org/2001/XMLSchema"
   xmlns:ows="http://www.opengis.net/ows/1.1"
   xmlns:gmx="http://www.isotc211.org/2005/gmx"
   xmlns:gss="http://www.isotc211.org/2005/gss"
   xmlns:ps="urn:x-inspire:specification:gmlas:ProtectedSites:3.0"
   xmlns:gsr="http://www.isotc211.org/2005/gsr"
   xmlns:gn="urn:x-inspire:specification:gmlas:GeographicalNames:3.0"
   xmlns:smil20="http://www.w3.org/2001/SMIL20/"
   xmlns:sqm="http://axl.avitech.aero/aviWfsSqm/1.0"
   xmlns:gml="http://www.opengis.net/gml/3.2"
   xmlns:smil20lang="http://www.w3.org/2001/SMIL20/Language"
   xmlns:gmd="http://www.isotc211.org/2005/gmd"
   xsi:schemaLocation="http://www.opengis.net/wfs/2.0 http://schemas.opengis.net/wfs/2.0/wfs.xsd http://www.opengis.net/gml/3.2 http://schemas.opengis.net/gml/3.2.1/gml.xsd">
<wfs:member xmlns:wfs="http://www.opengis.net/wfs/2.0">
  <!-- oldId=none ;oldTime=1487178040 ; oldExpiry=0 ;  ; currentTime=1506020133 ; expired=true;-->
  <ps:ProtectedSite xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:ps="urn:x-inspire:specification:gmlas:ProtectedSites:3.0" gml:id="PS_PROTECTEDSITE_16cbb8db-cce1-4e8b-8733-83d53a910ebe">
    <gml:name>ProtectedSite1</gml:name>
    <ps:geometry>
      <gml:MultiSurface gml:id="PS_PROTECTEDSITE_16cbb8db-cce1-4e8b-8733-83d53a910ebe_PS_GEOMETRY" srsName="urn:ogc:def:crs:EPSG::4326">
        <gml:surfaceMember>
          <gml:Polygon gml:id="GEOMETRY_7fd8f3e7-d283-4ce5-9722-e612bf465a3b" srsName="urn:ogc:def:crs:EPSG::4326">
            <gml:exterior>
              <gml:LinearRing>
                <gml:posList>
                  51.628734 5.507951 51.629015 5.508402 51.629694 5.507409 51.628721 5.507150 51.628734 5.507951
                </gml:posList>
              </gml:LinearRing>
            </gml:exterior>
          </gml:Polygon>
        </gml:surfaceMember>
      </gml:MultiSurface>
    </ps:geometry>
    <ps:inspireID>
      <base:Identifier>
        <base:localId>FB8DCB4E-03BB-4E8A-BB9D-04A44295DF58</base:localId>
        <base:namespace>NL.9930.EHS</base:namespace>
      </base:Identifier>
    </ps:inspireID>
    <ps:siteDesignation>
      <ps:DesignationType>
        <ps:designationScheme>ecologischeHoofdstructuur</ps:designationScheme>
        <ps:designation>ecologischeHoofdstructuur</ps:designation>
        <ps:percentageUnderDesignation>100</ps:percentageUnderDesignation>
      </ps:DesignationType>
    </ps:siteDesignation>
  </ps:ProtectedSite>
</wfs:member></wfs:FeatureCollection>

 

Bounding Box (BBOX) parameter

GetFeature 요청에 추가할 수 있는 또 다른 파라미터는 경계상자(BBOX)의 파라미터입니다. 이 파라미터는 반횐되어야 할  피쳐 인스턴스의 최소 및 최대 경계 좌표를 나타내는 컴마(,)로 구분된 네 개의 숫자 목록입니다. 즉, 사용자 정의 좌표 상자 안에 포함된(혹은 부분적으로 포함된) 피쳐를 검색할 수 있습니다. BBOX의 어느 모서리를 지정할 것인지에 대한 유일한 요구 사항은 맨 아래 모서리(왼쪽 혹은 오른쪽)가 먼저 제공되어야 한다는 것입니다. BBOX 파라미터 사용 예는 아래와 같습니다.

사용 예:

http://cite.deegree.org/deegree-webservices-3.4-RC3/services/wfs200?service=WFS&version=2.0.0&request=GetFeature&TypeNames=ps:ProtectedSite&BBOX=51.607317,5.106151,51.629884,5.228022

위 요청에 대한 반환된 응답은 아래와 같습니다. 간결함을 위해 응답 내용 중 필요한 일부만에 표시합니다.

<wfs:FeatureCollection xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wfs="http://www.opengis.net/wfs/2.0" timeStamp="2017-09-21T18:14:50Z" xmlns:gml="http://www.opengis.net/gml/3.2" numberMatched="1" numberReturned="1">
<wfs:member>
<ps:ProtectedSite xmlns:ps="urn:x-inspire:specification:gmlas:ProtectedSites:3.0" gml:id="PS_PROTECTEDSITE_a367af0b-9457-4445-9cbd-eb48ae7a844a">
...
</ps:ProtectedSite>
</wfs:member>
</wfs:FeatureCollection>

 

PropertyName parameter

이 파라미터는 지정된 속성만 포함된 피쳐 인스터스를 반환합니다. 이 기능은 여러 속성이 있는 피쳐 타입이 대역폭이 제한된 네트워크를 통해 제공되는 상황에서 특히 유용합니다. 클라이언트 응용프로그램은 피쳐 인스턴스 내에서 반환하려는 속성을 고르고(pick) 선택할 수 있습니다. 이 파라미터의 사용 예는 아래와 같습니다.

https://services.interactive-instruments.de/ogc-reference/simple/wfs?version=2.0.0&request=getfeature&service=wfs&typenames=ci:City&count=3&propertyName=inhabitants

위 요청에 의해 반환된 응답은 아래와 같습니다.

<wfs:FeatureCollection timeStamp="2017-09-21T21:17:32.296+02:00" numberReturned="3" numberMatched="unknown" xmlns="http://www.interactive-instruments.de/namespaces/demo/cities/4.1/cities" xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:wfs="http://www.opengis.net/wfs/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<wfs:member>
<City gml:id="City.10">
<location>
<gml:Point gml:id="city.id.10.location.Geom_0" srsName="urn:ogc:def:crs:EPSG::25832" srsDimension="2">
<gml:pos>486890.340 5881020.962</gml:pos>
</gml:Point>
</location>
<inhabitants>547300</inhabitants>
</City>
</wfs:member>
<wfs:member>
<City gml:id="City.11">
<location>
<gml:Point gml:id="city.id.11.location.Geom_0" srsName="urn:ogc:def:crs:EPSG::25832" srsDimension="2">
<gml:pos>364883.268 5620035.394</gml:pos>
</gml:Point>
</location>
<inhabitants>324800</inhabitants>
</City>
</wfs:member>
<wfs:member>
<City gml:id="City.9">
<location>
<gml:Point gml:id="city.id.9.location.Geom_0" srsName="urn:ogc:def:crs:EPSG::25832" srsDimension="2">
<gml:pos>361905.275 5702287.179</gml:pos>
</gml:Point>
</location>
<inhabitants>574600</inhabitants>
</City>
</wfs:member>
</wfs:FeatureCollection>

 

sortBy parameter

WFS 요청에 대해 반환된 결과는 sortBy 파라미터를 통해 특정 순서로 구성할 수도 있습니다. 이 파라미터는 지정된 파라미터에 의해 결정된 순서로 피쳐 인스턴스를 반환합니다. 이 기능은 피쳐 유형에 수량 혹은 인구(populations)를 나타내는 속성이 있는 상황에서 특히 유용합니다. 이 파라미터를 사용하는 사용 예는 아래와 같습니다.

https://services.interactive-instruments.de/ogc-reference/simple/wfs?version=2.0.0&request=getfeature&service=wfs&typenames=ci:City&sortBy=inhabitants&propertyName=inhabitants

위 요청에 대한 응답 결과는 아래와 같습니다. 일부 내용은 간결함을 위해 생략했습니다.

<?xml version="1.0" encoding="utf-8"?>
<wfs:FeatureCollection timeStamp="2017-09-21T21:17:32.296+02:00" numberReturned="11" numberMatched="unknown" xmlns="http://www.interactive-instruments.de/namespaces/demo/cities/4.1/cities" xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:wfs="http://www.opengis.net/wfs/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<wfs:member>
<City gml:id="City.11">
<location>
<gml:Point gml:id="city.id.11.location.Geom_0" srsName="urn:ogc:def:crs:EPSG::25832" srsDimension="2">
<gml:pos>364883.268 5620035.394</gml:pos>
</gml:Point>
</location>
<inhabitants>324800</inhabitants>
</City>
</wfs:member>
<wfs:member>
<City gml:id="City.10">
<location>
<gml:Point gml:id="city.id.10.location.Geom_0" srsName="urn:ogc:def:crs:EPSG::25832" srsDimension="2">
<gml:pos>486890.340 5881020.962</gml:pos>
</gml:Point>
</location>
<inhabitants>547300</inhabitants>
</City>
</wfs:member>
<wfs:member>
<City gml:id="City.9">
<location>
<gml:Point gml:id="city.id.9.location.Geom_0" srsName="urn:ogc:def:crs:EPSG::25832" srsDimension="2">
<gml:pos>361905.275 5702287.179</gml:pos>
</gml:Point>
</location>
<inhabitants>574600</inhabitants>
</City>
</wfs:member>
</wfs:FeatureCollection>

 

srsName parameter

이 파라미터는 피쳐 지오메트리(형상)를 인코딩할 공간 참조 시스템을 지정하는 데 사용됩니다. 각 기능 유형에 허용되는 공간 참조 시스템은 GetCapabilities 응답에서 식별할 수 있습니다.

https://services.interactive-instruments.de/ogc-reference/simple/wfs?version=2.0.0&request=getfeature&service=wfs&typenames=ci:City&count=1&srsName=urn:ogc:def:crs:EPSG::4326

위 요청에 대한 응답 결과는 아래와 같습니다. 일부 내용은 간결함을 위해 생략했습니다.

<wfs:FeatureCollection timeStamp="2017-09-21T21:26:02.213+02:00" numberReturned="1" numberMatched="unknown" xmlns="http://www.interactive-instruments.de/namespaces/demo/cities/4.1/cities" xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:wfs="http://www.opengis.net/wfs/2.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<wfs:boundedBy>
<gml:Envelope srsName="urn:ogc:def:crs:EPSG::4326" srsDimension="2">
<gml:lowerCorner>52.521400003005 13.405700006106</gml:lowerCorner>
<gml:upperCorner>52.521400003005 13.405700006106</gml:upperCorner>
</gml:Envelope>
</wfs:boundedBy>
<wfs:member>
<City gml:id="City.1">
<name>Berlin</name>
<location>
<gml:Point gml:id="city.id.1.location.Geom_0" srsName="urn:ogc:def:crs:EPSG::4326" srsDimension="2">
<gml:pos>52.521400003005 13.405700006106</gml:pos>
</gml:Point>
</location>
<country>Germany</country>
<inhabitants>3460700</inhabitants>
<lzi>2011-03-17T15:32:54Z</lzi>
<function>capital</function>
</City>
</wfs:member>
</wfs:FeatureCollection>

 

featureId parameter

이 파라미터는 요청에 의해 반환될 피쳐들을 필터하기 위해 사용됩니다.

http://localhost:8080/geoserver/wfs?
request=GetFeature&
version=2.0.0&
typeName=topp:states&
FEATUREID=states.3

위 요청에 대한 응답 결과는 아래와 같습니다. 일부 내용은 간결함을 위해 생략했습니다.

<wfs:FeatureCollection xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:wfs="http://www.opengis.net/wfs/2.0" xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:topp="http://www.openplans.org/topp" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" numberMatched="1" numberReturned="1" timeStamp="2017-09-21T19:38:52.788Z">
<wfs:member>
<topp:states gml:id="states.3">
<topp:the_geom>
<gml:MultiSurface srsName="urn:ogc:def:crs:EPSG::4326" srsDimension="2">
<gml:surfaceMember><gml:Polygon><gml:exterior><gml:LinearRing><gml:posList>38.557476 -75.70742 38.649551 -75.71106 38.83017 -75.724937 39.141548 -75.752922 39.247753 -75.761658 38.450451 -75.093094 38.455208 -75.350204 38.463066 -75.69915 38.557476 -75.70742</gml:posList></gml:LinearRing></gml:exterior></gml:Polygon></gml:surfaceMember>
</gml:MultiSurface>
</topp:the_geom>
<topp:STATE_NAME>Delaware</topp:STATE_NAME>
<topp:SAMP_POP>102776.0</topp:SAMP_POP>
</topp:states>
</wfs:member>
</wfs:FeatureCollection>

 

query action

지금까지는 HTTP GET 메서드를 통해 URL로 전송되는 GetFeature 요청 예제만 제시했습니다. HTTP POST 방식을 통해 요청 본문을 XML 문서로 보낼 수도 있습니다.

다음은 쿼리 작업을 포하하고 HTTP POST 메서드를 통해 전송되는 GetFeature 요청의 예입니다.

<wfs:GetFeature service="WFS" version="2.0.0"
    xmlns:wfs="http://www.opengis.net/wfs/2.0" xmlns:ci="http://www.interactive-instruments.de/namespaces/demo/cities/4.1/cities" xmlns:fes="http://www.opengis.net/fes/2.0"
    xmlns:sf="http://www.openplans.org/spearfish" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.opengis.net/wfs/2.0 http://schemas.opengis.net/wfs/2.0/wfs.xsd">
    <wfs:Query typeNames="ci:City">
    <wfs:PropertyName resolve="local">ci:inhabitants</wfs:PropertyName>
        <fes:Filter>
            <fes:PropertyIsLessThan>
               <fes:ValueReference>ci:inhabitants</fes:ValueReference>
               <fes:Literal>400000</fes:Literal>
            </fes:PropertyIsLessThan>
        </fes:Filter>
    </wfs:Query>
</wfs:GetFeature>

위 요청에 대한 응답 결과는 아래와 같습니다.

<wfs:FeatureCollection timeStamp="2017-09-22T09:56:55.908+02:00" numberReturned="1" numberMatched="unknown" xmlns="http://www.interactive-instruments.de/namespaces/demo/cities/4.1/cities" xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:wfs="http://www.opengis.net/wfs/2.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.interactive-instruments.de/namespaces/demo/cities/4.1/cities https://services.interactive-instruments.de/ogc-reference/schema/demo/cities/4.1/Cities.xsd http://www.opengis.net/wfs/2.0 https://services.interactive-instruments.de/ogc-reference/schema/ogc/wfs/2.0/wfs.xsd http://www.opengis.net/gml/3.2 https://services.interactive-instruments.de/ogc-reference/schema/ogc/gml/3.2.1/gml.xsd http://www.opengis.net/gml/3.2 https://services.interactive-instruments.de/ogc-reference/schema/ogc/gml/3.2.1/gml.xsd">
<wfs:boundedBy>
<gml:Envelope srsName="urn:ogc:def:crs:EPSG::25832" srsDimension="2">
<gml:lowerCorner>364883.268 5620035.394</gml:lowerCorner>
<gml:upperCorner>364883.268 5620035.394</gml:upperCorner>
</gml:Envelope>
</wfs:boundedBy>
<wfs:member>
<City gml:id="City.11">
<name>Bonn</name>
<location>
<gml:Point gml:id="city.id.11.location.Geom_0" srsName="urn:ogc:def:crs:EPSG::25832" srsDimension="2">
<gml:pos>364883.268 5620035.394</gml:pos>
</gml:Point>
</location>
<country>Germany</country>
<inhabitants>324800</inhabitants>
</City>
</wfs:member>
</wfs:FeatureCollection>

 

 

 

참고사이트

 

 

 

'GIS' 카테고리의 다른 글

DEGREE(도, ° ) vs. RADIAN(라디안)  (0) 2023.04.12
cs2cs command  (0) 2023.04.11
좌표 정의 및 좌표계  (0) 2023.04.05
WFS - Operations(3) : Stored Queries  (0) 2023.03.21
WFS - Operations(2) : GetPropertyValue, DescribeFeatureType  (0) 2023.03.21