Output Formats


SuperMap iServer server respond to the HTTP request on client, If the client performs a GET request, the resource will return the representation of that resource; if the client performs a PUT, POST, or DELETE request, the resource will return the representation of the operation result. There are multiple formats of representations, like html, xml, json, rjson, jsonp, png, bmp, gif, jpg, jpeg, flex, flash3d, javascript, silverlight, supermapcloud, tianditu, etc. In which png, bmp, gif, jpg and jpeg are the representations specific to image resource, flex, flash3d, javascript, silverlight, supermapcloud and tianditu are the representations supported by map resource and layer resource.

The format of the representation is specified in the URI of HTTP request, the format is to add .<format> behind URI. For instance, perform GET request on http://supermapiserver:8090/iserver/services/map-changchun/rest/maps.json , the maps resource representation in json format will be returned.

If <format> is not specified, then the SuperMap iServer will return the the corresponding representation in the default html format.

Note: When there are error getting image resource representation, if it is Debug mode (set by the debug field in the REST configuration item in AppContext.xml, debug=true means the Debug mode, the default is true), the error information is returned in form of html, the error information will be returned in form of json otherwise.

SuperMap iServer supports all the output formats:

     

 

html

HTML is the default output format for non-image resources. An HTML page is returned. HTML can easily represent a table, and use a standard class to represent the table type.

For example, the following URI can be used to retrieve the HTML representation of the maps service:

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

Because html is the default output format for non-image resources, it does not have to be specified here, as shown in the following URI:

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

Below is an example of returned representation:

<!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>maps</h1>

                        ……

                        <b>Description:</b>

                        ……

                        <b>Maps:</b>

                        ……

                        <span><strong>HTTP methods</strong></span>

                        ……

                        <span><strong>Output formats</strong></span>

                        ……

        </div>

</body>

</html>

Display in IE:

xml

An xml file is returned. A series of XML terms are defined in SuperMap iServer to represent resources more correctly.

For example, the following URI can be used to retrieve the XML representation of the maps service:

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

Below is an example of returned representation:

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

<list>

 <ChildResource>

  <name>WorldMap</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

Return a KML page, available when the resource is map, features or feature. KML (Keyhole Markup Language) is a GoolgleEarth file format, it is based on XML grammar and used to describe and save geographic information elements like point, line, image, polygonal line, etc, and display in application systems like Google Earth and Google Map.

For example, the following URI can be used to retrieve the KML representation of the features service:

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

Below is an example of returned representation:

<?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>

The following URI can be used to retrieve the KML representation of the map service:

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

georss

Return a page in GeoRSS format, available when the resource is features or feature. GeoRSS is a standard based on GML and launched by OGC, it uses XML language to store and pass geographic data, and describe and store geographic information elements like point, line and region. GeoRSS provides two formats GeoRSS Simple and GeoRSS GML Profile. GeoRSS Simple is supported in SuperMap iServer currently.

For instance, data-changchun/rest service has a dataset named Park, to get the georss representation of the feature with the index 0-0-0, the following URI can be used(for the request URI of the feature resource, please refer to feature resource introduction):

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

Below is an example of returned representation:

<?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>Chaoyanggongyuan</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'>Chaoyanggongyuan</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>Chaoyanggongyuan</td><td>4597.873059</td><td>-4567.922216</td></tr></table>]]></description>

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

</item>

</channel>

</rss>

json

A JSON string is returned. JSON (JavaScript Object Notation) is a notation for JavaScript objects. It is a lightweight data interchange format, and can represent ordinary data structures.

For example, the following URI can be used to retrieve the JSON representation of the maps resource:

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

Below is an example of returned representation:

