HOW TO
The MAP ArcXML tag uses the dynamic attribute to add layers to a mapservice on the fly without having to add them to the mapservice configuration AXL file. This article provides an example of enabling the HTML viewer to accomplish this task.
Code:
<MAP>
Code:
<MAP dynamic="true" />
Code:
deBugOn = 3;
Code:
addDynLayer = true;
Code:
if (parent.MapFrame.allowOptions) {
// Options. . . requiers aimsOptions.js... allowOptions is set to true in this file
document.write('<td align="center" valign="middle">');
document.write('<img src="images/wrench.gif" width=16 height=16 hspace=1 vspace=1 border=0 alt=" ' + t.buttonList[40] + '" onmousedown="parent.MapFrame.writeOptionForm();" onmouseover="window.status=\' ' + t.buttonList[40] + '\'">');
isSecond = !isSecond
document.writeln('</td>');
if (isSecond) document.write('</tr><tr>');
}
if (parent.MapFrame.canLoad) {
// Load MapService. . . requires aimsGeneric.js
document.write('<td align="center" valign="middle">');
document.write('<img src="images/open_1.gif" width=16 height=16 hspace=1 vspace=1 border=0 alt=" ' + t.buttonList[41] + '" onmousedown="parent.MapFrame.loadMapForm();" onmouseover="window.status=\' ' + t.buttonList[41] + '\'">');
document.writeln('</td>');
}
Code:
if (parent.MapFrame.allowOptions) {
// Options. . . requiers aimsOptions.js... allowOptions is set to true in this file
document.write('<td align="center" valign="middle">');
document.write('<img src="images/wrench.gif" width=16 height=16 hspace=1 vspace=1 border=0 alt=" ' + t.buttonList[40] + '" onmousedown="parent.MapFrame.writeOptionForm();" onmouseover="window.status=\' ' + t.buttonList[40] + '\'">');
isSecond = !isSecond
document.writeln('</td>');
if (isSecond) document.write('</tr><tr>');
}
if (parent.MapFrame.addDynLayer) {
document.write('<td align="center" valign="middle">');
document.write('<img src="images/wrench.gif" width=16 height=16 hspace=1 vspace=1 border=0 alt="Add Dynamic Layer" onmousedown="parent.MapFrame.clickFunction(\'CustomAXL\');" onmouseover="window.status=\'Add Dynamic Layer \'">');
isSecond = !isSecond
document.writeln('</td>');
if (isSecond) document.write('</tr><tr>');
}
if (parent.MapFrame.canLoad) {
// Load MapService. . . requires aimsGeneric.js
document.write('<td align="center" valign="middle">');
document.write('<img src="images/open_1.gif" width=16 height=16 hspace=1 vspace=1 border=0 alt=" ' + t.buttonList[41] + '" onmousedown="parent.MapFrame.loadMapForm();" onmouseover="window.status=\' ' + t.buttonList[41] + '\'">');
document.writeln('</td>');
}
Code:
function clickFunction (toolName) {
if (hasLayer("measureBox"))
hideLayer("measureBox");
switch(toolName) {
// Zooming functions
case "zoomin":
Code:
function clickFunction (toolName) {
if (hasLayer("measureBox"))
hideLayer("measureBox");
switch(toolName) {
// Zooming functions
case "CustomAXL":
if (aimsCustomPresent){
aimsCustomPresent=false
} else {
aimsCustomPresent=true;
}
parent.MapFrame.sendMapXML();
break
case "zoomin":
Code:
if (aimsCustomPresent) theString += addCustomToMap1();
Code:
aimsCustomPresent=true;
Code:
aimsCustomPresent=false;
Code:
function addCustomToMap1(){
var customString = "";
/*
customString += '<LAYER type="ACETATE" name="theMode">\n';
customString += '<OBJECT units="PIXEL">\n<TEXT coord="5 ' + (iHeight-10) + '" label="This is a test">\n';
customString += '<TEXTMARKERSYMBOL fontstyle="BOLD" fontsize="12" font="ARIAL" fontcolor="' + modeMapColor + '" ';
customString += 'threed="TRUE" glowing="' + modeMapGlow + '" />\n</TEXT>\n</OBJECT>';
customString += '\n</LAYER>\n';
*/
return customString;
}
Code:
function addCustomToMap1(){
var customString = "";
customString += '<WORKSPACES>\n';
customString += '<SHAPEWORKSPACE name="shp_ws-1" directory="C:/Program Files/ArcGIS/ArcIMS/Samples/TutorialData" />\n';
customString += '</WORKSPACES>\n';
customString += '<LAYER type="featureclass" name="cities" visible="true" id="2">\n';
customString += '<DATASET name="cities" type="point" workspace="shp_ws-1" />\n';
customString += '<SIMPLERENDERER>\n';
customString += '<SIMPLEMARKERSYMBOL color="255,0,0" width="20" />\n';
customString += '</SIMPLERENDERER>\n';
customString += '</LAYER>\n';
return customString;
}
Article ID:000002383
Get help from ArcGIS experts
Download the Esri Support App