この章では、Open GeoSpatial Consortium(OGC)のOpen Location Services Initiative(OpenLS)バージョン1.0および1.1に基づいた、Webサービスに対するOracle Spatialのサポートについて説明します。 OpenLSの説明については、ダウンロードおよびスキーマへのリンクを含むhttp://www.opengeospatial.org/standards/olsを参照してください。
この章の内容は次のとおりです。
Spatialでは、次のOGC OpenLSサービスをサポートしています。
ロケーション・ユーティリティ・サービス(ジオコーディング)
プレゼンテーション・サービス(マッピング)
ルート・サービス(運転方向)
ディレクトリ・サービス(YP(イエロー・ページ))
Spatialでは、現在、OGC OpenLSのゲートウェイ・サービス(モバイル・ポジショニング)をサポートしていません。
ディレクトリ・サービス(YP(イエロー・ページ))を除き、すべてのサポートされているサービスについて、最初に特定の操作を実行する必要があります。この操作にはサードパーティ・データの取得およびロードと、SpatialのOpenLSサービスの基礎となるテクノロジの構成およびデプロイが含まれている場合もあります。表14-1に、SpatialのOpenLSサービスに加えて、要件および基礎となるテクノロジを説明している章またはマニュアルを示します。
表14-1 SpatialのOpenLSサービスの依存性
| SpatialのOpenLSサービス | 依存対象 | 参照先 |
|---|---|---|
|
ジオコーディング |
ジオコーディングを行うメタデータとデータ |
|
|
マッピング |
OracleAS MapViewer |
『Oracle Application Server MapViewerユーザーズ・ガイド』 |
|
運転方向 |
ルーティング・エンジン |
|
|
ビジネス・ディレクトリ(YP(イエロー・ページ)) |
外部プロバイダからのデータ |
第12章「ビジネス・ディレクトリ(イエロー・ページ)のサポート」 |
SpatialのOpenLSサービスを使用する際に、WebサービスAPIとPL/SQL APIという2つのApplication Program Interface(API)が提供されます。
WebサービスAPIでは、Web Feature Services(第15章を参照)と同じSOAPエンベロープを使用します。WSS認証とプロキシ認証およびユーザー管理を使用して、認証と認可を有効にします。
WebサービスよりもPL/SQL APIの方が便利です。認証と認可は、OpenLSリクエストを送信して結果を戻すPL/SQLサブプログラムのコールに使用するデータベース接続を介して有効化されます。PL/SQL APIは、第27章で説明されているSDO_OLSパッケージで実装されます。
この項では、ジオコーディング、マッピング、ルーティングおよびディレクトリ・サービス(YP)に対して提供されているサポートについて説明します。また、この項には、OpenLS WebサービスAPIのリクエストとレスポンスの例も示しています。
OpenLSジオコーディングの<Request>要素には、GeocodeRequestまたはReverseGeocodeRequestの値が設定されたmethodName属性と、これに対応する<GeocodeRequest>または<ReverseGeocodeRequest>という名前の最上位レベルの要素が含まれます。
methodName属性値がGeocodeRequestである場合、<GeocodeRequest>要素には、自由形式の住所、通りの住所または交差点の住所を指定できる<Address>要素と、0(ゼロ)個以上の<Place>要素、またオプションで<PostalCode>要素が含まれます。<Address>要素には、必須属性countryCodeと複数のオプションの属性が含まれます。
methodName属性値がGeocodeRequestである場合、<ReverseGeocodeRequest>要素には、逆にジオコードする位置を指定する<Position>要素と、戻される情報(デフォルトは通りの住所)を指定するオプションの<ReverseGeocodePreference>要素が含まれます。
例14-1は、California州San Francisco市の2つの住所をジオコードするリクエストです。
例14-1 OpenLSのジオコーディング・リクエスト
<XLS
xmlns=http://www.opengis.net/xls
xmlns:gml=http://www.opengis.net/gml
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance
xsi:schemaLocation="http://www.opengis.net/xls …"
version="1.0">
<RequestHeader clientName="someName" clientPassword="password"/>
<Request
maximumResponses="10"
methodName="GeocodeRequest"
requestID="123"
version="1.0">
<GeocodeRequest>
<Address countryCode="US">
<StreetAddress>
<Building number="400"/>
<Street>Post Street</Street>
</StreetAddress>
<Place type="CountrySubdivision">CA</Place>
<Place type="Municipality">San Francisco</Place>
<PostalCode>94102</PostalCode>
</Address>
<Address countryCode="US">
<StreetAddress>
<Building number="233"/>
<Street>Winston Drive</Street>
</StreetAddress>
<Place type="CountrySubdivision">CA</Place>
<Place type="Municipality">San Francisco</Place>
<PostalCode>94132</PostalCode>
</Address>
</GeocodeRequest>
</Request>
</XLS>
例14-2は、例14-1のリクエストに対するレスポンスです。 2つの住所に対して経度と緯度の座標が戻されます(最初に-122.4083257 37.788208、次に-122.4753965 37.7269066が戻されます)。
例14-2 OpenLSのジオコーディング・レスポンス
<xls:XLS
xmlns:xls=http://www.opengis.net/xls
xmlns:gml=http://www.opengis.net/gml
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance
version="1.0">
<xls:ResponseHeader/>
<xls:Response requestID="123" version="1.0">
<xls:GeocodeResponse xmlns:xls="http://www.opengis.net/xls">
<xls:GeocodeResponseList
xmlns:xls=http://www.opengis.net/xls
numberOfGeocodedAddresses="1">
<xls:GeocodedAddress>
<gml:Point xmlns:gml="http://www.opengis.net/gml">
<gml:pos dimension="2" srsName="4326">-122.4083257 37.788208</gml:pos>
</gml:Point>
<xls:Address countryCode="US">
<xls:StreetAddress>
<xls:Building number="400"/>
<xls:Street>POST ST</xls:Street>
</xls:StreetAddress>
<xls:Place type="CountrySubdivision">CA</xls:Place>
<xls:Place type="Municipality">SAN FRANCISCO</xls:Place>
<xls:PostalCode>94102</xls:PostalCode>
</xls:Address>
</xls:GeocodedAddress>
</xls:GeocodeResponseList>
<xls:GeocodeResponseList
xmlns:xls=http://www.opengis.net/xls
numberOfGeocodedAddresses="1">
<xls:GeocodedAddress>
<gml:Point xmlns:gml="http://www.opengis.net/gml">
<gml:pos dimension="2" srsName="4326">-122.4753965 37.7269066</gml:pos>
</gml:Point>
<xls:Address countryCode="US">
<xls:StreetAddress>
<xls:Building number="233"/>
<xls:Street>WINSTON DR</xls:Street>
</xls:StreetAddress>
<xls:Place type="CountrySubdivision">CA</xls:Place>
<xls:Place type="Municipality">SAN FRANCISCO</xls:Place>
<xls:PostalCode>94132</xls:PostalCode>
</xls:Address>
</xls:GeocodedAddress>
</xls:GeocodeResponseList>
</xls:GeocodeResponse>
</xls:Response>
</xls:XLS>
OpenLSマッピングの<Request>要素には、PortrayMapRequestの値が設定されたmethodName属性と、<PortrayMapRequest>という名前の最上位レベルの要素が含まれます。
<PortrayMapRequest>要素には、マップの中心点を含む、生成されるマップの出力を指定する<Output>要素が含まれます。
<PortrayMapRequest>要素には、MapViewerのベース・マップと1つ以上の主題を指定する<Basemap>要素、0(ゼロ)個以上の<Overlay>要素(各要素がベース・マップ上でオーバーレイされる情報を指定)を含めることができます。
例14-3は、マップ・イメージを描写するリクエストです。イメージは指定した経度/緯度の点を中心とし、ベース・マップと2つのMapViewerの主題を使用して、マップ上の3つの点を表します。
例14-3 OpenLSのマッピング・リクエスト
<XLS
xmlns=http://www.opengis.net/xls
xmlns:gml=http://www.opengis.net/gml
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance
xsi:schemaLocation="http://www.opengis.net/xls …"
version="1.1">
<RequestHeader clientName="someName" clientPassword="password"/>
<Request
maximumResponses="1"
methodName="PortrayMapRequest"
requestID="456"
version="1.1">
<PortrayMapRequest>
<Output
BGcolor="#a6cae0"
content="URL"
format="GIF_URL"
height="600"
transparent="false"
width="800">
<CenterContext SRS="8307">
<CenterPoint srsName="8307">
<gml:pos>-122.2615 37.5266</gml:pos>
</CenterPoint>
<Radius unit="M">50000</Radius>
</CenterContext>
</Output>
<Basemap filter="Include">
<Layer name="mvdemo.demo_map.THEME_DEMO_COUNTIES"/>
<Layer name="mvdemo.demo_map.THEME_DEMO_HIGHWAYS"/>
</Basemap>
<Overlay zorder="1">
<POI
ID="123"
description="description"
phoneNumber="1234"
POIName="Books at Post Str (point)">
<gml:Point srsName="4326">
<gml:pos>-122.4083257 37.788208</gml:pos>
</gml:Point>
</POI>
</Overlay>
<Overlay zorder="2">
<POI
ID="456"
description="description"
phoneNumber="1234"
POIName="Books at Winston Dr (address)">
<Address countryCode="US">
<StreetAddress>
<Building number="233"/>
<Street>Winston Drive</Street>
</StreetAddress>
<Place type="CountrySubdivision">CA</Place>
<Place type="CountrySecondarySubdivision"/>
<Place type="Municipality">San Francisco</Place>
<Place type="MunicipalitySubdivision"/>
<PostalCode>94132</PostalCode>
</Address>
</POI>
</Overlay>
<Overlay zorder="3">
<Position levelOfConf="1">
<gml:Point gid="a boat (point)" srsName="4326">
<gml:pos>-122.8053965 37.388208</gml:pos>
</gml:Point>
</Position>
</Overlay>
</PortrayMapRequest>
</Request>
</XLS>
例14-4は、例14-3のリクエストに対するレスポンスです。ただし、実際のレスポンスでは、<xls:URL>Actual URL replaced with constant string for test</xls:URL>の行にマップ・イメージの実際のURLが含まれます。
例14-4 OpenLSのマッピング・レスポンス
<xls:XLS
xmlns:xls=http://www.opengis.net/xls
xmlns:gml=http://www.opengis.net/gml
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance
xsi:schemaLocation="http://www.opengis.net/xls …"
version="1.1">
<xls:ResponseHeader/>
<xls:Response numberOfResponses="1" requestID="456" version="1.1">
<xls:PortrayMapResponse>
<xls:Map>
<xls:Content format="GIF_URL" height="600" width="800">
<xls:URL>Actual URL replaced with constant string for test</xls:URL>
</xls:Content>
<xls:BBoxContext srsName="4326">
<gml:pos>-122.86037685607968 37.07744235794024</gml:pos>
<gml:pos>-121.66262314392031 37.97575764205976</gml:pos>
</xls:BBoxContext>
</xls:Map>
</xls:PortrayMapResponse>
</xls:Response>
</xls:XLS>
OpenLSルーティングの<Request>要素には、DetermineRouteRequestの値が設定されたmethodName属性と、<DetermineRouteRequest>という名前の最上位レベルの要素が含まれます。
<DetermineRouteRequest>要素には、ルート・プリファレンスとルートに含める点(およびオプションでルートで回避する点)を指定する<RoutePlan>要素が含まれます。点については少なくとも開始点と終了点を指定します。
また、<DetermineRouteRequest>要素には、ルートを表す線ストリング・ジオメトリを戻す<RouteGeometryRequest>要素、ルートのマップ・イメージをリクエストする<RouteMapRequest>要素およびルートの運転方向をリクエストする<RouteInstructionsRequest>要素が0(ゼロ)個以上含まれます。
例14-5は、Massachusetts州Cambridge市内の住所とNew Hampshire州Nashua市内の住所との間の最速ルートに対するルート・ジオメトリおよびマップ・イメージのリクエストです。
例14-5 OpenLSのルーティング・リクエスト
<XLS
xmlns=http://www.opengis.net/xls
xmlns:gml=http://www.opengis.net/gml
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance
xsi:schemaLocation="http://www.opengis.net/xls …"
version="1.1">
<RequestHeader clientName="someName" clientPassword="password"/>
<Request
maximumResponses="10"
methodName="DetermineRouteRequest"
requestID="12345"
version="1.0">
<DetermineRouteRequest>
<RoutePlan>
<RoutePreference>Fastest</RoutePreference>
<WayPointList>
<StartPoint>
<POI description="Borders" ID="1" phoneNumber="12345" POIName="Borders">
<Address countryCode="US">
<StreetAddress>
<Building number="100"/>
<Street>Cambridgeside Pl</Street>
</StreetAddress>
<Place type="CountrySubdivision">MA</Place>
<Place type="Municipality">Cambridge</Place>
<PostalCode>02141</PostalCode>
</Address>
</POI>
</StartPoint>
<EndPoint>
<Address countryCode="US">
<StreetAddress>
<Building number="1"/>
<Street>Oracle Dr</Street>
</StreetAddress>
<Place type="CountrySubdivision">New Hampshire</Place>
<Place type="Municipality">Nashua</Place>
<PostalCode>03062</PostalCode>
</Address>
</EndPoint>
</WayPointList>
<AvoidList/>
</RoutePlan>
<RouteGeometryRequest maxPoints="100" provideStartingPortion="true" scale="1">
<BoundingBox>
<gml:pos/>
<gml:pos/>
</BoundingBox>
</RouteGeometryRequest>
<RouteMapRequest>
<Output BGcolor="" format="" height="600" transparent="false" width="800"/>
</RouteMapRequest>
</DetermineRouteRequest>
</Request>
</XLS>
例14-6は、例14-5のリクエストに対するレスポンスの一部です。例14-6では、合計予想運転時間、合計距離、ルートを囲む最小境界矩形の左下および右上の経度/緯度座標、およびルートを表す線ジオメトリに沿った最初のいくつかの点の経度/緯度座標を示します。
例14-6 OpenLSのルーティング・レスポンス
<xls:XLS
xmlns:xls=http://www.opengis.net/xls
xmlns:gml=http://www.opengis.net/gml
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance
xsi:schemaLocation="http://www.opengis.net/xls …"
version="1.1">
<xls:ResponseHeader/>
<xls:Response numberOfResponses="1" requestID="12345" version="1.0">
<xls:DetermineRouteResponse>
<xls:RouteSummary>
<xls:TotalTime>P0DT0H42M26S</xls:TotalTime>
<xls:TotalDistance uom="M" value="61528.7"/>
<xls:BoundingBox srsName="4326">
<gml:pos dimension="2" srsName="4326">-71.45937289088023 42.36694</gml:pos>
<gml:pos dimension="2" srsName="4326">-71.06754 42.70824</gml:pos>
</xls:BoundingBox>
</xls:RouteSummary>
<xls:RouteGeometry>
<gml:LineString srsName="4326">
<gml:pos
xmlns:gml=http://www.opengis.net/gml
dimension="2"
srsName="4326">-71.07444,42.36792</gml:pos>
<gml:pos
xmlns:gml=http://www.opengis.net/gml
dimension="2"
srsName="4326">-71.07162,42.37082</gml:pos>
<gml:pos
xmlns:gml=http://www.opengis.net/gml
dimension="2"
srsName="4326">-71.06954,42.37333</gml:pos>
. . .
OpenLSディレクトリ・サービスの<Request>要素には、DirectoryRequestの値が設定されたmethodName属性と、<DirectoryRequest>という名前の最上位レベルの要素が含まれます。
<DirectoryRequest>要素には、対象点(戻されるビジネス情報の距離の計算元となる中心点)の場所を指定する<POILocation>要素が含まれます。
また、<DirectoryRequest>要素には、1つ以上の<POIProperty>要素を指定する<POIProperties>要素が含まれます。各<POIProperty>要素にはプロパティを示すname属性およびプロパティの値を示すvalue属性が含まれます。name属性には、ID、POIName、PhoneNumber、Keyword、NAICS_type、NAICS_subType、NAICS_category、SIC_type、SIC_subType、SIC_category、SIC_codeまたはotherのうち任意の文字列を指定できます。
例14-7は、指定した2つのSIC(Standard Industrial Classification)コードのいずれかまたは両方を持つビジネスに関する情報のリクエストです。この例では、2つのSICコード(1234567890および1234567891)は架空のコードです。また、これらのコードは一部のテスト・データ・セットとともに使用されていますが、このデータ・セットでは、実際にはこれらのSICコードを持たないカテゴリ(Book storesおよびCafes & Cafeterias)に、これらのコードが適用されています。
例14-7 OpenLSのディレクトリ・サービス(YP)・リクエスト
<XLS
xmlns=http://www.opengis.net/xls
xmlns:gml=http://www.opengis.net/gml
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance
xsi:schemaLocation="http://www.opengis.net/xls …"
version="1.0">
<RequestHeader clientName="someName" clientPassword="password"/>
<Request
requestID="123"
maximumResponses="100"
version="1.1"
methodName="DirectoryRequest">
<DirectoryRequest>
<POILocation>
<Address countryCode="US">
</Address>
</POILocation>
<POIProperties>
<POIProperty name="SIC_code" value="1234567890"/>
<POIProperty name="SIC_code" value="1234567891"/>
</POIProperties>
</DirectoryRequest>
</Request>
</XLS>
例14-8は、例14-7のリクエストに対するレスポンスです。レスポンスには、特定のSICコードのいずれかまたは両方が適用されている2つのビジネスに関する情報が含まれます。
例14-8 OpenLSのディレクトリ・サービス(YP)・レスポンス
<xls:XLS
xmlns:xls=http://www.opengis.net/xls
xmlns:gml=http://www.opengis.net/gml
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance
version="1.0">
<xls:ResponseHeader/>
<xls:Response requestID="123" version="1.1">
<DirectoryResponse xmlns="http://www.opengis.net/xls">
<xls:POIContext xmlns:xls="http://www.opengis.net/xls">
<xls:POI
ID="1"
POIName="Borders Books & More"
phoneNumber="415-731-0665"
description="Books & more">
<POIAttributeList xmlns="http://www.opengis.net/xls">
<xls:SIC
xmlns:xls=http://www.opengis.net/xls
category="Book stores"
code="1234567890"
subType=""
type=""/>
<xls:SIC
xmlns:xls=http://www.opengis.net/xls
category="Cafes & Cafeterias"
code="1234567891"
subType="" type=""/>
</POIAttributeList>
<gml:Point xmlns:gml="http://www.opengis.net/gml">
<gml:pos dimension="2" srsName="4326">-122.4753965 37.7269066</gml:pos>
</gml:Point>
<xls:Address countryCode="US">
<xls:StreetAddress>
<xls:Building number="233"/>
<xls:Street>Winston Drive</xls:Street>
</xls:StreetAddress>
<xls:Place type="CountrySubdivision">CA</xls:Place>
<xls:Place type="CountrySecondarySubdivision"/>
<xls:Place type="Municipality">San Francisco</xls:Place>
<xls:Place type="MunicipalitySubdivision"/>
<xls:PostalCode>94132</xls:PostalCode>
</xls:Address>
</xls:POI>
</xls:POIContext>
<xls:POIContext xmlns:xls="http://www.opengis.net/xls">
<xls:POI
ID="2"
POIName="Borders Books & More"
phoneNumber="415-399-1633"
description="Books & more">
<POIAttributeList xmlns="http://www.opengis.net/xls">
<xls:SIC
xmlns:xls=http://www.opengis.net/xls
category="Book stores"
code="1234567890"
subType=""
type=""/>
<xls:SIC
xmlns:xls=http://www.opengis.net/xls
category="Cafes & Cafeterias"
code="1234567891"
subType=""
type=""/>
</POIAttributeList>
<gml:Point xmlns:gml="http://www.opengis.net/gml">
<gml:pos dimension="2" srsName="4326">-122.4083257 37.788208</gml:pos>
</gml:Point>
<xls:Address countryCode="US">
<xls:StreetIntersection>
<xls:Street>Post St</xls:Street>
<xls:IntersectingStreet>Powell St</xls:IntersectingStreet>
</xls:StreetIntersection>
<xls:Place type="CountrySubdivision">CA</xls:Place>
<xls:Place type="CountrySecondarySubdivision"/>
<xls:Place type="Municipality">San Francisco</xls:Place>
<xls:Place type="MunicipalitySubdivision"/>
<xls:PostalCode>94102</xls:PostalCode>
</xls:Address>
</xls:POI>
</xls:POIContext>
</DirectoryResponse>
</xls:Response>
</xls:XLS>