{{{ #!html

Rendering Service HTTP APIs

}}} ---- '''Revision History''' ||'''Revision'''||'''Date'''||'''Author'''||'''Comment'''|| ||0.1||April 28, 2010||Trevor Wekel||Documentation for !GetDynamicMapOverlayImage|| [[PageOutline(1-3,Table of Contents,inline)]] = Overview = This document describes the Rendering Service HTTP APIs supported by the !MapGuide mapagent. The Rendering Service APIs are used to render a map into a bitmapped image. In addition to bitmap rendering, the APIs support basic updates to the underlying !MgMap object state including changes to center, scale, and layer visibility. = !MapGuide 2.1 APIs = == !GetDynamicMapOverlayImage == === Overview === !GetDynamicMapOverlayImage returns a rendered raster image containing all visbile layers at the current center and scale for the map. This API is used in conjuction with the !GetVisibleMapExtent HTTP API to provide dynamic map updates for end user interactions. === Parameters === || '''Name''' || '''Value''' || '''Required''' || '''Description''' || || [#Operation1.0 OPERATION] || GETDYNAMICMAPOVERLAYIMAGE || Yes || Operation to execute || || [#Version1.0 VERSION] || 2.1.0 || Yes || Operation version || || [#ClientAgent2.1 CLIENTAGENT] || text || Optional || Descriptive text for client || || [#Session1.0 SESSION] || session identifier || Yes || !MapGuide session identifier containing map to display || || [#MapName1.0 MAPNAME] || text || Yes || Name of the map to display.[[BR]]This corresponds to the !GetName() value for the resource identifier. || || [#Format1.0 FORMAT] || JPG/PNG/PNG8 || Yes || Image format for rendered image || || [#SelectionColor2.0 SELECTIONCOLOR] || RGBA hex color || Yes || Selection color encoded in hexadecimal RGBA format 0xRRGGBBAA. || || [#Behavior2.0 BEHAVIOR] || bitmask || Yes || Bitmask representing rendering behavior. See below for more details.|| || [#SetViewCenterX1.0 SETVIEWCENTERX] || double || Optional || Set X coordinate for center of map. || || [#SetViewCenterY1.0 SETVIEWCENTERY] || double || Optional || Set Y coordinate for center of map. || || [#SetViewScale1.0 SETVIEWSCALE] || double || Optional || Set scale for map. || || [#SetDisplayDpi1.0 SETDISPLAYDPI] || integer || Optional || Set DPI for map. || || [#SetDisplayWidth1.0 SETDISPLAYWIDTH] || integer || Optional || Set width of image in pixels. || || [#SetDisplayHeight1.0 SETDISPLAYHEIGHT] || integer || Optional || Set height of image in pixels. || || [#ShowLayers1.0 SHOWLAYERS] || text || Optional || List of layers to display. || || [#HideLayers1.0 HIDELAYERS] || text || Optional || List of layers to hide. || || [#ShowGroups1.0 SHOWGROUPS] || text || Optional || List of groups to display. || || [#HideGroups1.0 HIDEGROUPS] || text || Optional || List of groups to hide. || ==== CLIENTAGENT Parameter ==== #ClientAgent2.1 Descriptive text describing the client of the HTTP operation. Currently used values include "Ajax Viewer", "Fusion Viewer" "!MapGuide Developer" and "!MapGuide Maestro". === Usage === {{{ http://localhost/mapguide/mapagent.fcgi?OPERATION=GETDYNAMICMAPOVERLAYIMAGE &VERSION=2.1.0 &SESSION=Session:d5d05422-5f75-102c-8000-02004c4f4f50_en_7F0000010AFC0AFB0AFA &MAPNAME=WorldElevation &FORMAT=PNG8 &BEHAVIOR=7 &SELECTIONCOLOR=0xFF000080 &SETVIEWCENTERX=-114.0 &SETVIEWCENTERY=51.0 &SETVIEWSCALE=50000 &SETDISPLAYHEIGHT=500 &SETDISPLAYWIDTH=500 &SHOWLAYERS=d5d01111-5f75-102c-8000-02004c4f4f50,d5d01118-5f75-102c-8000-02004c4f4f50 }}} Sets center of map to (-114,51) and scale to 1:50000. Turns on layers d5d01111 and d5d01118. The visible layers and any selection are then rendered as a 500 by 500 eight bit PNG image. The selection is drawn in partially transparent red. === Technical Notes === == !GetMapImage == === Overview === === Parameters === === Usage === === Technical Notes === == !GetMapLegendImage == === Overview === === Parameters === === Usage === === Technical Notes === == !GetVisibleMapExtent == === Overview === === Parameters === === Usage === === Technical Notes === == !QueryMapFeatures == === Overview === === Parameters === === Usage === === Technical Notes === = !MapGuide 2.0 APIs = == !GetDynamicMapOverlayImage == === Overview === !GetDynamicMapOverlayImage returns a rendered raster image containing all visbile layers at the current center and scale for the map. This API is used in conjuction with the !GetVisibleMapExtent HTTP API to provide dynamic map updates for end user interactions. === Parameters === || '''Name''' || '''Value''' || '''Required''' || '''Description''' || || [#Operation1.0 OPERATION] || GETDYNAMICMAPOVERLAYIMAGE || Yes || Operation to execute || || [#Version1.0 VERSION] || 2.0.0 || Yes || Operation version || || [#Session1.0 SESSION] || session identifier || Yes || !MapGuide session identifier containing map to display || || [#MapName1.0 MAPNAME] || text || Yes || Name of the map to display.[[BR]]This corresponds to the !GetName() value for the resource identifier. || || [#Format1.0 FORMAT] || JPG/PNG/PNG8 || Yes || Image format for rendered image || || [#Behavior2.0 BEHAVIOR] || bitmask || Yes || Bitmask representing rendering behavior. See below for more details.|| || [#SelectionColor2.0 SELECTIONCOLOR] || RGBA hex color || Yes || Selection color encoded in hexadecimal RGBA format 0xRRGGBBAA. || ==== BEHAVIOR Parameter ==== #Behavior2.0 The behavior parameter specifies how the rendering is performed. The value is encoded as a bitmask to facilitate future enhancements to the API. One or more bits may be combined to determine overall rendering behavior. || '''Value''' || '''Description''' || || 1 (!RenderSelection) || Renders the selected feature(s) || || 2 (!RenderLayers)|| Renders the features on the map || || 4 (!KeepSelection) || Renders the selected feature(s) even if they are outside the current scale || Examples: * BEHAVIOR=3 (!RenderSelection|!RenderLayers) will render selection and layers within the current scale * BEHAVIOR=5 (!RenderSelection|!KeepSelection) will render only the selection regardless of scale ==== SELECTIONCOLOR Parameter ==== #SelectionColor2.0 Color for selected objects expressed in hexadecimal RGBA format 0xRRGGBBAA. === Usage === {{{ http://localhost/mapguide/mapagent.fcgi?OPERATION=GETDYNAMICMAPOVERLAYIMAGE &VERSION=2.0.0 &SESSION=Session:d5d05422-5f75-102c-8000-02004c4f4f50_en_7F0000010AFC0AFB0AFA &MAPNAME=WorldElevation &FORMAT=PNG &BEHAVIOR=5 &SELECTIONCOLOR=0xFF000080 }}} Renders the selection regardless of current scale for the !WorldElevation map from session Session:d5d05422-5f75-102c-8000-02004c4f4f50_en_7F0000010AFC0AFB0AFA as a 32 bit PNG image. The selection is drawn in partially transparent red. === Technical Notes === = !MapGuide 1.2 APIs = == !GetDynamicMapOverlayImage == === Overview === !GetDynamicMapOverlayImage returns a rendered raster image containing all visible layers at the current center and scale for the map. This API is used in conjuction with the !GetVisibleMapExtent HTTP API to provide dynamic map updates for end user interactions. === Parameters === || '''Name''' || '''Value''' || '''Required''' || '''Description''' || || [#Operation1.0 OPERATION] || GETDYNAMICMAPOVERLAYIMAGE || Yes || Operation to execute || || [#Version1.0 VERSION] || 1.0.0 || Yes || Operation version || || [#Session1.0 SESSION] || session identifier || Yes || !MapGuide session identifier containing map to display || || [#MapName1.0 MAPNAME] || text || Yes || Name of the map to display.[[BR]]This corresponds to the !GetName() value for the resource identifier. || || [#Format1.0 FORMAT] || JPG/PNG || Yes || Image format for rendered image || || [#KeepSelection1.0 KEEPSELECTION] || 0/1 || Optional || If true, render selected feature(s) even if they are outside the current scale. || === Usage === {{{ http://localhost/mapguide/mapagent.fcgi?OPERATION=GETDYNAMICMAPOVERLAYIMAGE &VERSION=1.0.0 &SESSION=Session:d5d05422-5f75-102c-8000-02004c4f4f50_en_7F0000010AFC0AFB0AFA &MAPNAME=WorldElevation &FORMAT=PNG }}} Renders the !WorldElevation map from session Session:d5d05422-5f75-102c-8000-02004c4f4f50_en_7F0000010AFC0AFB0AFA as a 32 bit PNG image. === Technical Notes === == !GetMapImage == === Overview === !GetMapImage returns a rendered raster image containing all visible layers for the map. This API can be used to generate a raster image for a currently displayed map in the session repository or to display the initial view display an image for is used in conjuction with the !GetVisibleMapExtent HTTP API to provide dynamic map updates for end user interactions. === Parameters === || '''Name''' || '''Value''' || '''Required''' || '''Description''' || || [#Operation1.0 OPERATION] || GETMAPIMAGE || Yes || Operation to execute || || [#Version1.0 VERSION] || 1.0.0 || Yes || Operation version || || [#Session1.0 SESSION] || session identifier || Optional || !MapGuide session identifier containing map to display.[[BR]]SESSION or USERNAME and PASSWORD must be specified. || || [#Username1.0 USERNAME] || text || Optional || !MapGuide user id.[[BR]]SESSION or USERNAME and PASSWORD must be specified.|| || [#Password1.0 PASSWORD] || text || Optional || Password for !MapGuide user.[[BR]]SESSION or USERNAME and PASSWORD must be specified. || || [#MapName1.0 MAPNAME] || text || Optional || Name of the map to display.[[BR]]This corresponds to the !GetName() value for the resource identifier.[[BR]]MAPNAME or MAPDEFINITION must be specified. || || [#MapDefinition1.0 MAPDEFINITION] || text || Optional || Name of the map to display.[[BR]]This corresponds to the !GetName() value for the resource identifier.[[BR]]MAPNAME or MAPDEFINITION must be specified. || || [#Format1.0 FORMAT] || JPG/PNG || Yes || Image format for rendered image || || [#KeepSelection1.0 KEEPSELECTION] || 0/1 || Optional || If true, render selected feature(s) even if they are outside the current scale. || || [#SetViewCenterX1.0 SETVIEWCENTERX] || double || Optional || Set X coordinate for center of map. || || [#SetViewCenterY1.0 SETVIEWCENTERY] || double || Optional || Set Y coordinate for center of map. || || [#SetViewScale1.0 SETVIEWSCALE] || double || Optional || Set scale for map. || || [#SetDisplayDpi1.0 SETDISPLAYDPI] || integer || Optional || Set DPI for map. || || [#SetDisplayWidth1.0 SETDISPLAYWIDTH] || integer || Optional || Set width of image in pixels. || || [#SetDisplayHeight1.0 SETDISPLAYHEIGHT] || integer || Optional || Set height of image in pixels. || || [#ShowLayers1.0 SHOWLAYERS] || text || Optional || List of layers to display. || || [#HideLayers1.0 HIDELAYERS] || text || Optional || List of layers to hide. || || [#ShowGroups1.0 SHOWGROUPS] || text || Optional || List of groups to display. || || [#HideGroups1.0 HIDEGROUPS] || text || Optional || List of groups to hide. || ==== OPERATION Parameter ==== #Operation1.0 Name of HTTP operation to execute. This parameter is case sensitive. Operation names should be all uppercase. ==== VERSION Parameter ==== #Version1.0 Version of operation to execute. This version number corresponds to the version of !MapGuide where the operation was changed or introduced. ==== SESSION Parameter ==== #Session1.0 Session identifier for the map. The session identifier is typically created using MgSite::!CreateSession() or the CREATESESSION HTTP operation. ==== USERNAME Parameter ==== #Username1.0 !MapGuide user id with permission to access the map definition. ==== PASSWORD Parameter ==== #Username1.0 Password for !MapGuide user. ==== MAPNAME Parameter ==== #MapName1.0 The map name is the resource name of the map. For example "!WorldElevation" is the resource name for "!Library://Maps/World/WorldElevation.MapDefinition". ==== FORMAT Parameter ==== #Format1.0 Image format for the rendered image. Legal values are: * "JPG" for 24 bit JPEG * "PNG" for 32 bit PNG * "PNG8" for 8 bit PNG '''Note: This was added in !MapGuide 2.0.''' ==== KEEPSELECTION Parameter ==== #KeepSelection1.0 Determines whether the selection is visible outside of the scale range for the selected feature(s). If "1", the selection will be visible even when the feature scale range is outside of the current map scale. ==== SETVIEWCENTERX Parameter ==== #SetViewCenterX1.0 Sets the X coordinate for the center of the map. The coordinate is given in map coordinate system units. ==== SETVIEWCENTERY Parameter ==== #SetViewCenterY1.0 Sets the Y coordinate for the center of the map. The coordinate is given in map coordinate system units. ==== SETVIEWSCALE Parameter ==== #SetViewScale1.0 Sets the currently viewed scale for the map. This number should be greater than zero. ==== SETDISPLAYDPI Parameter ==== #SetDisplayDpi1.0 Sets the display resolution for the device. Typically 96 or 120 DPI. ==== SETDISPLAYWIDTH Parameter ==== #SetDisplayWidth1.0 Sets the width of the resulting image in pixels. ==== SETDISPLAYHEIGHT Parameter ==== #SetDisplayHeight1.0 Sets the height of the resulting image in pixels. ==== SHOWLAYERS Parameter ==== #ShowLayers1.0 Comma separated list of the MgLayer::!GetObjectId() values for layers to show. Previously shown layers will continue to be shown. ==== HIDELAYERS Parameter ==== #HideLayers1.0 Comma separated list of the MgLayer::!GetObjectId() values for layers to hide. Previously hidden layers will remain hidden. ==== SHOWGROUPS Parameter ==== #ShowGroups1.0 Comma separated list of the MgGroup::!GetObjectId() values for groups to show. Previously shown groups will continue to be shown. Layers within the groups will retain their current hide/show status. ==== HIDEGROUPS Parameter ==== #HideGroups1.0 Comma separated list of the MgGroup::!GetObjectId() values for groups to hide. Previously hidden groups will remain hidden. Layers within the groups will retain their current hide/show status. === Usage === {{{ http://localhost/mapguide/mapagent.fcgi?OPERATION=GETMAPIMAGE &VERSION=1.0.0 &SESSION=Session:d5d05422-5f75-102c-8000-02004c4f4f50_en_7F0000010AFC0AFB0AFA &MAPNAME=WorldElevation &FORMAT=PNG &SETVIEWCENTERX=-114.0 &SETVIEWCENTERY=51.0 &SETVIEWSCALE=50000 &SETDISPLAYHEIGHT=500 &SETDISPLAYWIDTH=500 &SHOWLAYERS=d5d01111-5f75-102c-8000-02004c4f4f50,d5d01118-5f75-102c-8000-02004c4f4f50 }}} Sets center of map to (-114,51) and scale to 1:50000. Turns on layers d5d01111 and d5d01118. The visible layers are rendered as a 500 by 500 eight bit PNG image. Any selection already defined by web extensions API calls will be drawn in blue. Changes to center, scale and layer visibility are retained. {{{ http://localhost/mapguide/mapagent.fcgi?OPERATION=GETMAPIMAGE &VERSION=1.0.0 &USERNAME=Anonymous &PASSWORD= &MAPDEFINITION=Library://Maps/World/WorldElevation.MapDefinition &FORMAT=PNG &SETVIEWCENTERX=-114.0 &SETVIEWCENTERY=51.0 &SETVIEWSCALE=50000 &SETDISPLAYHEIGHT=500 &SETDISPLAYWIDTH=500 &SHOWLAYERS=d5d01111-5f75-102c-8000-02004c4f4f50,d5d01118-5f75-102c-8000-02004c4f4f50 }}} Creates a temporary map. Sets center of map to (-114,51) and scale to 1:50000. Turns on layers d5d01111 and d5d01118. The visible layers are rendered as a 500 by 500 eight bit PNG image. No selection is defined or drawn. === Technical Notes ===