SuperMap iServer 服務器會對客戶端 HTTP 請求做出(chū)響應,客戶端執行 GET 請求,獲得資源的(de)表述,客戶端執行 PUT、POST、DELETE 請求,獲得操作結果的(de)表述。表述可以(yǐ)有多種格式,如 html、xml、json、rjson、jsonp、png、bmp、gif 、jpg、jpeg、classic、leaflet、openlayers3、mapboxgl、tianditu 等,其中 png、bmp、gif、jpg 及 jpeg 是(shì)圖片資源特有的(de)表述格式,classic、leaflet、openlayers3、mapboxgl 及 tianditu 是(shì) map 資源和(hé / huò) layer 資源支持的(de)表述格式。

表述的(de)格式在(zài) HTTP 請求的(de) URI 中指定,形式是(shì)在(zài) URI 後面加上(shàng).<format>。例如對 http://supermapiserver:8090/iserver/services/map-changchun/rest/maps.json 執行 GET 請求,就(jiù)會返回 json 格式的(de) maps 資源的(de)表述。

如果不(bù)指定<format>,SuperMap iServer 服務器以(yǐ)默認的(de)表述格式返回相應表述,默認返回 html 格式的(de)表述。

注意:獲取圖片資源的(de)表述出(chū)錯時(shí),如果是(shì) Debug 模式(在(zài) AppContext.xml 中 REST 配置項的(de) debug 字段來(lái)設置,debug 爲(wéi / wèi) true 表示爲(wéi / wèi) Debug 模式,默認爲(wéi / wèi) true),出(chū)錯信息以(yǐ) html 格式返回,否則以(yǐ) json 格式返回。

目前,SuperMap iServer 支持的(de)全部表述格式:

   

html

默認的(de)非圖片資源表述格式。返回一(yī / yì /yí)個(gè) HTML 頁面。HTML 可以(yǐ)容易地(dì / de)表達一(yī / yì /yí)個(gè)列表,而(ér)且可以(yǐ)用标準屬性(class)表達列表的(de)種類。

例如,要(yào / yāo)獲得 maps 服務的(de) HTML 表述,可以(yǐ)用以(yǐ)下 URI:

http://supermapiserver:8090/iserver/services/map-changchun/rest/maps.html

因爲(wéi / wèi) html 是(shì)默認的(de)非圖片資源表述格式,所以(yǐ)也(yě)可以(yǐ)不(bù)指定,直接使用如下 URI:

http://supermapiserver:8090/iserver/services/map-changchun/rest/maps

返回的(de)示例如下所示:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

<html>

<head>

         ……

</head>

<body>

         ……

        <div id="content" valign="top" width="80%">

                <h1>地(dì / de)圖列表(maps)</h1>

                        ……

                        <b>描述:</b>

                        ……

                        <b>地(dì / de)圖列表:</b>

                        ……

                        <span><strong>HTTP 方法</strong></span>

                        ……

                        <span><strong>表述格式</strong></span>

                        ……

        </div>

</body>

</html>

在(zài)浏覽器中顯示如下:

xml

返回一(yī / yì /yí)個(gè) xml 格式的(de)文檔。SuperMap iServer 自定義了(le/liǎo)一(yī / yì /yí)系列 XML 詞彙,這(zhè)樣就(jiù)能夠更準确地(dì / de)表述資源。

例如,要(yào / yāo)獲得 maps 服務的(de) XML 表述,可以(yǐ)用以(yǐ)下 URI:

http://supermapiserver:8090/iserver/services/map-world/rest/maps.xml

返回的(de)示例如下所示:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>

<list>

 <ChildResource>

  <name>世界地(dì / de)圖</name>

  <resourceType>StaticResource</resourceType>

  <resourceConfigID>map</resourceConfigID>

  <path>http://localhost:8090/iserver/services/map-world/rest/maps/%E4%B8%96%E7%95%8C%E5%9C%B0%E5%9B%BE</path>

 <supportedMediaTypes>

  <string>application/xml</string>

  <string>text/xml</string>

  <string>application/json</string>

  <string>application/rjson</string>

  <string>text/html</string>

  <string>application/jsonp</string>

  <string>application/x-java-serialized-object</string>

  <string>application/ajax</string>

  <string>application/kml</string>

  <string>application/ifx</string>

  <string>application/flex</string>

  <string>application/isl</string>

  <string>application/silverlight</string>

  <string>application/ijs</string>

  <string>application/javascript</string>

  <string>application/html5</string>

  <string>application/smc</string>

  <string>application/supermapcloud</string>

  <string>application/tdt</string>

  <string>application/tianditu</string>

  <string>application/ilt</string>

  <string>application/leaflet</string>

  <string>application/flash3d</string>

  </supportedMediaTypes>

  </ChildResource>

