GetFeature

Web Feature Service (WFS) は、リクエストのサービスを提供して、フィーチャーのインスタンスを取得できます。また、クライアントはどのフィーチャーのプロパティを取得するか指定でき、空間的または非空間的にクエリを制約できます。サービスは、DescribeFeatureType リクエストで返される記述に基づき、フィーチャー (コンテンツ) の検索結果を返すことができます。

アプリケーションは、フィルタによって指定される条件を満たすフィーチャーの特定のセットを取得するフィルタを適用します。例えば、地理的またはそれ以外のさまざまな属性を取得します。また、フィルタによって、ある地域または新しい住宅地 (カスタム ポリゴン) 内のすべての用水のフィーチャーなど、顧客が分析のためにフィーチャーのセットを選択することもできます。

GetFeature 操作は、WFS サーバーから、フィーチャーやフィーチャーについて指定された情報を取得します。結果セットを含む XML ドキュメントがクライアントに返されます。

POST リクエスト

GetFeature リクエストの XML エンコーディングは、WFS 2.0.0 および 2.0.2 の場合、次の XML スキーマによって定義されます。
<xsd:elementname="GetFeature" type="wfs:GetFeatureType"/>
	<xsd:complexType name="GetFeatureType">
		<xsd:sequence>
			<xsd:elementref="wfs:Query" maxOccurs="unbounded"/>
		</xsd:sequence>
		<xsd:attributename="version" type="xsd:string" use="required" fixed="2.0.2"/>
		<xsd:attributename="service" type="xsd:string" use="required" fixed="WFS"/>
		<xsd:attributename="handle" type="xsd:string" use="optional"/>
		<xsd:attributename="outputFormat" type="xsd:string" use="optional" default="application/gml+xml;version=3.2"/>
		<xsd:attributename="count" type="xsd:positiveInteger" use="optional"/>
	</xsd:complexType>
<xsd:elementname="Query" type="wfs:QueryType"/>
	<xsd:complexType name="QueryType">
		<xsd:sequence>
			<xsd:elementref="ogc:PropertyName" minOccurs="0" maxOccurs="unbounded"/>
			<xsd:elementref="ogc:Filter" minOccurs="0" maxOccurs="1"/>
		</xsd:sequence>
		<xsd:attributename="handle" type="xsd:string" use="optional"/>
		<xsd:attributename="srsName" type="xsd:anyURI " use="optional"/>
		<xsd:attributename="typeNames" type="xsd:QName" use="required"/>
	</xsd:complexType> 

GetFeature リクエストの XML エンコーディングは、WFS 1.1.0 の場合、次の XML スキーマによって定義されます。


<xsd:elementname="GetFeature" type="wfs:GetFeatureType"/>
<xsd:complexType name="GetFeatureType">
    <xsd:sequence>
        <xsd:elementref="wfs:Query" maxOccurs="unbounded"/>
    </xsd:sequence>
    <xsd:attributename="version" type="xsd:string" use="required" fixed="1.1.0"/>
    <xsd:attributename="service" type="xsd:string" use="required" fixed="WFS"/>
    <xsd:attributename="handle" type="xsd:string" use="optional"/>
    <xsd:attributename="outputFormat" type="xsd:string" use="optional" default="text/xml; subtype=gml/3.1.1"/>
    <xsd:attributename="maxFeatures" type="xsd:positiveInteger" use="optional"/>
</xsd:complexType>
<xsd:elementname="Query" type="wfs:QueryType"/>
<xsd:complexType name="QueryType">
    <xsd:sequence>
        <xsd:elementref="ogc:PropertyName" minOccurs="0" maxOccurs="unbounded"/>
        <xsd:elementref="ogc:Filter" minOccurs="0" maxOccurs="1"/>
    </xsd:sequence>
    <xsd:attributename="handle" type="xsd:string" use="optional"/>
    <xsd:attributename="srsName" type="xsd:anyURI " use="optional"/>
    <xsd:attributename="typeName" type="xsd:QName" use="required"/>
    <xsd:attributename="featureVersion" type="xsd:string" use="optional"/>
</xsd:complexType>

GetFeature リクエストの XML エンコーディングは、WFS 1.0.0 の場合、次の XML スキーマによって定義されます。


<xsd:elementname="GetFeature" type="wfs:GetFeatureType"/>
<xsd:complexType name="GetFeatureType">
    <xsd:sequence>
        <xsd:elementref="wfs:Query" maxOccurs="unbounded"/>
    </xsd:sequence>
    <xsd:attributename="version" type="xsd:string" use="required" fixed="1.0.0"/>
    <xsd:attributename="service" type="xsd:string" use="required" fixed="WFS"/>
    <xsd:attributename="handle" type="xsd:string" use="optional"/>
    <xsd:attributename="outputFormat" type="xsd:string" use="optional" default="xmlschema"/>
    <xsd:attributename="maxFeatures" type="xsd:positiveInteger" use="optional"/>
