Adding shapefile dynamically with php_mapscript 4.4.2
Jacob Delfos
jacob.delfos at MAUNSELL.COM
Mon Jun 13 19:00:03 PDT 2005
Hi All,
I am trying to dynamically add a shapefile which I created at runtime. The shapefile is created successfully (it opens up ok). But I am not having any luck adding it as a layer.
This is the code I have:
$queryResultlayer = ms_newLayerObj( $oMap );
$queryResultlayer->set( "name", "Queryresult" );
$queryResultlayer->set( "type", $shapetype );
$queryResultlayer->set( "status", MS_ON );
$queryResultlayer->set( "data", $szSessionDir."/queryResultShapefile");
$queryResultlayer->set( "template", "ttt" );
$queryResultlayer->set( "tolerance", 5 );
$queryResultlayer->set( "toleranceunits", MS_PIXELS);
$queryResultlayer->setProjection($mapprojection);
$queryclass = ms_newClassObj($queryResultlayer);
$queryclass->set("name", "Query result");
$queryclass->set("status", MS_ON);
$style = ms_newStyleObj($queryclass);
$style->color->setRGB(255, 255, 0);
$style->outlinecolor->setRGB(255, 0, 0);
The layer is not showing (extents of map are correct). I am not getting any errors either. The temporary mapfile being created in the session directory does not contain my layer. Am I missing something?
The $oMap object is a reference to the $oMap from the session (using Chameleon). I am loading the session from an Iframe, and creating the $oMap object like:
$oMap =& $oMapSession->oMap;
So if I add a layer to the map object, the layer should show if the map image is reloaded in the main frame, right?
Any help would be much appreciated.
Regards,
Jacob
JACOB DELFOS
SPATIAL INFORMATION ANALYST
Maunsell Australia Pty Ltd
629 Newcastle Street, Leederville, WA 6007
PO Box 81, Leederville, WA 6902
Western Australia
ABN 20 093 846 925
Tel + 61 8 9281 6185
Fax + 61 8 9281 6297
jacob.delfos at maunsell.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20050614/f86ae243/attachment.htm>
More information about the MapServer-users
mailing list