</list>

kml

返回一(yī / yì /yí)個(gè) KML 格式的(de)頁面,當資源是(shì) map、 features、 feature 時(shí)有效。 KML(Keyhole Markup Language)是(shì) GoolgleEarth 的(de)文件格式,是(shì)一(yī / yì /yí)個(gè)基于(yú) XML 語法和(hé / huò)文件格式的(de)文件,用來(lái)描述和(hé / huò)保存如點、線、圖片、折線等地(dì / de)理信息要(yào / yāo)素并在(zài) Google Earth、 Google Map 等應用系統中顯示。

例如,要(yào / yāo)獲得 features 服務的(de) KML 表述,可以(yǐ)用以(yǐ)下 URI:

http://supermapiserver:8090/iserver/services/data-changchun/rest/data/datasources/Changchun/datasets/Frame/features.kml

返回的(de)示例如下所示:

<?xml version="1.0" encoding="utf-8" standalone="no"?>

  <kml>

    <Document>

      <NetworkLink>

        <name>0-1-0</name>

        <Link>

          <href>http://supermapiserver:8090/iserver/services/data-changchun/rest/data/feature/0-1-0.kml</href>

        </Link>

      </NetworkLink>

      <NetworkLink>

        <name>0-1-1</name>

        <Link>

          <href>http://supermapiserver:8090/iserver/services/data-changchun/rest/data/feature/0-1-1.kml</href>

        </Link>

      </NetworkLink>

    </Document>

  </kml>

要(yào / yāo)獲得 map 服務的(de) KML 表述,可以(yǐ)用以(yǐ)下 URI:

http://supermapiserver:8090/iserver/services/map-changchun/rest/maps/長春市區圖.kml

georss

返回一(yī / yì /yí)個(gè) GeoRSS 格式的(de)頁面,當資源是(shì) features、feature 時(shí)有效。GeoRSS 是(shì) OGC 在(zài) GML(地(dì / de)理标記語言) 基礎上(shàng)推出(chū)的(de)描述地(dì / de)理信息的(de)規範,它使用 XML 語言存儲和(hé / huò)傳輸地(dì / de)理數據,用來(lái)描述和(hé / huò)保存如點、線、面等地(dì / de)理信息要(yào / yāo)素。GeoRSS 提供了(le/liǎo) GeoRSS Simple 和(hé / huò) GeoRSS GML Profile 兩種形式,SuperMap iServer 目前支持 GeoRSS Simple 表述。GeoRSS 格式的(de)地(dì / de)理要(yào / yāo)素信息可以(yǐ)通過 Virtual Earth 等應用系統顯示。

例如,data-changchun/rest 服務中有一(yī / yì /yí)個(gè)名爲(wéi / wèi) Park 的(de)數據集,要(yào / yāo)獲取其索引号爲(wéi / wèi) 0-0-0 的(de)要(yào / yāo)素的(de) georss 表述,可以(yǐ)用以(yǐ)下 URI(有關 feature 資源的(de)請求 URI,請參見 feature 資源介紹):

http://supermapiserver:8090/iserver/services/data-changchun/rest/data/feature/0-0-0.georss

返回的(de)示例如下所示:

<?xml version="1.0" encoding="utf-8" standalone="no"?>

<rss xmlns:georss="http://www.georss.org/georss" version="2.0">

<channel>

<title>GeoRSS-Simple Representation for Feature Resource</title>