[

    {

        "resourceConfigID": "map",

        "name": "ChangChunCityMap",

        "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

JSON is the default output format for PUT, POST, DELETE, and HEAD requests. Returned is a formatted JSON string that is easier to read.

For example, the following URI can be used to retrieve the RJSON representation of the maps resource:

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

Below is an example of returned representation:

[{

    "name": "ChangChunCityMap",

    "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) is a supplemental format to the JSON format, designed for clients to achieve cross-domain access.

For example, the following URI can be used to retrieve the JSONP representation of the maps resource, with the name of the callback function specified as mycallbackname:

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

Below is an example of returned representation:

callBack11893434([{"resourceConfigID":"map","name":"ChangChunCityMap","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

A PNG image is returned by request. Valid only when the resource is an image resource.

For example, the following URI can be used to retrieve the current display of a map named ChangChunCityMap, in PNG format:

http://supermapiserver:8090/iserver/services/map-changchun/rest/maps/ChangChunCityMap/image.png

bmp

A BMP image is returned by request. Valid only when the resource is an image resource.

For example, the following URI can be used to retrieve the current display of a map named World, in BMP format:

http://supermapiserver:8090/iserver/services/map-changchun/rest/maps/ChangChunCityMap/image.bmp

gif

A GIF image is returned by request. Valid only when the resource is an image resource.

For example, the following URI can be used to retrieve the current display of a map named ChangChunCityMap, in GIF format:

http://supermapiserver:8090/iserver/services/map-changchun/rest/maps/ChangChunCityMap/image.gif

jpg

A JPEG image is returned by request. Valid only when the resource is an image resource.

For example, the following URI can be used to retrieve the current display of a map named ChangChunCityMap, in JPEG format:

http://supermapiserver:8090/iserver/services/map-changchun/rest/maps/ChangChunCityMap/image.jpg

flex

When the resource is map or layer, flex representation is available. Flex representation is used in flex client, and realize simple map operations like zoom, measuring, etc. Flex representation can be get by URI.ifx or URI.flex format.

For example, the following URI can be used to retrieve the flex representation of a map named World Map, in BMP format:

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

javascript

When the resource is map or layer, javascript representation is available. javascript representation is used in javascript client, and realize simple map operations like zoom, measuring, etc. javascript representation can be get by URI.ijs or URI.javascript format.

For example, the following URI can be used to retrieve the javascript representation of a map named World Map, in BMP format:

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

silverlight

When the resource is map or layer, silverlight representation is available. silverlight representation is used in silverlight client, and realize simple map operations like zoom, measuring, etc. silverlight representation can be get by URI.isl or URI.silverlight format.

For example, the following URI can be used to retrieve the silverlight representation of a map named World Map, in BMP format:

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

supermapcloud

The supermapcloud representation is available when the resource is map or layer. supermapcloud representation is used in SuperMap cloud service application, overlay the current map and the SuperMap cloud service map to realize simple map operations like zoom and measure. Supermapcloud representation can be got by URI.smc or URI.supermapcloud.

For example, the following URI can be used to retrieve the supermapcloud representation of a map named World Map, in BMP format:

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

iServer does not provide supermapcloud format for the map in planar coordinate system.

iServer does not provide supermapcloud format for the map in planar coordinate system.

tianditu

The tianditu representation is available when the resource is map or layer. tianditu representation is used in SuperMap cloud service application, overlay the current map and the SuperMap cloud service map to realize simple map operations like zoom and measure. tianditu representation can be got by URI.tdt or URI.tianditu .

For example, the following URI can be used to retrieve the tianditu representation of a map named World Map, in BMP format:

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

Since the tianditu data is deciphered, the current map map have deviation with the tianditu layer.

iServer does not provide tianditu format for the map in planar coordinate system.

wkt

For the prjCoordSys resource of map module, SuperMap iServer provided the WKT representation to express the current coordinate system.

The WKT representation of prjCoordSysresource is used to express the coordinate system of the current map, for example:

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

Flash3D

When the resource is map or layer, Flash3D representation is available. Flash3D representation is used in Flash3D client, and realize simple 3D scene operations like zoom, panning, etc. Flash3D representation can be get by URI.flash3d.

For example, the following URI can be used to retrieve the Flash3D representation of a map named World Map, in BMP format:

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

geojson

The geojson expression is valid when the resource is features, feature, featureResult, queryResult. GeoJSON is a geospatial information data exchange format based on JSON notation.

For example, to get a GeoJSON representation of a feature resource with index number 0-13-19 in the World Data Service, you could use the following URI:

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

A file named 0-13-19.geojson will be returned, it can be opened with a text editor, the content is shown as follows:

{  "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":"Slovakia",

            "CONTINENT":"Europe",

            "SMAREA":"4.892668943085318E10",

            "COLORID":"1",

            "SMPERIMETER":"1207821.0411783515",

            "SQMI":"18832.13",

            "SMGEOMETRYSIZE":"3544",

            "COLOR_MAP":"2",

            "CAPITAL":"Bratislava",

            "SMSDRIE":"22.558052",

            "SMUSERID":"23"

                           }

}

openlayers

The openlayers representation is valid when the resource is map, layer. Openlayers representation is an application for JavaScript client, which implemented simple map functions, such as scaling, measurement and so on. The openlayers representation is in form of URI.ol3.

For example, to obtain an openlayers representation of a map named World Map, the following URI can be used:

http://supermapiserver:8090/iserver/services/map-World/rest/maps/World.ol3

leaflet

The leaflet representation is valid when the resource is map, layer. leaflet representation is an application for JavaScript client, which implemented simple map functions, such as scaling, measurement and so on. The leaflet representation is in form of URI.leaflet.

For example, to obtain an leaflet representation of a map named World Map, the following URI can be used:

http://supermapiserver:8090/iserver/services/map-World/rest/maps/World.leaflet