• Increase font size
  • Decrease font size
  • Print
  • RSS
  • Wrapper mgmap.cfm URL Parameters

    Don't be intimidated by the many Wrapper parameters. The vast majority of maps only need the required path parameter to specify the MWF file and optionally the scriptpath parameter to specify MapGuide API code for the map. Other parameters may be useful for special situations, during development, or debugging.

    Linking to the Wrapper and your MapGuide Map is a good introduction to the parameters with examples of commonly used Wrapper URL parameters and their use.

    Required and commonly used parameters

    path Required Gives the path to the MWF for the map. The path may be a relative path to the Wrapper installation directory. Must be the first parameter. i.e. mgmap.cfm?path=

    Examples:

    dotmap65.mwf is in the same directory as the Wrapper (mgmap.cfm):
    mgmap.cfm?path=dotmap65.mwf
    Relative to the root of the web site:
    mgmap.cfm?path=/maps/mapguide/dotmap65.mwf
    Fully qualified path for MWF's on another server:
    mgmap.cfm?path=http://gis.pima.gov/maps/mapguide/dotmap65.mwf
    scriptpath Optional Specifies the path to an optional file with <script> tags that include or reference JavaScript, VBscript or other script code to be include in the map frame. The path may be a relative path to the Wrapper installation directory. The scriptpath parameter is typically used to support MapGuide API applications and is the preferred parameter for specifying API code.
     

    The scriptpath parameter causes the contents of the specified file to be included ahead of the <HTML> tag for the generated map frame. Therefore, in theory, it could be used to include content other than <script> tags, but it's not expected that there would be any reason to use scriptpath for anything besides <script> tags. ColdFusion code can be used in the file specified with scriptpath as well. You may find it helpful to use one or more ColdFusion CFINCLUDE tags in to help modularize your code.

    The included file may have any file extension such as .htm, or .inc. (We use the ".inc" extension so it's clear that the file is intended to be included rather than being used directly in a URL.) The scriptpath parameter is useful when more than one JavaScript file or VBscript file needs to be loaded. In this case, the file specified by scriptpath would include as many <script> tags as needed with the src parameter or <script> tags with inline JavaScript or VBscript code for each needed JavaScript and/or VBscript file.

    If just one JavaScript and/or VBscript file is needed, it's a bit less code to use the jspath or vbspath parameters. On the other hand, scriptpath is more versatile and is usually the best choice right from the start as additional script code can be added without changing the URL.

    appname Optional Specifies a map application identifier which mgmaptitleframe.cfm or any other frame can use to customize its contents, such as links, forms, MapGuide API controls, etc. This is used by Pima County's title frame. The appname parameter can be ignored by other sites that replace the title frame entirely.
    titleframeheight Optional

    Specifies the height of the title frame in pixels. The default title frame height is 40 pixels.

    This parameter is useful for applications that require a larger title frame for form controls or other text. It's also helpful to use a large value such as titleframeheight=400 during title frame development to see text associated with title frame errors.

    This parameter is available in Wrapper releases starting January 23, 2006.

    (Standard MWF URL parameters) Optional

    MWF URL parameters as defined by Autodesk. The Wrapper simply passes these parameters on to the MWF URL. For instance, parameters such as lat, lon, and width are useful to specify the initial map view.

    For Wrapper releases starting February 25, 2006, standard MWF parameter values for ObjectLinkTarget and ReportTarget may also be specified in the mgmapsettings.inc file. If either or both of these parameters are added as mgmap.cfm URL parameters, the added mgmap.cfm parameter values override the values specified in the mgmapsettings.inc file.


    Less frequently used parameters

    onload Optional Text to be included in the map frame's <body> tag onLoad parameter and typically used in conjunction with a scriptpath, jspath or vbspath URL parameter.

    The onload parameter allows specifying JavaScript or other action to be executed immediately after the map is loaded and all objects are defined. This is useful to specify a function that does required map initialization with the MapGuide API.

    An onload variable may also be defined in JavaScript specified by the scriptpath, jspath, vbspath or (obsolete) headerjspath parameters. In fact, defining an onload variable in JavaScript is preferable to using the onload parameter. For example if your initialization JavaScript function is mapInit, that function can have:

    var onload = 'javascript:mapInit("mapparm")';
       or probably just
    var onload = 'javascript:mapInit()';

    If onload is defined in both the URL and as JavaScript variable, the URL value takes precedence.

    If you use the onload URL parameter and quotes are needed, the single quote character must be used. While some web browsers such as IE, handle reserved URL characters in some cases without encoding, it is recommended that all URL reserved characters be encoded. For instance, the colon should be encoded:

    onload=javascript%3AmapInit('mapparm')
       or probably just
    onload=javascript%3AmapInit()

    It never hurts to encode additional characters that might be problematic. For instance, parenthesis should probably be encoded too:

    onload=javascript%3AmapInit%28'mapparm'%29
       or probably just
    onload=javascript%3AmapInit%28%29

    For more on URL encoding and an online URL encoder, see URL Encoding. Here's an API initialization example using both jspath and onload URL parameters:

    &jspath=MyMapAPI.js&onload=javascript%3AmapInit%28%29

    where the MyMapAPI.js file contains the JavaScript mapInit function.

    onunload Optional

    Text to be included in the map frame's <body> tag onUnload parameter and typically used in conjunction with a scriptpath, jspath or vbspath URL parameter.

    The onunload parameter allows specifying JavaScript or other action to be executed when the map is unloaded (such as by navigation to another window, the browser back button, or window refresh). This is useful to specify a function that does map termination processing such as closing child windows opened during the map session.

    onunload works just like the onload parameter except it specifies processing to be performed at unload time. See the onload parameter documentation for details.

    disclaimer=no Optional disclaimer=no prevents the disclaimer popop from being displayed. "no" is the only valid disclaimer parameter value. This might be useful to omit the disclaimer when displaying subsequent maps in the map window under control of the title frame (or other frames that may be defined in mgmap.cfm).
    requiredversion Optional Specifies the required MapGuide Viewer Version such as 6 or 6.3 for the map to be displayed. Useful to override the site-wide required Viewer version in mgmapsettings.inc
    jspath Optional Specifies the path to an optional JavaScript file to be included in the map frame page HEADER. The path may be a relative path to the Wrapper installation directory. Typically used to support MapGuide API applications. Include only JavaScript code itself without the <script> tag. If more than one JavaScript file needs to be referenced, use the scriptpath parameter. Generally, using scriptpath right from the start is little more effort and is more versatile and expandable.
    vbspath Optional Specifies the path to an optional VBscript file to be included in the map frame page HEADER. The path may be a relative path to the Wrapper installation directory. Typically used to support MapGuide API applications. Include only VBcript code itself without the <script> tag. If more than one VBscript file needs to be referenced, use the scriptpath parameter. Generally, using scriptpath right from the start is little more effort and is more versatile and expandable.
    use Optional Forces the specified type of MapGuide Viewer to be used, regardless of what is detected. Note that you can force situations that aren't supported and may not work.
      use=java  forces the Java Viewer
      use=plugin  forces the plugin Viewer
      use=activex  forces the ActiveX Control Viewer
    Other values are ignored. If the use parameter is used to force a certain viewer type (use=java, use=plugin, use=activex) then the Wrapper skips trying to update the viewer if it's not the forced type. In other words, the user may be on their own if they force a particular viewer type that may not be compatible with the current or perceived browser environment.
    skipinstall=yes Optional skipinstall=yes forces skipping suggesting any installs or upgrades to the MapGuide Viewer. "yes" is the only valid skipinstall parameter value. Makes the Wrapper run with whatever Viewer believes it has or with whatever is specified in the "use" parameter, for better or worse. For instance, this is useful when a plugin is installed but not fully detected because the particular web browser and the plugin don't support the API needed to determine the plug-in version. Therefore, it thinks the plug-in isn't there and tries to install it. skipinstall=yes may allow running on some web browsers which would otherwise try to force an installation or default to the Java Viewer.

    Obsolete parameter

    headerjspath Optional The headerjspath parameter is OBSOLETE and is provided only for compatibility with old user code. Function provided by the headerjspath parameter is now provided by the scriptpath parameter.


    headerjspath
    specifies the path to an optional file with document.write() JavaScript statements that generate code to be included in the map frame page HEADER. The path may be a relative path to the Wrapper installation directory. Typically used to support MapGuide API applications. The included file may have any file extension such as .cfm or .inc.

    headerjspath is useful when more than one JavaScript file or VBscript file needs to be loaded. In this case, the file specified by headerjspath would include as many document.write() statements as needed, generating <script> tags with the src parameter or <script> tags with inline JavaScript or VBscript code for each needed JavaScript and/or VBscript file. The generated ending script tags must escape the slash character to avoid prematurely ending the overall JavaScript program. i.e. <\/SCRIPT>.

    While headerjspath is intended to generate <script> tags, the referenced file may use document.write() to generate any desired HEADER content. If just one JavaScript and/or VBscript file is needed, it's easier to use the jspath or vbspath parameters.


    Follow UsShare this page

    Geographic Information Systems

    33 N. Stone Ave., 15th Fl.
    Mail-Stop Code DTBAB17-425
    Tucson, AZ 85701

    Phone: (520) 724-6670
    Fax: (520) 791-6588


    Department Home Page
    Department News
    Department Directory
    Department Feedback Form
    Maps