<map_uri>/image[.<format>]
ERROR: Variable (map_link) is undefined.
The image resource, as a child resource of the map resource, is used to get an image of the map resource. It only supports the GET operation. When performing the GET request, some parameters can be included to customize the image, including the display window size, the extent of the display area, the center point of the map, target projection of dynamic projection and so on. To return a map image, the parameters must be included in the URI and must not be put inside the request body. The default output format of the map images is PNG.
Please refer to Gets the map images, Map zoom in, zoom out and pan for information about this resource usage.
Supported Methods:
Supported output formats: PNG, BMP, GIF, JPG, RJSON, JSON, HTML, XML, KML.
Implement the HTTP request on the following URI, where supermapiserver is the server name and WorldMap is the map name {mapName}, with PNG being the output format.
http://supermapiserver:8090/iserver/services/map-world/rest/maps/WorldMap/image.png
Gets the image of the map.
Some parameters may be included when performing the GET request on the image resources. If the parameters are included, the server would return the image according to these parameters; if not included, the server would return the image according to the current state of the map. The parameters must be included in the URI and cannot be put inside the request body.
Name | Type | Description |
redirect | boolean | Whether to redirect the request. This is a concept regarding HTTP transport. If the value is true, the request will be redirected to the real address of the image; if the value is false, the response body will then include the byte stream of the image. The default is false. |
center | Point2D | Specifies the center point of the map display. |
scale | double | Specify the scale of the map. See definition of scale. |
width | int | Specifies the width of the display window/the output image. Must be used together with height. Priority is higher than viewer. |
height | int | Specifies the height of the display window/the output image. Must be used together with width. Priority is higher than viewer. |
viewer | The rectangle object | Specifies the size of the display window/the output image. The default size is 256*256 pixels. |
layersID | String | The ID of the layer to output. See Definition of layersID in tileImage. |
transparent | boolean | Whether the map image is transparent or not. |
viewBounds | Rectangle2D | Specifies the geographic extent of the map view. |
dynamicProjection | boolean | Whether to allow dynamic projection while displaying the map. |
prjCoordSys | PrjCoordSys | The coordinate system requested. Request the coordinate system of the map. The system will perform dynamic projection if the coordinate system set by this parameter is different from the map's original coordinate system, and the map image after dynamic projection will be returned. When using this parameter, you should construct it with the fields in PrjCoordSys, input coordinate system by just pass epsgCode is also supported, such as: prjCoordSys={"epsgCode":3857}。 |
random | boolean | Whether to output the map randomly, the default is False. The two parameters scale, center not specified will be assigned randomly within their range if this parameter is set to true. |
_cache | boolean | Whether to use cache, the default is True. False means close all the caches. |
customParams | String | Custom parameters They can be strings with any combination of characters. This is for users to pass any custom parameters. |
rectifyType | RectifyType | The rectification method . |
clipRegion | Geometry | The clipped region on the map for display. This is an areal object, and is supported only when clipRegionEnabled = true, indicating that only the part of the map covered by clipRegion will be displayed. |
clipRegionEnabled | boolean | Whether clipRegion is enabled. |
customEntireBounds | Rectangle2D | Custom map boundary. Valid when customEntireBoundsEnabled is true. |
customEntireBoundsEnabled | boolean | Whether customEntireBounds is enabled. |
angle | double | The rotation angle of the map. |
antialias | boolean | Whether the map is anti-alias. |
backgroundStyle | Style | The background style of the map. |
colorMode | MapColorMode | The color mode of the map. |
markerAngleFixed | boolean | Whether the angle of marker symbols is fixed. |
maxVisibleTextSize | double | The maximum visible size (in pixels) of the text. |
maxVisibleVertex | int | The maximum visible vertices of the geometric object. If a geometric feature has more than maxVisibleVertex vertices, the extra vertices will not be displayed. |
minVisibleTextSize | double | The minimum visible size (in pixels) of the text. |
overlapDisplayed | boolean | Whether to display the objects when the map object is in the same extent. The default is False. If it is true, the objects in the same extent will be directly overlapped; If it is False, it doesn't display through overlapDisplayedOptions. |
overlapDisplayedOptions | OverlapDisplayedOptions | Avoid the map object overlapping the filter options. When the overlapDisplayed is false, it is used to enhance the processing when map objects overlap. |
paintBackground | boolean | Whether to render the background of the map. |
textAngleFixed | boolean | Whether the angles of the text are fixed. |
textOrientationFixed | boolean | Whether the orientations of the text are fixed. |
An image will be returned if the output format is specified as PNG, BMP, GIF or JPG if you want to get the map image directly.
If you want to get the image information, you can specify the output format as RJSON, JSON, HTML or XML. The structure of the response will be as follows:
Field | Type | Description |
customResponse | String | The custom response. |
imageData | byte[] | The binary stream of the map image. |
lastModified | long | The last modified time of the map. |
imageUrl | String | A URI directed to the map image in PNG format. |
mapParam | MapParameter | Map parameters. |
Implement GET request on the entireImage resource with http://supermapiserver:8090/iserver/services/map-world/rest/maps/WorldMap/image.png?center={"x":96.17,"y":27.57}&scale=0.000000025632 and return the response in PNG, as showed below:
Request the image on the dynamically projected image resource above, implement GET request: http://supermapiserver:8090/iserver/services/map-world/rest/maps/WorldMap/image.png?center={"x":10706007.29,"y":3258532.62}&scale=0.000000022573&prjCoordSys={"epsgCode":3857}, as shows in the right figure of the table below.
Original output effect | Dynamic projection output effect |
Returns the same HTTP response header as GET does, but no response entity is included. HEAD request can be used to get metadata from the response message header without transporting the entire response content. Metadata includes information about the media type, character encoding, compression encoding, the length of the entity content, etc. The HEAD operation of the image resource can also have request parameters similar to those in the GET operation.
The HEAD request helps check the existence of the image resource and whether it can be accessed by the client. By implementing the HEAD request on the URI, with .<format> appended to the end, we can quickly get to know whether the image resource supports the representation in <format> or not.