<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML xmlns="http://www.w3.org/TR/REC-html40" xmlns:v =
"urn:schemas-microsoft-com:vml" xmlns:o =
"urn:schemas-microsoft-com:office:office" xmlns:w =
"urn:schemas-microsoft-com:office:word" xmlns:st1 =
"urn:schemas-microsoft-com:office:smarttags"><HEAD><TITLE>FW: Remove layers at runtime</TITLE>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.3020" name=GENERATOR><BASE
href=https://nngowa.nngco.com/exchange/Shane.Buscher/Drafts/RE:%20%5bMapguide_users%5d%20FW:%20Remove%20layers%20at%20runtime.EML/1_text.htm><!--[if !mso]>
<STYLE>v\:* {
        BEHAVIOR: url(#default#VML)
}
o\:* {
        BEHAVIOR: url(#default#VML)
}
w\:* {
        BEHAVIOR: url(#default#VML)
}
.shape {
        BEHAVIOR: url(#default#VML)
}
</STYLE>
<![endif]--><o:SmartTagType name="City"
namespaceuri="urn:schemas-microsoft-com:office:smarttags"></o:SmartTagType><o:SmartTagType
name="place"
namespaceuri="urn:schemas-microsoft-com:office:smarttags"></o:SmartTagType><!--[if !mso]>
<STYLE>st1\:* {
        BEHAVIOR: url(#default#ieooui)
}
</STYLE>
<![endif]-->
<STYLE>@font-face {
        font-family: Tahoma;
}
@font-face {
        font-family: StoneSans;
}
@page Section1 {size: 8.5in 11.0in; margin: 1.0in 1.25in 1.0in 1.25in; }
font-face {
        FONT-FAMILY: Tahoma
}
font-face {
        FONT-FAMILY: StoneSans
}
font-face {
        FONT-FAMILY: Tahoma
}
font-face {
        FONT-FAMILY: StoneSans
}
P.MsoNormal {
        FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New Roman"
}
LI.MsoNormal {
        FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New Roman"
}
DIV.MsoNormal {
        FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New Roman"
}
A:link {
        COLOR: blue; TEXT-DECORATION: underline
}
SPAN.MsoHyperlink {
        COLOR: blue; TEXT-DECORATION: underline
}
A:visited {
        COLOR: purple; TEXT-DECORATION: underline
}
SPAN.MsoHyperlinkFollowed {
        COLOR: purple; TEXT-DECORATION: underline
}
P {
        FONT-SIZE: 12pt; MARGIN-LEFT: 0in; MARGIN-RIGHT: 0in; FONT-FAMILY: "Times New Roman"; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto
}
SPAN.emailstyle18 {
        COLOR: navy; FONT-FAMILY: Arial
}
SPAN.emailstyle19 {
        COLOR: navy; FONT-FAMILY: Arial
}
SPAN.emailstyle20 {
        COLOR: navy; FONT-FAMILY: Arial
}
SPAN.EmailStyle21 {
        COLOR: navy; FONT-FAMILY: Arial; mso-style-type: personal
}
SPAN.EmailStyle22 {
        COLOR: navy; FONT-FAMILY: Arial; mso-style-type: personal-reply
}
DIV.Section1 {
        page: Section1
}
</STYLE>
</HEAD>
<BODY lang=EN-US vLink=purple link=blue>
<DIV dir=ltr align=left><SPAN class=834585623-15012007><FONT face=Arial
color=#0000ff size=2>Hi Shane,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=834585623-15012007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=834585623-15012007><FONT face=Arial
color=#0000ff size=2>Walt and I are digging through some code. What
version of MapGuide are you on?</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=834585623-15012007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=834585623-15012007><FONT face=Arial
color=#0000ff size=2>Thanks,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=834585623-15012007><FONT face=Arial
color=#0000ff size=2>Trevor</FONT></SPAN></DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> Buscher, Shane
[mailto:Shane.Buscher@nngco.com] <BR><B>Sent:</B> Monday, January 15, 2007 2:51
PM<BR><B>To:</B> Walt Welton-Lair;
mapguide-users@lists.osgeo.org<BR><B>Subject:</B> RE: [mapguide-users] RE:
[Mapguide_users] FW: Remove layers at runtime<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV class=Section1>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Walt,<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">My code works fine with
the <st1:City w:st="on"><st1:place w:st="on">AJAX</st1:place></st1:City> viewer,
so the refresh problem is related exclusively to the DWF viewer.
<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Here’s the results I’m
seeing in the DWF viewer after trying to remove layers at runtime:
<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><B><U><FONT face=Arial color=navy size=2><SPAN
style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Action
</SPAN></FONT></U></B><FONT face=Arial color=navy size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">
<B><U><SPAN
style="FONT-WEIGHT: bold">Result</SPAN></U></B><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Javascript Refresh()
Does
not remove layers<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Exec built in Refresh
command
Does
not remove layers<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Pan multiple times
Does
not remove layers<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Zoom In multiple
times
Does
not remove layers<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Zoom Out multiple times
Layers
are removed<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Remove layers when not
in their map extent Layers are removed<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Specifically, when
zooming out about 4-5 times the layers are consistently removed. Hope this
helps. <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">-shane<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT></P>
<DIV>
<DIV class=MsoNormal style="MARGIN-LEFT: 0.5in; TEXT-ALIGN: center"
align=center><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt">
<HR tabIndex=-1 align=center width="100%" SIZE=2>
</SPAN></FONT></DIV>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><B><FONT face=Tahoma size=2><SPAN
style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Tahoma">From:</SPAN></FONT></B><FONT
face=Tahoma size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma">
mapguide-users-bounces@lists.osgeo.org
[mailto:mapguide-users-bounces@lists.osgeo.org] <B><SPAN
style="FONT-WEIGHT: bold">On Behalf Of </SPAN></B>Walt Welton-Lair<BR><B><SPAN
style="FONT-WEIGHT: bold">Sent:</SPAN></B> Monday, January 15, 2007 3:22
PM<BR><B><SPAN style="FONT-WEIGHT: bold">To:</SPAN></B>
mapguide-users@lists.osgeo.org<BR><B><SPAN
style="FONT-WEIGHT: bold">Subject:</SPAN></B> RE: [mapguide-users] RE:
[Mapguide_users] FW: Remove layers at runtime</SPAN></FONT><o:p></o:p></P></DIV>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face=Arial color=blue
size=2><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial">There's a
server-side bug in the current MapGuide code where the DWF Viewer isn't properly
refreshed after a pan. I don't know if that bug made it into an actual
released build though. If it did then that could be related to the refresh
problem you're seeing. Try interacting with your map by simply panning a
little and let us know if the view updates correctly. The AJAX Viewer
doesn't have this problem.</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face=Arial color=blue
size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial">Walt</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"><o:p> </o:p></SPAN></FONT></P>
<DIV class=MsoNormal style="MARGIN-LEFT: 0.5in; TEXT-ALIGN: center"
align=center><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt">
<HR tabIndex=-1 align=center width="100%" SIZE=2>
</SPAN></FONT></DIV>
<P class=MsoNormal
style="MARGIN-BOTTOM: 12pt; MARGIN-LEFT: 0.5in; MARGIN-RIGHT: 0in; mso-margin-top-alt: 0in"><B><FONT
face=Tahoma size=2><SPAN
style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Tahoma">From:</SPAN></FONT></B><FONT
face=Tahoma size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"> Buscher,
Shane [mailto:Shane.Buscher@nngco.com] <BR><B><SPAN
style="FONT-WEIGHT: bold">Sent:</SPAN></B> Monday, January 15, 2007 10:12
PM<BR><B><SPAN style="FONT-WEIGHT: bold">To:</SPAN></B> Walt Welton-Lair;
Mapguide_users@lists.osgeo.org; Trevor Wekel<BR><B><SPAN
style="FONT-WEIGHT: bold">Subject:</SPAN></B> RE: [mapguide-users] RE:
[Mapguide_users] FW: Remove layers at runtime</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face=Arial color=navy
size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Walt/Trevor,<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face=Arial color=navy
size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face=Arial color=navy
size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">I’m
definitely refreshing by calling the Refresh method in the viewer api. My
exact code is below. I know the refresh gets executed successfully because
I see a quick status bar in the top left corner of the viewer flash. If I
comment out the javascript call, no status bar flashes. Furthermore, the
built-in RefreshMap command that you can add as a button in Studio doesn’t work
either after running the code snippet below.
<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face=Arial color=navy
size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face=Arial color=navy
size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">I also
know, according to the users guide p. 56, that you don’t have to refresh the map
from the client after adding layers because the LayerCollection takes care of
this for you. I’ve tested this when adding layers, and this is true.
I am somewhat assuming that removing a layer would be the same. I wonder
if there is a problem with the DWF viewer. I suppose I can try the
<st1:place w:st="on"><st1:City w:st="on">AJAX</st1:City></st1:place>
viewer… It might be really helpful if somebody could duplicate the
issue. <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face=Arial color=navy
size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face=Arial color=navy
size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Regards,<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face=Arial color=navy
size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face=Arial color=navy
size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Shane<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face=Arial color=navy
size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Courier New"
color=blue size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">Protected</SPAN></FONT><FONT
face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> <FONT color=blue><SPAN
style="COLOR: blue">Sub</SPAN></FONT> Button2_Click(<FONT color=blue><SPAN
style="COLOR: blue">ByVal</SPAN></FONT> sender <FONT color=blue><SPAN
style="COLOR: blue">As</SPAN></FONT> <FONT color=blue><SPAN
style="COLOR: blue">Object</SPAN></FONT>, <FONT color=blue><SPAN
style="COLOR: blue">ByVal</SPAN></FONT> e <FONT color=blue><SPAN
style="COLOR: blue">As</SPAN></FONT> System.EventArgs) <FONT color=blue><SPAN
style="COLOR: blue">Handles</SPAN></FONT>
Button1.Click<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Courier New"
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
<FONT color=green><SPAN style="COLOR: green">'Remove layers
</SPAN></FONT><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Courier New"
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
<FONT color=blue><SPAN style="COLOR: blue">Dim</SPAN></FONT> lyr0 <FONT
color=blue><SPAN style="COLOR: blue">As</SPAN></FONT> MgLayer =
map.GetLayers.GetItem(0)<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Courier New"
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
<FONT color=blue><SPAN style="COLOR: blue">Dim</SPAN></FONT> lyr1 <FONT
color=blue><SPAN style="COLOR: blue">As</SPAN></FONT> MgLayer =
map.GetLayers.GetItem(1)<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Courier New"
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
map.GetLayers.Remove(lyr0)<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Courier New"
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
map.GetLayers.Remove(lyr1)<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Courier New"
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
map.Save(resourceService)<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Courier New"
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><o:p> </o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Courier New"
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
<FONT color=green><SPAN style="COLOR: green">'emit javascript to refresh
map<o:p></o:p></SPAN></FONT></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Courier New"
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
<FONT color=blue><SPAN style="COLOR: blue">Dim</SPAN></FONT> scriptKey <FONT
color=blue><SPAN style="COLOR: blue">As</SPAN></FONT> <FONT color=blue><SPAN
style="COLOR: blue">String</SPAN></FONT> = <FONT color=maroon><SPAN
style="COLOR: maroon">"Refresh"<o:p></o:p></SPAN></FONT></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Courier New"
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
<FONT color=blue><SPAN style="COLOR: blue">If</SPAN></FONT> <FONT
color=blue><SPAN style="COLOR: blue">Not</SPAN></FONT>
Page.ClientScript.IsStartupScriptRegistered(<FONT color=blue><SPAN
style="COLOR: blue">Me</SPAN></FONT>.GetType, scriptKey) <FONT color=blue><SPAN
style="COLOR: blue">Then<o:p></o:p></SPAN></FONT></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Courier New"
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
<FONT color=blue><SPAN style="COLOR: blue">Dim</SPAN></FONT> javaScript <FONT
color=blue><SPAN style="COLOR: blue">As</SPAN></FONT> <FONT color=blue><SPAN
style="COLOR: blue">String</SPAN></FONT> = <FONT color=maroon><SPAN
style="COLOR: maroon">"parent.parent.mapFrame.Refresh();"<o:p></o:p></SPAN></FONT></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Courier New"
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
Page.ClientScript.RegisterStartupScript(<FONT color=blue><SPAN
style="COLOR: blue">Me</SPAN></FONT>.GetType, scriptKey, javaScript, <FONT
color=blue><SPAN
style="COLOR: blue">True</SPAN></FONT>)<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Courier New"
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
<FONT color=blue><SPAN style="COLOR: blue">End</SPAN></FONT> <FONT
color=blue><SPAN
style="COLOR: blue">If<o:p></o:p></SPAN></FONT></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Courier New"
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> <FONT
color=blue><SPAN style="COLOR: blue">End</SPAN></FONT> <FONT color=blue><SPAN
style="COLOR: blue">Sub</SPAN></FONT></SPAN></FONT><FONT face=Arial color=navy
size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face=Arial color=navy
size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"><o:p> </o:p></SPAN></FONT></P>
<DIV>
<DIV style="MARGIN-LEFT: 0.5in">
<DIV class=MsoNormal style="MARGIN-LEFT: 0.5in; TEXT-ALIGN: center"
align=center><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt">
<HR tabIndex=-1 align=center width="100%" SIZE=2>
</SPAN></FONT></DIV></DIV>
<P class=MsoNormal style="MARGIN-LEFT: 1in"><B><FONT face=Tahoma size=2><SPAN
style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Tahoma">From:</SPAN></FONT></B><FONT
face=Tahoma size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma">
mapguide-users-bounces@lists.osgeo.org
[mailto:mapguide-users-bounces@lists.osgeo.org] <B><SPAN
style="FONT-WEIGHT: bold">On Behalf Of </SPAN></B>Walt Welton-Lair<BR><B><SPAN
style="FONT-WEIGHT: bold">Sent:</SPAN></B> Monday, January 15, 2007 1:52
PM<BR><B><SPAN style="FONT-WEIGHT: bold">To:</SPAN></B>
Mapguide_users@lists.osgeo.org<BR><B><SPAN
style="FONT-WEIGHT: bold">Subject:</SPAN></B> RE: [mapguide-users] RE:
[Mapguide_users] FW: Remove layers at runtime</SPAN></FONT><o:p></o:p></P></DIV>
<P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"><o:p> </o:p></SPAN></FONT></P>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt">Yeah a missing refresh would make
sense. Isn't it the client's responsibility though to request the
refresh?<o:p></o:p></SPAN></FONT></P></DIV>
<BLOCKQUOTE style="MARGIN-TOP: 5pt; MARGIN-BOTTOM: 5pt; MARGIN-RIGHT: 0in">
<DIV>
<P class=MsoNormal
style="MARGIN-BOTTOM: 12pt; MARGIN-LEFT: 1in; MARGIN-RIGHT: 0in; mso-margin-top-alt: 0in"><FONT
face="Times New Roman" size=2><SPAN style="FONT-SIZE: 10pt">-----Original
Message----- <BR><B><SPAN style="FONT-WEIGHT: bold">From:</SPAN></B>
mapguide-users-bounces@lists.osgeo.org on behalf of Trevor Wekel
<BR><B><SPAN style="FONT-WEIGHT: bold">Sent:</SPAN></B> Mon 1/15/2007 7:12 PM
<BR><B><SPAN style="FONT-WEIGHT: bold">To:</SPAN></B> Buscher, Shane;
Mapguide_users@lists.osgeo.org <BR><B><SPAN
style="FONT-WEIGHT: bold">Cc:</SPAN></B> <BR><B><SPAN
style="FONT-WEIGHT: bold">Subject:</SPAN></B> [mapguide-users] RE:
[Mapguide_users] FW: Remove layers at
runtime</SPAN></FONT><o:p></o:p></P></DIV>
<P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face=Arial color=blue
size=2><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial">Hi
Shane,</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face=Arial color=blue
size=2><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial">Hmm... I
wonder if the viewer is not bothering to request the map overlay image
again? That would explain the behaviour you are
seeing.</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face=Arial color=blue
size=2><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial">Are you
using a Windows box as a client? Are you familiar with
Fiddler?</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face=Arial color=blue
size=2><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial">Fiddler
is an HTTP proxy that captures HTTP requests and responses. If you
install and use it, you should be able to see all the traffic between the
client and Web Extensions / MapAgent. There should be a
GETDYNAMICMAPOVERLAY request generated by the client. This request
should refresh the map and show the added/removed
layers.</SPAN></FONT><o:p></o:p></P>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face=Arial color=blue
size=2><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial">Also,
are you using Base Map layers (ie. tiled images)? Base Map layers should
not be changed on the fly. They should be considered static. This
is probably not an issue since you are adding dynamic layers but I just
figured I would check.</SPAN></FONT><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face=Arial color=blue
size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial">Thanks,</SPAN></FONT><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face=Arial color=blue
size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial">Trevor</SPAN></FONT><o:p></o:p></P></DIV>
<P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"><o:p> </o:p></SPAN></FONT></P>
<DIV style="MARGIN-LEFT: 0.5in">
<DIV class=MsoNormal style="MARGIN-LEFT: 0.5in; TEXT-ALIGN: center"
align=center><FONT face="Times New Roman" size=3><SPAN
style="FONT-SIZE: 12pt">
<HR tabIndex=-1 align=center width="100%" SIZE=2>
</SPAN></FONT></DIV></DIV>
<P class=MsoNormal
style="MARGIN-BOTTOM: 12pt; MARGIN-LEFT: 1in; MARGIN-RIGHT: 0in; mso-margin-top-alt: 0in"><B><FONT
face=Tahoma size=2><SPAN
style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Tahoma">From:</SPAN></FONT></B><FONT
face=Tahoma size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma">
Buscher, Shane [mailto:Shane.Buscher@nngco.com] <BR><B><SPAN
style="FONT-WEIGHT: bold">Sent:</SPAN></B> Monday, January 15, 2007 11:04
AM<BR><B><SPAN style="FONT-WEIGHT: bold">To:</SPAN></B> Trevor Wekel;
Mapguide_users@lists.osgeo.org<BR><B><SPAN
style="FONT-WEIGHT: bold">Subject:</SPAN></B> RE: [Mapguide_users] FW: Remove
layers at runtime</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face=Arial color=navy
size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Trevor,</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face=Arial color=navy
size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">I think
I found a big hint after testing what you suggested. When the layers I’m
trying to remove are within the map view extent, they do not ‘disappear’ upon
removing them. However, If the layers are completely outside the map
view extent they indeed get removed with the same code. It doesn’t
matter if it’s one layer or multiples. Hopefully this gives you
something to work with. </SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face=Arial color=navy
size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Regards,</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face=Arial color=navy
size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Shane</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<DIV>
<DIV style="MARGIN-LEFT: 0.5in">
<DIV style="MARGIN-LEFT: 0.5in">
<DIV class=MsoNormal style="MARGIN-LEFT: 0.5in; TEXT-ALIGN: center"
align=center><FONT face="Times New Roman" size=3><SPAN
style="FONT-SIZE: 12pt">
<HR tabIndex=-1 align=center width="100%" SIZE=2>
</SPAN></FONT></DIV></DIV></DIV>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><B><FONT face=Tahoma
size=2><SPAN
style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Tahoma">From:</SPAN></FONT></B><FONT
face=Tahoma size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"> Trevor
Wekel [mailto:trevor.wekel@autodesk.com] <BR><B><SPAN
style="FONT-WEIGHT: bold">Sent:</SPAN></B> Monday, January 15, 2007 11:18
AM<BR><B><SPAN style="FONT-WEIGHT: bold">To:</SPAN></B> Buscher, Shane;
Mapguide_users@lists.osgeo.org<BR><B><SPAN
style="FONT-WEIGHT: bold">Subject:</SPAN></B> RE: [Mapguide_users] FW: Remove
layers at runtime</SPAN></FONT><o:p></o:p></P></DIV>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face=Arial color=blue
size=2><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial">Hi
Shane,</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face=Arial color=blue
size=2><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial">My
bad. I've been working with the Mapguide 1.1.x and trunk branches.
You are working on the released 1.0.x branch. Sorry for the
confusion. 1.0.x does not have the boolean
return.</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face=Arial color=blue
size=2><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial">Is there
any difference if you try to remove only one layer so there are still
layers on the map?</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face=Arial color=blue
size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial">Thanks,</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face=Arial color=blue
size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial">Trevor</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<DIV style="MARGIN-LEFT: 0.5in">
<DIV style="MARGIN-LEFT: 0.5in">
<DIV class=MsoNormal style="MARGIN-LEFT: 0.5in; TEXT-ALIGN: center"
align=center><FONT face="Times New Roman" size=3><SPAN
style="FONT-SIZE: 12pt">
<HR tabIndex=-1 align=center width="100%" SIZE=2>
</SPAN></FONT></DIV></DIV></DIV>
<P class=MsoNormal
style="MARGIN-BOTTOM: 12pt; MARGIN-LEFT: 1.5in; MARGIN-RIGHT: 0in; mso-margin-top-alt: 0in"><B><FONT
face=Tahoma size=2><SPAN
style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Tahoma">From:</SPAN></FONT></B><FONT
face=Tahoma size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma">
Buscher, Shane [mailto:Shane.Buscher@nngco.com] <BR><B><SPAN
style="FONT-WEIGHT: bold">Sent:</SPAN></B> Saturday, January 13, 2007 1:31
PM<BR><B><SPAN style="FONT-WEIGHT: bold">To:</SPAN></B> Trevor Wekel;
Mapguide_users@lists.osgeo.org<BR><B><SPAN
style="FONT-WEIGHT: bold">Subject:</SPAN></B> RE: [Mapguide_users] FW: Remove
layers at runtime</SPAN></FONT><o:p></o:p></P>
<DIV id=idOWAReplyText61961>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face=Arial color=black
size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: Arial">Trevor,</SPAN></FONT><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">MgLayerCollection.Remove doesn't
return a boolean according to the api documentation, and also doesn't indicate
it in the intellisense. </SPAN></FONT><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Regards,</SPAN></FONT><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Shane</SPAN></FONT><o:p></o:p></P></DIV></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<DIV style="MARGIN-LEFT: 0.5in">
<DIV style="MARGIN-LEFT: 0.5in">
<DIV class=MsoNormal style="MARGIN-LEFT: 0.5in; TEXT-ALIGN: center"
align=center><FONT face="Times New Roman" size=3><SPAN
style="FONT-SIZE: 12pt">
<HR tabIndex=-1 align=center width="100%" SIZE=2>
</SPAN></FONT></DIV></DIV></DIV>
<P class=MsoNormal
style="MARGIN-BOTTOM: 12pt; MARGIN-LEFT: 1.5in; MARGIN-RIGHT: 0in; mso-margin-top-alt: 0in"><B><FONT
face=Tahoma size=2><SPAN
style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Tahoma">From:</SPAN></FONT></B><FONT
face=Tahoma size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"> Trevor
Wekel [mailto:trevor.wekel@autodesk.com]<BR><B><SPAN
style="FONT-WEIGHT: bold">Sent:</SPAN></B> Fri 1/12/2007 5:18 PM<BR><B><SPAN
style="FONT-WEIGHT: bold">To:</SPAN></B> Buscher, Shane;
Mapguide_users@lists.osgeo.org<BR><B><SPAN
style="FONT-WEIGHT: bold">Subject:</SPAN></B> RE: [Mapguide_users] FW: Remove
layers at runtime</SPAN></FONT><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face=Arial color=blue
size=2><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial">Hi
Shane,</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face=Arial color=blue
size=2><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial">Remove()
should returns a boolean true or false. false indicates that the layer
was not removed. Can you see if the remove was successful? (just trying
to debug a bit)</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face=Arial color=blue
size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial">Thanks,<BR>Trevor</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<DIV style="MARGIN-LEFT: 0.5in">
<DIV style="MARGIN-LEFT: 0.5in">
<DIV class=MsoNormal style="MARGIN-LEFT: 0.5in; TEXT-ALIGN: center"
align=center><FONT face="Times New Roman" size=3><SPAN
style="FONT-SIZE: 12pt">
<HR tabIndex=-1 align=center width="100%" SIZE=2>
</SPAN></FONT></DIV></DIV></DIV>
<P class=MsoNormal
style="MARGIN-BOTTOM: 12pt; MARGIN-LEFT: 1.5in; MARGIN-RIGHT: 0in; mso-margin-top-alt: 0in"><B><FONT
face=Tahoma size=2><SPAN
style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Tahoma">From:</SPAN></FONT></B><FONT
face=Tahoma size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma">
Buscher, Shane [mailto:Shane.Buscher@nngco.com] <BR><B><SPAN
style="FONT-WEIGHT: bold">Sent:</SPAN></B> Friday, January 12, 2007 4:13
PM<BR><B><SPAN style="FONT-WEIGHT: bold">To:</SPAN></B> Trevor Wekel;
Mapguide_users@lists.osgeo.org<BR><B><SPAN
style="FONT-WEIGHT: bold">Subject:</SPAN></B> RE: [Mapguide_users] FW: Remove
layers at runtime</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face=Arial color=navy
size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Trevor,</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face=Arial color=navy
size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Thanks
for the response. I think I’m doing everything you suggested correctly,
but have provided the snippets below. When the page loads the
ConnectToMapGuide() method gets called, which opens up the MgMap and sets it
to a module level variable (map). Then, Button1 is clicked which
successfully adds two layers to the map. When Button2 gets invoked, I
try to remove the layers but the layers still persist in the map.
</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face=Arial color=navy
size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">I’m not
sure where to go from here. Do you need to copy the layers in session,
then add them from there in order to have the ability to remove them?
Just reaching…</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face=Arial color=navy
size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Regards,</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face=Arial color=navy
size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Shane</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face="Courier New"
color=green size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'">‘class
vars</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face="Courier New"
color=blue size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">Private</SPAN></FONT><FONT
face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> resourceService <FONT
color=blue><SPAN style="COLOR: blue">As</SPAN></FONT>
MgResourceService</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face="Courier New"
color=blue size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">Private</SPAN></FONT><FONT
face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> map <FONT
color=blue><SPAN style="COLOR: blue">As</SPAN></FONT>
MgMap</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face="Courier New"
color=blue size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">Private</SPAN></FONT><FONT
face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> <FONT color=blue><SPAN
style="COLOR: blue">Sub</SPAN></FONT>
ConnectToMapGuide()</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face="Courier New"
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
<FONT color=green><SPAN style="COLOR: green">'Connect to MapGuide
site</SPAN></FONT></SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face="Courier New"
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
<FONT color=blue><SPAN style="COLOR: blue">Dim</SPAN></FONT> userInfo <FONT
color=blue><SPAN style="COLOR: blue">As</SPAN></FONT> <FONT color=blue><SPAN
style="COLOR: blue">New</SPAN></FONT> MgUserInformation(Session.Item(<FONT
color=maroon><SPAN
style="COLOR: maroon">"mgSessionId"</SPAN></FONT>))</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face="Courier New"
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
<FONT color=blue><SPAN style="COLOR: blue">Dim</SPAN></FONT> siteConn <FONT
color=blue><SPAN style="COLOR: blue">As</SPAN></FONT> <FONT color=blue><SPAN
style="COLOR: blue">New</SPAN></FONT>
MgSiteConnection</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face="Courier New"
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
siteConn.Open(userInfo)</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face="Courier New"
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
<FONT color=green><SPAN style="COLOR: green">'set resource
service</SPAN></FONT></SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face="Courier New"
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
resourceService =
siteConn.CreateService(MgServiceType.ResourceService)</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face="Courier New"
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
<FONT color=green><SPAN style="COLOR: green">'Open
map</SPAN></FONT></SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face="Courier New"
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
map = <FONT color=blue><SPAN style="COLOR: blue">New</SPAN></FONT>
MgMap</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face="Courier New"
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
map.Open(resourceService, Session.Item(<FONT color=maroon><SPAN
style="COLOR: maroon">"mgMapName"</SPAN></FONT>))</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face="Courier New"
color=blue size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">End</SPAN></FONT><FONT
face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> <FONT color=blue><SPAN
style="COLOR: blue">Sub</SPAN></FONT></SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face="Courier New"
color=blue size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">Protected</SPAN></FONT><FONT
face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> <FONT color=blue><SPAN
style="COLOR: blue">Sub</SPAN></FONT> Button1_Click(<FONT color=blue><SPAN
style="COLOR: blue">ByVal</SPAN></FONT> sender <FONT color=blue><SPAN
style="COLOR: blue">As</SPAN></FONT> <FONT color=blue><SPAN
style="COLOR: blue">Object</SPAN></FONT>, <FONT color=blue><SPAN
style="COLOR: blue">ByVal</SPAN></FONT> e <FONT color=blue><SPAN
style="COLOR: blue">As</SPAN></FONT> System.EventArgs) <FONT color=blue><SPAN
style="COLOR: blue">Handles</SPAN></FONT>
Button1.Click</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face="Courier New"
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
<FONT color=green><SPAN style="COLOR: green">‘add dwf
layer</SPAN></FONT></SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in; TEXT-INDENT: 0.5in"><FONT
face="Courier New" color=blue size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">
Dim</SPAN></FONT><FONT face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> schematicId <FONT
color=blue><SPAN style="COLOR: blue">As</SPAN></FONT> <FONT color=blue><SPAN
style="COLOR: blue">New</SPAN></FONT>MgResourceIdentifier _
</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 2in; TEXT-INDENT: 0.5in"><FONT
face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">(<FONT color=maroon><SPAN
style="COLOR: maroon">"Library://VST/Layers/SouthOmahaTeamSchematic.LayerDefinition"</SPAN></FONT>)</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face="Courier New"
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
<FONT color=blue><SPAN style="COLOR: blue">Dim</SPAN></FONT> schematic <FONT
color=blue><SPAN style="COLOR: blue">As</SPAN></FONT> MgLayer =
CreateLayer(schematicId, <FONT color=blue><SPAN
style="COLOR: blue">False</SPAN></FONT>)</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face="Courier New"
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
map.GetLayers.Insert(index,
schematic)</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face="Courier New"
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
<FONT color=green><SPAN style="COLOR: green">‘add sdf
layer</SPAN></FONT></SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 2in"><FONT face="Courier New"
color=blue size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">
Dim</SPAN></FONT><FONT face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> valveId <FONT
color=blue><SPAN style="COLOR: blue">As</SPAN></FONT> <FONT color=blue><SPAN
style="COLOR: blue">New</SPAN></FONT> MgResourceIdentifier _
</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 2in; TEXT-INDENT: 0.5in"><FONT
face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">(<FONT color=maroon><SPAN
style="COLOR: maroon">"Library://VST/Layers/SouthOmahaValves.LayerDefinition"</SPAN></FONT>)</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face="Courier New"
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
<FONT color=blue><SPAN style="COLOR: blue">Dim</SPAN></FONT> valves <FONT
color=blue><SPAN style="COLOR: blue">As</SPAN></FONT> MgLayer =
CreateLayer(valveId, <FONT color=blue><SPAN
style="COLOR: blue">True</SPAN></FONT>)</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face="Courier New"
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
map.GetLayers.Insert(index, valves)</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face="Courier New"
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face="Courier New"
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
map.Save(resourceService)</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face="Courier New"
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
<FONT color=green><SPAN style="COLOR: green">'emit javascript to refresh
map</SPAN></FONT></SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face="Courier New"
color=blue size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">End</SPAN></FONT><FONT
face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> <FONT color=blue><SPAN
style="COLOR: blue">Sub</SPAN></FONT></SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face="Courier New"
color=blue size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">Protected</SPAN></FONT><FONT
face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> <FONT color=blue><SPAN
style="COLOR: blue">Sub</SPAN></FONT> Button2_Click(<FONT color=blue><SPAN
style="COLOR: blue">ByVal</SPAN></FONT> sender <FONT color=blue><SPAN
style="COLOR: blue">As</SPAN></FONT> <FONT color=blue><SPAN
style="COLOR: blue">Object</SPAN></FONT>, <FONT color=blue><SPAN
style="COLOR: blue">ByVal</SPAN></FONT> e <FONT color=blue><SPAN
style="COLOR: blue">As</SPAN></FONT> System.EventArgs) <FONT color=blue><SPAN
style="COLOR: blue">Handles</SPAN></FONT>
Button2.Click</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face="Courier New"
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
<FONT color=blue><SPAN style="COLOR: blue">Dim</SPAN></FONT> lyr0 <FONT
color=blue><SPAN style="COLOR: blue">As</SPAN></FONT> MgLayer =
map.GetLayers.GetItem(0)</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face="Courier New"
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
<FONT color=blue><SPAN style="COLOR: blue">Dim</SPAN></FONT> lyr1 <FONT
color=blue><SPAN style="COLOR: blue">As</SPAN></FONT> MgLayer =
map.GetLayers.GetItem(1)</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face="Courier New"
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
map.GetLayers.Remove(lyr0)</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face="Courier New"
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
map.GetLayers.Remove(lyr1)</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face="Courier New"
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
map.Save(resourceService)</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face="Courier New"
size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
<FONT color=green><SPAN style="COLOR: green">'emit javascript to refresh
map</SPAN></FONT></SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face="Courier New"
color=blue size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">End</SPAN></FONT><FONT
face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> <FONT color=blue><SPAN
style="COLOR: blue">Sub</SPAN></FONT></SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 1.5in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<DIV>
<DIV style="MARGIN-LEFT: 0.5in">
<DIV style="MARGIN-LEFT: 0.5in">
<DIV class=MsoNormal style="MARGIN-LEFT: 0.5in; TEXT-ALIGN: center"
align=center><FONT face="Times New Roman" size=3><SPAN
style="FONT-SIZE: 12pt">
<HR tabIndex=-1 align=center width="100%" SIZE=2>
</SPAN></FONT></DIV></DIV></DIV>
<P class=MsoNormal style="MARGIN-LEFT: 2in"><B><FONT face=Tahoma size=2><SPAN
style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Tahoma">From:</SPAN></FONT></B><FONT
face=Tahoma size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma"> Trevor
Wekel [mailto:trevor.wekel@autodesk.com] <BR><B><SPAN
style="FONT-WEIGHT: bold">Sent:</SPAN></B> Friday, January 12, 2007 3:37
PM<BR><B><SPAN style="FONT-WEIGHT: bold">To:</SPAN></B> Buscher, Shane;
Mapguide_users@lists.osgeo.org<BR><B><SPAN
style="FONT-WEIGHT: bold">Subject:</SPAN></B> RE: [Mapguide_users] FW: Remove
layers at runtime</SPAN></FONT><o:p></o:p></P></DIV>
<P class=MsoNormal style="MARGIN-LEFT: 2in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 2in"><FONT face=Arial color=blue
size=2><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial">Hi
Shane,</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 2in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 2in"><FONT face=Arial color=blue
size=2><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial">This
should work. During your setup, are you calling MgMap.Open() or
MgMap.Create()? The MgMap.Open() should set up the resource identifier
correctly so that Save() will have the map to the correct session
repository.</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 2in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 2in"><FONT face=Arial color=blue
size=2><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial">Is the
session id being propagated correctly? If you can do the following and
the layer appears in the viewer then the session should be
ok.</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 2in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 2in"><FONT face=Arial color=blue
size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial">MgMap.Open()</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 2in"><FONT face=Arial color=blue
size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial">MgMap.GetLayers().Insert(layer)</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 2in"><FONT face=Arial color=blue
size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial">MgMap.Save()</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 2in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 2in"><FONT face=Arial color=blue
size=2><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial">If the
Insert() works and Remove() doesn't</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 2in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 2in"><FONT face=Arial color=blue
size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial">MgMap.Open()</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 2in"><FONT face=Arial color=blue
size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial">MgMap.GetLayers().Remove(layer)</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 2in"><FONT face=Arial color=blue
size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial">MgMap.Save()</SPAN></FONT><o:p></o:p></P>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 2in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 2in"><FONT face=Arial color=blue
size=2><SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial">Then
this is probably a bug. Also, does the behaviour depend on the number
remaining layers?</SPAN></FONT><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 2in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 2in"><FONT face=Arial color=blue
size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial">Thanks,</SPAN></FONT><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 2in"><FONT face=Arial color=blue
size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial">Trevor</SPAN></FONT><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 2in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 2in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P></DIV>
<DIV style="MARGIN-LEFT: 0.5in">
<DIV style="MARGIN-LEFT: 0.5in">
<DIV style="MARGIN-LEFT: 0.5in">
<DIV class=MsoNormal style="MARGIN-LEFT: 0.5in; TEXT-ALIGN: center"
align=center><FONT face="Times New Roman" size=3><SPAN
style="FONT-SIZE: 12pt">
<HR tabIndex=-1 align=center width="100%" SIZE=2>
</SPAN></FONT></DIV></DIV></DIV></DIV>
<P class=MsoNormal
style="MARGIN-BOTTOM: 12pt; MARGIN-LEFT: 2in; MARGIN-RIGHT: 0in; mso-margin-top-alt: 0in"><B><FONT
face=Tahoma size=2><SPAN
style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Tahoma">From:</SPAN></FONT></B><FONT
face=Tahoma size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma">
Buscher, Shane [mailto:Shane.Buscher@nngco.com] <BR><B><SPAN
style="FONT-WEIGHT: bold">Sent:</SPAN></B> Friday, January 12, 2007 7:16
AM<BR><B><SPAN style="FONT-WEIGHT: bold">To:</SPAN></B> Buscher, Shane;
Mapguide_users@lists.osgeo.org<BR><B><SPAN
style="FONT-WEIGHT: bold">Subject:</SPAN></B> RE: [Mapguide_users] FW: Remove
layers at runtime</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 2in"><FONT face=Arial color=navy
size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">I
haven’t got any feedback yet, but I have been trying desperately to make this
work. To recap, I’m finding that adding a layer to a map at runtime with
MgLayerCollection.Add works fine. However, when I try to remove layer(s)
with MgLayerCollection.Clear, MgLayerCollection.Remove, or
MgLayerCollection.RemoveAt the layer(s) are indeed removed from the
collection- but <I><SPAN style="FONT-STYLE: italic">not the
map</SPAN></I>. I am saving the map and refreshing the map after
removal. </SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 2in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 2in"><FONT face=Arial color=navy
size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">So why
does inserting a layer into the MgMapCollection work, but removing not?
Looking at the developers guide on page 56 there is a note for getting a layer
collection from the map (MgMap.GetLayers): </SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 2in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 2in"><I><FONT face=StoneSans
size=1><SPAN
style="FONT-SIZE: 9pt; FONT-STYLE: italic; FONT-FAMILY: StoneSans">In the
MapGuide API, getting a collection returns a reference to the collection. So
adding the layer to the layer collection immediately updates the
map.</SPAN></FONT></I><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 2in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 2in"><FONT face=Arial color=navy
size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">I am get
the impression that adding a layer to the collection automatically updates the
map, this doesn’t apply for removing a layer. I can’t figure out what I
need to do to mimic what the api does for you when inserting a layer when
trying to remove a layer. Or is this a bug?</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 2in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 2in"><FONT face=Arial color=navy
size=2><SPAN style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Thanks
for any help in advance. </SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 2in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 2in"><FONT face=Arial color=navy
size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Regards,</SPAN></FONT><o:p></o:p></P>
<P class=MsoNormal style="MARGIN-LEFT: 2in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 2in"><FONT face=Arial color=navy
size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Shane</SPAN></FONT><o:p></o:p></P>
<DIV>
<DIV style="MARGIN-LEFT: 0.5in">
<DIV style="MARGIN-LEFT: 0.5in">
<DIV style="MARGIN-LEFT: 0.5in">
<DIV style="MARGIN-LEFT: 0.5in">
<DIV class=MsoNormal style="MARGIN-LEFT: 0.5in; TEXT-ALIGN: center"
align=center><FONT face="Times New Roman" size=3><SPAN
style="FONT-SIZE: 12pt">
<HR tabIndex=-1 align=center width="100%" SIZE=2>
</SPAN></FONT></DIV></DIV></DIV></DIV></DIV>
<P class=MsoNormal style="MARGIN-LEFT: 2.5in"><B><FONT face=Tahoma
size=2><SPAN
style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Tahoma">From:</SPAN></FONT></B><FONT
face=Tahoma size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma">
mapguide_users-bounces@lists.osgeo.org
[mailto:mapguide_users-bounces@lists.osgeo.org] <B><SPAN
style="FONT-WEIGHT: bold">On Behalf Of </SPAN></B>Buscher, Shane<BR><B><SPAN
style="FONT-WEIGHT: bold">Sent:</SPAN></B> Tuesday, January 09, 2007 4:49
PM<BR><B><SPAN style="FONT-WEIGHT: bold">To:</SPAN></B>
Mapguide_users@lists.osgeo.org<BR><B><SPAN
style="FONT-WEIGHT: bold">Subject:</SPAN></B> [Mapguide_users] FW: Remove
layers at runtime</SPAN></FONT><o:p></o:p></P></DIV>
<P class=MsoNormal style="MARGIN-LEFT: 2.5in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"> <o:p></o:p></SPAN></FONT></P>
<P style="MARGIN-LEFT: 2.5in"><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">I’ve run into issues with removing
all layers from the map at runtime. See the code snippet below.
All the layers get removed from the layerCollection, but the layers still
display. I’ve successfully used the same code to insert layers, except I
execute the</SPAN></FONT> <FONT face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">layerCollection.Insert(index,
layer) method. I don’t know why the same code wouldn’t work for clearing
layers. </SPAN></FONT><o:p></o:p></P>
<P style="MARGIN-LEFT: 2.5in"><FONT face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">I have multiple layers
stored in a library repository that users need to add and remove at
runtime. Do I need to copy each layer in indvidual session repositories
to add and reomove them? If I don’t, will one user adding/removing
layers affect other user sessions? I know this is the case when you edit
data, but these layers are view only. </SPAN></FONT>
<o:p></o:p></P>
<P style="MARGIN-LEFT: 2.5in"><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">‘</SPAN></FONT><FONT
face="Courier New" color=green size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'">Connect to
site server, set resource service, and open map</SPAN></FONT><o:p></o:p></P>
<P style="MARGIN-LEFT: 2.5in"><FONT face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">ConnectToMapGuide()
</SPAN></FONT><o:p></o:p></P>
<P style="MARGIN-LEFT: 2.5in"><FONT face="Courier New" color=green
size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'">'Clear all
layers in the map</SPAN></FONT><o:p></o:p></P>
<P style="MARGIN-LEFT: 2.5in"><FONT face="Courier New" color=blue size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">Dim</SPAN></FONT><FONT
face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
layerCollection</SPAN></FONT> <FONT face="Courier New" color=blue size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">As</SPAN></FONT><FONT
face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> MgLayerCollection =
map.GetLayers()</SPAN></FONT><o:p></o:p></P>
<P style="MARGIN-LEFT: 2.5in"><FONT face="Courier New" color=blue size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">If</SPAN></FONT><FONT
face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> layerCollection.GetCount
> 0</SPAN></FONT> <FONT face="Courier New" color=blue size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">Then</SPAN></FONT><o:p></o:p></P>
<P style="MARGIN-LEFT: 2.5in"><FONT face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
layerCollection.Clear()</SPAN></FONT><o:p></o:p></P>
<P style="MARGIN-LEFT: 2.5in"><FONT face="Courier New" color=blue size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">End</SPAN></FONT>
<FONT face="Courier New" color=blue size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">If</SPAN></FONT><o:p></o:p></P>
<P style="MARGIN-LEFT: 2.5in"><FONT face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">map.Save(resourceService)</SPAN></FONT><o:p></o:p></P>
<P style="MARGIN-LEFT: 2.5in"><FONT face="Courier New" color=green
size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'">'emit
javascript to refresh map</SPAN></FONT><o:p></o:p></P>
<P style="MARGIN-LEFT: 2.5in"><FONT face="Courier New" color=blue size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">Dim</SPAN></FONT><FONT
face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> scriptKey</SPAN></FONT>
<FONT face="Courier New" color=blue size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">As</SPAN></FONT>
<FONT face="Courier New" color=blue size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">String</SPAN></FONT><FONT
face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> =</SPAN></FONT> <FONT
face="Courier New" color=maroon size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: maroon; FONT-FAMILY: 'Courier New'">"ForceRefresh"</SPAN></FONT><o:p></o:p></P>
<P style="MARGIN-LEFT: 2.5in"><FONT face="Courier New" color=blue size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">If</SPAN></FONT>
<FONT face="Courier New" color=blue size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">Not</SPAN></FONT><FONT
face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
Page.ClientScript.IsStartupScriptRegistered(<FONT color=blue><SPAN
style="COLOR: blue">Me</SPAN></FONT>.GetType, scriptKey)</SPAN></FONT> <FONT
face="Courier New" color=blue size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">Then</SPAN></FONT><o:p></o:p></P>
<P style="MARGIN-LEFT: 2.5in"><FONT face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> </SPAN></FONT> <FONT
face="Courier New" color=blue size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">Dim</SPAN></FONT><FONT
face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> javaScript</SPAN></FONT>
<FONT face="Courier New" color=blue size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">As</SPAN></FONT>
<FONT face="Courier New" color=blue size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">String</SPAN></FONT><FONT
face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> =</SPAN></FONT> <FONT
face="Courier New" color=maroon size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: maroon; FONT-FAMILY: 'Courier New'">"refreshMap("</SPAN></FONT><FONT
face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> &
MapAction.RefreshMap &</SPAN></FONT> <FONT face="Courier New" color=maroon
size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: maroon; FONT-FAMILY: 'Courier New'">");"</SPAN></FONT><o:p></o:p></P>
<P style="MARGIN-LEFT: 2.5in"><FONT face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">
Page.ClientScript.RegisterStartupScript(<FONT color=blue><SPAN
style="COLOR: blue">Me</SPAN></FONT>.GetType, scriptKey,
javaScript,</SPAN></FONT> <FONT face="Courier New" color=blue size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">True</SPAN></FONT><FONT
face="Courier New" size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">)</SPAN></FONT><o:p></o:p></P>
<P style="MARGIN-LEFT: 2.5in"><FONT face="Courier New" color=blue size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">End</SPAN></FONT>
<FONT face="Courier New" color=blue size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">If</SPAN></FONT><o:p></o:p></P>
<P style="MARGIN-LEFT: 2.5in"><A name=""><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Regards,</SPAN></FONT></A><o:p></o:p></P>
<P style="MARGIN-LEFT: 2.5in"><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Shane</SPAN></FONT><o:p></o:p></P>
<P style="MARGIN-LEFT: 2.5in"><FONT face=Arial color=gray size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: Arial">Operations
IT</SPAN></FONT><o:p></o:p></P>
<P style="MARGIN-LEFT: 2.5in"><FONT face=Arial color=gray size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: Arial">Northern Natural
Gas</SPAN></FONT><o:p></o:p></P>
<P style="MARGIN-LEFT: 2.5in"><FONT face=Arial color=gray size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: gray; FONT-FAMILY: Arial">402.398.7841</SPAN></FONT><o:p></o:p></P>
<P style="MARGIN-LEFT: 2.5in"><I><FONT face=Arial color=gray size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: gray; FONT-STYLE: italic; FONT-FAMILY: Arial">We
think in generalities, but live in detail.
</SPAN></FONT></I><o:p></o:p></P>
<P style="MARGIN-LEFT: 2.5in"><I><FONT face=Arial color=gray size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: gray; FONT-STYLE: italic; FONT-FAMILY: Arial">-Alred
North
Whitehead</SPAN></FONT></I><o:p></o:p></P></DIV></BLOCKQUOTE></DIV></BODY></HTML>