<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1498" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2>Ok, got it sorted 
out. I forgot to save the session state:</FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left>$_SESSION['gszCurrentState'] = 
$oMapSession-&gt;saveState();</DIV>
<DIV dir=ltr align=left><FONT color=#0000ff></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT color=#0000ff>So the new layer never really made 
it into my main map application.</FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT color=#0000ff>Jacob</FONT></DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> UMN MapServer Users List 
[mailto:MAPSERVER-USERS@LISTS.UMN.EDU] <B>On Behalf Of </B>Jacob 
Delfos<BR><B>Sent:</B> 14 June 2005 11:49<BR><B>To:</B> 
MAPSERVER-USERS@LISTS.UMN.EDU<BR><B>Subject:</B> Re: [UMN_MAPSERVER-USERS] 
Adding shapefile dynamically with php_mapscript 4.4.2<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV><FONT face=Arial size=2>Steve,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Thanks for the suggestion. I thought about this 
approach, but since this is for a chameleon widget, it needs to be "drop-in" 
functionality, without having to make changes to the mapfile. It's a bit 
"cleaner" that way, although apparently more complex.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>regards,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Jacob</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>-----Original Message-----<BR>From: Stephen 
Woodbridge [mailto:woodbri@swoodbridge.com] <BR>Sent: 14 June 2005 11:03<BR>To: 
Jacob Delfos<BR>Cc: <A 
href="mailto:MAPSERVER-USERS@LISTS.UMN.EDU">MAPSERVER-USERS@LISTS.UMN.EDU</A><BR>Subject: 
Re: [UMN_MAPSERVER-USERS] Adding shapefile dynamically with php_mapscript 
4.4.2</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Jacob,</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>The way I do this is to create a normal in the 
mapfile with the STATUS <BR>OFF and no DATA statement. Then in mapscript all I 
do it set the STATUS <BR>ON and assign the path to the DATA like you are doing 
below.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>It is MUCH easier to create a template layer in the 
mapfile and then <BR>manipulate it, rather than creating the whole thing from 
scratch.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>YMMV,<BR>&nbsp;&nbsp; -Steve W.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Jacob Delfos wrote:<BR>&gt; Hi All,<BR>&gt;&nbsp; 
<BR>&gt; I am trying to dynamically add a shapefile which I created at runtime. 
<BR>&gt; The shapefile is created successfully (it opens up ok). But I am not 
<BR>&gt; having any luck adding it as a layer.<BR>&gt;&nbsp; <BR>&gt; This is 
the code I have:<BR>&gt;&nbsp; <BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
$queryResultlayer = ms_newLayerObj( $oMap 
);<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $queryResultlayer-&gt;set( 
"name", "Queryresult" );<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
$queryResultlayer-&gt;set( "type", $shapetype 
);<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $queryResultlayer-&gt;set( 
"status", MS_ON );<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
$queryResultlayer-&gt;set( "data", <BR>&gt; 
$szSessionDir."/queryResultShapefile");<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
$queryResultlayer-&gt;set( "template", "ttt" 
);<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $queryResultlayer-&gt;set( 
"tolerance", 5 );<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
$queryResultlayer-&gt;set( "toleranceunits", 
MS_PIXELS);<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
$queryResultlayer-&gt;setProjection($mapprojection);<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
$queryclass = 
ms_newClassObj($queryResultlayer);<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
$queryclass-&gt;set("name", "Query 
result");<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
$queryclass-&gt;set("status", 
MS_ON);<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $style = 
ms_newStyleObj($queryclass);<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
$style-&gt;color-&gt;setRGB(255, 255, 
0);<BR>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
$style-&gt;outlinecolor-&gt;setRGB(255, 0, 0);<BR>&gt;&nbsp; <BR>&gt; The layer 
is not showing (extents of map are correct). I am not getting <BR>&gt; any 
errors either. The temporary mapfile being created in the session <BR>&gt; 
directory does not contain my layer. Am I missing something?<BR>&gt;&nbsp; 
<BR>&gt; The $oMap object is a reference to the $oMap from the session (using 
<BR>&gt; Chameleon). I am loading the session from an Iframe, and creating the 
<BR>&gt; $oMap object like:<BR>&gt;&nbsp; <BR>&gt; $oMap =&amp; 
$oMapSession-&gt;oMap;<BR>&gt;&nbsp; <BR>&gt; So if I add a layer to the map 
object, the layer should show if the map <BR>&gt; image is reloaded in the main 
frame, right?<BR>&gt;&nbsp; <BR>&gt; Any help would be much 
appreciated.<BR>&gt;&nbsp; <BR>&gt; Regards,<BR>&gt;&nbsp; <BR>&gt; 
Jacob<BR>&gt;&nbsp; <BR>&gt; <BR>&gt; JACOB DELFOS<BR>&gt; SPATIAL INFORMATION 
ANALYST<BR>&gt; Maunsell Australia Pty Ltd<BR>&gt; 629 Newcastle Street, 
Leederville, WA 6007<BR>&gt; PO Box 81, Leederville, WA 6902<BR>&gt; Western 
Australia<BR>&gt; ABN 20 093 846 925<BR>&gt;&nbsp; <BR>&gt; 
Tel&nbsp;&nbsp;&nbsp;&nbsp; + 61 8 9281 6185<BR>&gt; Fax&nbsp;&nbsp;&nbsp; + 61 
8 9281 6297<BR>&gt; <A 
href="mailto:jacob.delfos@maunsell.com">jacob.delfos@maunsell.com</A> &lt;<A 
href="mailto:jacob.delfos@maunsell.com">mailto:jacob.delfos@maunsell.com</A>&gt;<BR></FONT></DIV></FONT></DIV></BODY></HTML>