<link><![CDATA[http://supermapiserver:8090/iserver/services/data-changchun/rest/data/feature/0-0-0]]></link>

<item>

<title>朝陽公園</title>

<link><![CDATA[http://supermapiserver:8090/iserver/services/data-changchun/rest/data/feature/0-0-0]]></link>

<description><![CDATA[<table border='1'><tr><th colspan='9' scope='col'>朝陽公園</th></tr><tr><td>SMID</td><td>SMX</td><td>SMY</td><td>SMLIBTILEID</td><td>SMUSERID</td><td>SMGEOMETRYSIZE</td><td>NAME</td><td>X</td><td>Y</td></tr><tr><td>1</td><td>4597.873059</td><td>-4567.922216</td><td>1</td><td>0</td><td>16</td><td>朝陽公園</td><td>4597.873059</td><td>-4567.922216</td></tr></table>]]></description>

<georss:point>-4567.922216 4597.873059</georss:point>

</item>

</channel>

</rss>

json

返回一(yī / yì /yí)個(gè) JSON 字符串。JSON(JavaScript Object Notation)是(shì)一(yī / yì /yí)種 JavaScript 對象表示法,是(shì)一(yī / yì /yí)種輕量級的(de)數據交換格式,可以(yǐ)表達一(yī / yì /yí)般的(de)數據結構。

例如,要(yào / yāo)獲得 maps 資源的(de) JSON 表述,可以(yǐ)用以(yǐ)下 URI:

http://supermapiserver:8090/iserver/services/map-changchun/rest/maps.json

返回的(de)示例如下所示:

[

    {

        "resourceConfigID": "map",

        "name": "長春市區圖",

        "path": "http://localhost:8090/iserver/services/map-changchun/rest/maps/%E9%95%BF%E6%98%A5%E5%B8%82%E5%8C%BA%E5%9B%BE",

        "supportedMediaTypes": [

            "application/xml",

            "text/xml",

            "application/json",

            "application/rjson",

            "text/html",

            "application/jsonp",

            "application/x-java-serialized-object",

            "application/ajax",

            "application/kml",

            "application/ifx",

            "application/flex",

            "application/isl",

            "application/silverlight",

            "application/ijs",

            "application/javascript",

            "application/html5",

            "application/smc",

            "application/supermapcloud",

            "application/tdt",

            "application/tianditu",

            "application/ilt",

            "application/leaflet",

            "application/flash3d"

        ],

        "resourceType": "StaticResource"

    }

]

rjson

執行 PUT、POST、DELETE、HEAD 請求時(shí)默認的(de)操作結果表述格式。返回一(yī / yì /yí)個(gè)格式化了(le/liǎo)的(de) JSON 字符串,更便于(yú)閱讀。

例如,要(yào / yāo)獲得 maps 服務的(de) RJSON 表述,可以(yǐ)用以(yǐ)下 URI:

http://supermapiserver:8090/iserver/services/map-changchun/rest/maps.rjson

返回的(de)示例如下所示:

[{

    "name": "長春市區圖",

    "path": "http://localhost:8090/iserver/services/map-changchun/rest/maps/%E9%95%BF%E6%98%A5%E5%B8%82%E5%8C%BA%E5%9B%BE",

    "resourceConfigID": "map",

    "resourceType": "StaticResource",

    "supportedMediaTypes": [

        "application/xml",

        "text/xml",

        "application/json",

        "application/rjson",

        "text/html",

        "application/jsonp",

        "application/x-java-serialized-object",

        "application/ajax",

        "application/kml",

        "application/ifx",

        "application/flex",

        "application/isl",

        "application/silverlight",

        "application/ijs",

        "application/javascript",

        "application/html5",

        "application/smc",

        "application/supermapcloud",

        "application/tdt",

        "application/tianditu",

        "application/ilt",

        "application/leaflet",

        "application/flash3d"

    ]

}]

jsonp

JSONP(JSON with Padding)是(shì) JSON 格式的(de)一(yī / yì /yí)種補充,用于(yú)方便客戶端實現跨域訪問。

例如,要(yào / yāo)獲得 maps 資源的(de) JSONP 表述,指定回調函數名爲(wéi / wèi) mycallbackname,可以(yǐ)用以(yǐ)下 URI:

http://supermapiserver:8090/iserver/services/map-changchun/rest/maps.jsonp?callback=mycallbackname

返回的(de)示例如下所示:

callBack11893434([{"resourceConfigID":"map","name":"長春市區圖","path":"http://localhost:8090/iserver/services/map-changchun/rest/maps/%E9%95%BF%E6%98%A5%E5%B8%82%E5%8C%BA%E5%9B%BE","supportedMediaTypes":["application/xml","text/xml","application/json","application/rjson","text/html","application/jsonp","application/x-java-serialized-object","application/ajax","application/kml","application/ifx","application/flex","application/isl","application/silverlight","application/ijs","application/javascript","application/html5","application/smc","application/supermapcloud","application/tdt","application/tianditu","application/ilt","application/leaflet","application/flash3d"],"resourceType":"StaticResource"}],200)

png

返回請求的(de) PNG 格式圖片,僅當資源是(shì)圖片時(shí)有效。

例如,要(yào / yāo)獲得名爲(wéi / wèi)長春市區圖的(de)地(dì / de)圖的(de)當前顯示,格式爲(wéi / wèi) PNG,可以(yǐ)用以(yǐ)下 URI:

http://supermapiserver:8090/iserver/services/map-changchun/rest/maps/長春市區圖/image.png

bmp

返回請求的(de) bmp 格式圖片,僅當資源是(shì)圖片時(shí)有效。

例如,要(yào / yāo)獲得名爲(wéi / wèi) World 的(de)地(dì / de)圖的(de)當前顯示,格式爲(wéi / wèi) BMP,可以(yǐ)用以(yǐ)下 URI:

http://supermapiserver:8090/iserver/services/map-changchun/rest/maps/長春市區圖/image.bmp

gif

返回請求的(de) GIF 格式圖片,僅當資源是(shì)圖片時(shí)有效。

例如,要(yào / yāo)獲得名爲(wéi / wèi)長春市區圖的(de)地(dì / de)圖的(de)當前顯示,格式爲(wéi / wèi) GIF,可以(yǐ)用以(yǐ)下 URI:

http://supermapiserver:8090/iserver/services/map-changchun/rest/maps/長春市區圖/image.gif

jpg

返回請求的(de) JPEG 格式圖片,僅當資源是(shì)圖片時(shí)有效。

例如,要(yào / yāo)獲得名爲(wéi / wèi)長春市區圖的(de)地(dì / de)圖的(de)當前顯示,格式爲(wéi / wèi) JPEG(*.jpg),可以(yǐ)用以(yǐ)下 URI:

http://supermapiserver:8090/iserver/services/map-changchun/rest/maps/長春市區圖/image.jpg

WebP

返回請求的(de) WebP 格式圖片,僅當資源是(shì)圖片時(shí)有效。WebP 是(shì)谷歌提出(chū)的(de)一(yī / yì /yí)種既提供有損壓縮也(yě)提供無損壓縮的(de)圖片格式,WebP 無損壓縮圖片的(de)大(dà)小小于(yú)相同圖像質量的(de) PNG 格式的(de)圖像。目前地(dì / de)圖服務的(de) image,tileImage,entireimage,overview,symbol,zxyTileImage 資源均支持通過 WebP 表述浏覽。

例如,要(yào / yāo)獲得名爲(wéi / wèi)長春市區圖的(de)地(dì / de)圖的(de)當前顯示,格式爲(wéi / wèi) WebP(*.webp),可以(yǐ)用以(yǐ)下 URI:

http://supermapiserver:8090/iserver/services/map-changchun/rest/maps/長春市區圖/image.webp

注:在(zài)切圖時(shí),栅格、影像數據建議使用 WebP 格式,矢量數據建議使用 PNG 格式。

classic

當資源是(shì) map、layer 時(shí) classic 表述有效。classic 表述是(shì)針對 JavaScript 客戶端的(de)應用,實現了(le/liǎo)簡單的(de)地(dì / de)圖功能,如縮放、量算等。

例如,要(yào / yāo)獲得名爲(wéi / wèi) World Map 的(de)地(dì / de)圖的(de)classic 表述,可以(yǐ)用以(yǐ)下 URI:

http://supermapiserver:8090/iserver/representations/classic/map.html?serviceName=map-World&mapName=World

tianditu(已過時(shí))

當資源是(shì) map、layer 時(shí) tianditu 表述有效。 tianditu 表述是(shì)将當前地(dì / de)圖與天地(dì / de)圖的(de)地(dì / de)圖服務疊加顯示,實現了(le/liǎo)簡單的(de)地(dì / de)圖功能,如縮放、量算等。tianditu 表述可以(yǐ)通過 URI.tdt 或 URI.tianditu 形式獲得。

例如,要(yào / yāo)獲得名爲(wéi / wèi) World Map 的(de)地(dì / de)圖的(de) tianditu 表述,可以(yǐ)用以(yǐ)下 URI:

http://supermapiserver:8090/iserver/services/map-world/rest/maps/World+Map.tdt

由于(yú)天地(dì / de)圖的(de)數據經過了(le/liǎo)脫密處理,tianditu 表述形式下,當前地(dì / de)圖與天地(dì / de)圖圖層的(de)疊加可能存在(zài)一(yī / yì /yí)定程度的(de)偏差。

iServer 對平面坐标系的(de)地(dì / de)圖不(bù)提供 tianditu 表述,因爲(wéi / wèi)平面坐标系的(de)地(dì / de)圖無法與天地(dì / de)圖的(de)地(dì / de)圖進行疊加。

wkt

對于(yú)地(dì / de)圖模塊的(de)=prjCoordSys資源,SuperMap iServer 提供了(le/liǎo) WKT 表述用于(yú)表達當前地(dì / de)圖坐标參考系統。WKT(Well-known Text)是(shì) OGC(開放地(dì / de)理空間聯盟)制定的(de)一(yī / yì /yí)種文本标記語言,用于(yú)表示幾何對象、坐标參考系統及坐标系之(zhī)間的(de)轉換。

prjCoordSys資源的(de) WKT 表述用于(yú)表達當前地(dì / de)圖的(de)坐标參考系統,如:

http://supermapiserver:8090/iserver/services/map-world/rest/maps/世界地(dì / de)圖/prjCoordSys.wkt

geojson

當資源是(shì)features、feature、featureResult、queryResult時(shí),geojson表述有效。GeoJSON是(shì)基于(yú)JSON表示法的(de)地(dì / de)理空間信息數據交換格式。

例如,要(yào / yāo)獲得 World 數據服務中索引号爲(wéi / wèi)0-13-19的(de) feature 資源的(de) GeoJSON 表述,可以(yǐ)使用以(yǐ)下URI:

http://supermapiserver:8090/iserver/services/data-World/rest/data/feature/0-13-19.geojson

可獲得名爲(wéi / wèi)0-13-19.geojson的(de)文件,文件可用文本編輯器打開,内容示例如下:

{  "geometry":null,

   "id":"20",

   "type":

       "Feature",

       "properties":  {

            "SQKM":"48775.27",

            "SMSDRIW":"16.84472",

            "SMSDRIS":"47.7375",

            "POP_1994":"5374362.0",

            "SMSDRIN":"49.60083",

            "SMID":"20",

            "COUNTRY":"斯洛伐克",

            "CONTINENT":"歐洲",

            "SMAREA":"4.892668943085318E10",

            "COLORID":"1",

            "SMPERIMETER":"1207821.0411783515",

            "SQMI":"18832.13",

            "SMGEOMETRYSIZE":"3544",

            "COLOR_MAP":"2",

            "CAPITAL":"布拉迪斯拉發",

            "SMSDRIE":"22.558052",

            "SMUSERID":"23"

                           }

}

openlayers3

當資源是(shì) map、layer 時(shí) openlayers 表述有效。openlayers 表述是(shì)針對 JavaScript 客戶端的(de)應用,實現了(le/liǎo)簡單的(de)地(dì / de)圖功能,如縮放、量算等。

例如,要(yào / yāo)獲得名爲(wéi / wèi) World Map 的(de)地(dì / de)圖的(de) openlayers 表述,可以(yǐ)用以(yǐ)下 URI:

http://supermapiserver:8090/iserver/representations/openlayers3/map.html?serviceName=map-World&mapName=World

openlayers3 with MVT

當資源是(shì) map、dataset 時(shí) openlayers with MVT 表述有效。openlayers(with MVT) 表述是(shì)針對 JavaScript 客戶端的(de)應用,實現依照 Mapbox 矢量瓦片規範來(lái)浏覽地(dì / de)圖矢量要(yào / yāo)素。

例如,要(yào / yāo)獲得名爲(wéi / wèi) World Map 的(de)地(dì / de)圖的(de) openlayers with MVT 表述,可以(yǐ)用以(yǐ)下 URI:

http://supermapiserver:8090/iserver/openlayers3/map.html?serviceName=map-World&mapName=World&isMvt=true

leaflet

當資源是(shì) map 時(shí) leaflet 表述有效。leaflet 表述是(shì)針對 JavaScript 客戶端的(de)應用,實現了(le/liǎo)簡單的(de)地(dì / de)圖功能,如縮放、量算等。

例如,要(yào / yāo)獲得名爲(wéi / wèi) World Map 的(de)地(dì / de)圖的(de) leaflet 表述,可以(yǐ)用以(yǐ)下 URI:

http://supermapiserver:8090/iserver/representations/leaflet/map.html?serviceName=map-World&mapName=World

mapboxgl

當資源是(shì) map 時(shí),且地(dì / de)圖的(de)投影坐标系爲(wéi / wèi)3857、4326、4490、4214、4610 時(shí),mapboxgl 表述有效。mapboxgl 表述是(shì)針對 JavaScript 客戶端的(de)應用,實現了(le/liǎo)簡單的(de)地(dì / de)圖功能,如縮放、量算等。mapboxgl 表述僅支持浏覽地(dì / de)圖矢量要(yào / yāo)素。

例如,要(yào / yāo)獲得名爲(wéi / wèi) China 的(de)地(dì / de)圖的(de) mapboxgl 表述,可以(yǐ)用以(yǐ)下 URI:

http://supermapiserver:8090/iserver/representations/mapboxgl/map.html?serviceName=map-World&mapName=World

WebGL3D

當資源是(shì) map,且地(dì / de)圖不(bù)是(shì)平面坐标系時(shí),WebGL3D 表述有效。WebGL3D實現了(le/liǎo)簡單的(de)三維地(dì / de)圖功能,如縮放、旋轉等。

例如,要(yào / yāo)獲得名爲(wéi / wèi) World 的(de)地(dì / de)圖的(de) WebGL3D 表述,可以(yǐ)用以(yǐ)下 URI:

http://supermapiserver:8090/iserver/representations/webgl3d/map.html?serviceName=map-World&mapName=World

FlatGeobuf

當資源是(shì) featureResults、featureResult、queryResults、queryResult、connectedEdges、traceDown、traceUp、geometryOverlayResult (geometry)、geometryBufferResult (geometry)、datasetBufferResult、datasetOverlayResult、datasetIsolineResult、datasetIsoregionResult、datasetThiessenPolygonResult、geometryBufferResult (spatialAnalyst)、geometryOverlayResult (spatialAnalyst)、geometryIsolineResult、 geometryIsoregionResult、 geometryThiessenPolygonResult 時(shí),FlatGeobuf 表述有效。FlatGeobuf 是(shì)一(yī / yì /yí)種基于(yú) flatbuffers,能容納簡單要(yào / yāo)素(Simple Features)規範下數據的(de)二進制編碼格式,具有文件較小,能夠分段傳輸和(hé / huò)局部加載的(de)特點。FlatGeobuf 表述可以(yǐ)通過 URI.fgb 形式獲得。

例如,要(yào / yāo)獲得 World 數據服務中 Capitals 數據集 ID 爲(wéi / wèi)1-3 的(de)要(yào / yāo)素查詢結果的(de) FlatGeobuf 表述,可以(yǐ)用以(yǐ)下 URI:

         http://supermapiserver:8090/iserver/services/data-World/rest/data/featureResults/d935257d1b284a3c9c187f65d8417b12_71377342b8b742deb45ea5fd4c58bf45.fgb

可獲得名爲(wéi / wèi) d935257d1b284a3c9c187f65d8417b12_71377342b8b742deb45ea5fd4c58bf45.fgb 的(de)文件,可用 QGIS 等軟件打開進行使用。