</xsd:complexType>
<xsd:elementname="Query" type="wfs:QueryType"/>
<xsd:complexType name="QueryType">
    <xsd:sequence>
        <xsd:elementref="ogc:PropertyName" minOccurs="0" maxOccurs="unbounded"/>
        <xsd:elementref="ogc:Filter" minOccurs="0" maxOccurs="1"/>
    </xsd:sequence>
    <xsd:attributename="handle" type="xsd:string" use="optional"/>
    <xsd:attributename="srsName" type="xsd:anyURI " use="optional"/>
    <xsd:attributename="typeName" type="xsd:QName" use="required"/>
    <xsd:attributename="featureVersion" type="xsd:string" use="optional"/>
</xsd:complexType>

GET リクエスト

GET リクエストには以下の要素が含まれます。

入力 必須 説明
SERVICE=WFS はい WFS に固定されます。
VERSION= はい 2.0.2 に固定されます。これは、このリリースで実装されている Web Feature Service 規格のバージョンです (1.0.0、1.1.0、2.0.0、または 2.0.2)。
REQUEST=GetFeature はい get フィーチャー操作のために GetFeature を設定します。
TYPENAME (1.0.0 または 1.1.0)

TYPENAMES (1.0.0 または 1.1.0)

はい フィーチャー タイプのコンマ区切りのリスト。
MAXFEATURES (1.0.0 または 1.1.0)

COUNT (2.0.0 または 2.0.2)

いいえ 返されるフィーチャーの最大数。
STARTINDEX いいえ 2.0.0 および 2.0.2 の場合のみ。

COUNTSTARTINDEX の両方のパラメータが設定されている場合は、レスポンスには前後の属性が含まれます。これらの属性により、STARTINDEXCOUNT だけ増加または減少することによって、次の結果セットの URL が得られます。

例えば、次の URL があるとします。

http://<server>:<port>/rest/Spatial/WFS?SERVICE=WFS&VERSION=2.0.0&REQUEST=GetFeature&STARTINDEX=11&RESULTTYPE=results&COUNT=10&TYPENAMES=ns29:World

前の属性は、以下のようになります。

http://<server>:<port>/rest/Spatial/WFS?SERVICE=WFS&VERSION=2.0.0&REQUEST=GetFeature&STARTINDEX=1&RESULTTYPE=results&COUNT=10&TYPENAMES=ns29:World

次の属性は、以下のようになります。

http://<server>:<port>/rest/Spatial/WFS?SERVICE=WFS&VERSION=2.0.0&REQUEST=GetFeature&STARTINDEX=21&RESULTTYPE=results&COUNT=10&typenames=ns29:World

OUTPUTFORMAT いいえ バージョンによって、以下のようになります。
  • 1.0.0 の場合、デフォルトは text/xml; subtype=gml/2.1.2 です。
  • 1.1.0 の場合、デフォルトは text/xml; subtype=gml/3.1.1 です。
  • 2.0.0 および 2.0.2 の場合、デフォルトは application/gml+xml;version=3.2 です。
ストアド クエリ 2.0.0 および 2.0.2 の場合のみ。STOREDQUERY_ID パラメータと ID パラメータを使用します。GetFeatureById の必須 ID のみが指定可能です。

GET リクエストの例:

http://localhost:8097/rest/Spatial/WFS?SERVICE=WFS&VERSION=2.0.0&REQUEST=GetFeature&STOREDQUERY_ID=urn:ogc:def:query:OGC-WFS::GetFeatureById&ID=miwfs-2D-World-2D-1

POST リクエストの例:

<?xml version="1.0" encoding="UTF-8"?>
<wfs:GetFeature version="2.0.2" service="WFS" xmlns:wfs="http://www.opengis.net/wfs/2.0"
 <wfs:StoredQuery id="urn:ogc:def:query:OGC-WFS::GetFeatureById">
  <wfs:Parameter name="id">miwfs-2D-World-2D-1
  </wfs:Parameter>
 </wfs:StoredQuery></wfs:GetFeature>
STOREDQUERY_ID いいえ バージョン 2.0.0 と 2.0.2 で、異なる ID 形式 (URN と URL) が使用されます。URN 形式は、バージョン2.0.2 でまだ使用可能ですが、非推奨になっています。

2.0.0 - urn:ogc:def:query:OGC-WFS::GetFeatureById

2.0.2 - http://www.opengis.net/def/query/OGC-WFS/0/GetFeatureById または urn:ogc:def:query:OGC-WFS::GetFeatureById (非推奨)

ID いいえ 返されるフィーチャーの ID。

例えば、フィーチャー ID miwfs-2D-World-2D-1 は次の要素で構成されています。

  • miwfs = スキーマ
  • 2D = 2 次元
  • World = フィーチャー名
  • 1 = 返されるフィーチャーのフィーチャー キー

v2.0.2 の場合の例:


http://<server>:<port>/rest/Spatial/WFS?SERVICE=WFS&VERSION=2.0.2&REQUEST=GetFeature&TYPENAMES=World&COUNT=10

v1.1.0 の場合の例:


http://<server>:<port>/rest/Spatial/WFS?SERVICE=WFS&VERSION=1.1.0&REQUEST=GetFeature&TYPENAME=World&MAXFEATURES=10