<!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>Steve,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </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> </DIV>
<DIV><FONT face=Arial size=2>regards,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Jacob</FONT></DIV>
<DIV> </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> </DIV>
<DIV><FONT face=Arial size=2>Jacob,</FONT></DIV>
<DIV> </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> </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> </DIV>
<DIV><FONT face=Arial size=2>YMMV,<BR> -Steve W.</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>Jacob Delfos wrote:<BR>> Hi All,<BR>>
<BR>> I am trying to dynamically add a shapefile which I created at runtime.
<BR>> The shapefile is created successfully (it opens up ok). But I am not
<BR>> having any luck adding it as a layer.<BR>> <BR>> This is
the code I have:<BR>> <BR>>
$queryResultlayer = ms_newLayerObj( $oMap
);<BR>> $queryResultlayer->set(
"name", "Queryresult" );<BR>>
$queryResultlayer->set( "type", $shapetype
);<BR>> $queryResultlayer->set(
"status", MS_ON );<BR>>
$queryResultlayer->set( "data", <BR>>
$szSessionDir."/queryResultShapefile");<BR>>
$queryResultlayer->set( "template", "ttt"
);<BR>> $queryResultlayer->set(
"tolerance", 5 );<BR>>
$queryResultlayer->set( "toleranceunits",
MS_PIXELS);<BR>>
$queryResultlayer->setProjection($mapprojection);<BR>>
$queryclass =
ms_newClassObj($queryResultlayer);<BR>>
$queryclass->set("name", "Query
result");<BR>>
$queryclass->set("status",
MS_ON);<BR>> $style =
ms_newStyleObj($queryclass);<BR>>
$style->color->setRGB(255, 255,
0);<BR>>
$style->outlinecolor->setRGB(255, 0, 0);<BR>> <BR>> The layer
is not showing (extents of map are correct). I am not getting <BR>> any
errors either. The temporary mapfile being created in the session <BR>>
directory does not contain my layer. Am I missing something?<BR>>
<BR>> The $oMap object is a reference to the $oMap from the session (using
<BR>> Chameleon). I am loading the session from an Iframe, and creating the
<BR>> $oMap object like:<BR>> <BR>> $oMap =&
$oMapSession->oMap;<BR>> <BR>> So if I add a layer to the map
object, the layer should show if the map <BR>> image is reloaded in the main
frame, right?<BR>> <BR>> Any help would be much
appreciated.<BR>> <BR>> Regards,<BR>> <BR>>
Jacob<BR>> <BR>> <BR>> JACOB DELFOS<BR>> SPATIAL INFORMATION
ANALYST<BR>> Maunsell Australia Pty Ltd<BR>> 629 Newcastle Street,
Leederville, WA 6007<BR>> PO Box 81, Leederville, WA 6902<BR>> Western
Australia<BR>> ABN 20 093 846 925<BR>> <BR>>
Tel + 61 8 9281 6185<BR>> Fax + 61
8 9281 6297<BR>> <A
href="mailto:jacob.delfos@maunsell.com">jacob.delfos@maunsell.com</A> <<A
href="mailto:jacob.delfos@maunsell.com">mailto:jacob.delfos@maunsell.com</A>><BR></FONT></DIV>
<DIV><FONT face=Arial size=2><A
href="mailto:jacob.delfos@maunsell.com"></A></FONT> </DIV></BODY></HTML>