[Mapserver-users] How to create new layer and add user points ???

Josef Stromský Josef.Stromsky.hgf at vsb.cz
Mon Mar 8 14:15:39 EST 2004


Hi folks
 
Im trying to solve this problem. 
I need to create new layer with users points by PHP/Mapscript. I've
found one possibility in this mailinglist, but it doesn't work.
This is my script:
 
 
------------------------------------------------------------------------
--------------------------------
<?
$x=$HTTP_GET_VARS["x"];
$y=$HTTP_GET_VARS["y"];
dl("php_mapscript_36.dll");
$mapFile = ms_newMapObj("D:/mapa.map");
$layer = $mapFile->getLayerByName("klimatic_wgs");
 if ( isset($HTTP_GET_VARS['x']) && isset($HTTP_GET_VARS['y']) ) {
         $pointobj = ms_newPointObj();
         $pointobj->setXY($HTTP_GET_VARS['x'],$HTTP_GET_VARS['y']);
         $lineobj = ms_newLineObj();
         $lineobj->add($pointobj);
         $pointobj->free();
         $shapeobj = ms_newShapeObj(MS_SHAPE_POINT);
         $shapeobj->add($lineobj);
         $lineobj->free();
         $layerobj = ms_newLayerObj($mapFile);
         $layerobj->set('type',MS_LAYER_POINT);
         $layerobj->set('status',MS_ON);
         $layerobj->addFeature($shapeobj);
         $classobj = ms_newClassObj($layerobj);
         $classobj->set('symbol',0);
         $classobj->set('size',20);
         $newColor = $mapFile->addColor(255,255,0);
         $classobj->set("color", $newColor);
 }
$mapImage = $mapFile->prepareImage();
$layer->draw($mapImage)";
$layerobj->draw($mapImage);
 
$mapImagePath = "saveWebImage(MS_PNG'>http://158.196.143.80/".$mapImage-
<http://158.196.143.80/> >saveWebImage(MS_PNG, 0, 0, 95);
echo "<IMG src='".$mapImagePath."' border='0'>";
?>
------------------------------------------------------------------------
--------------------------------
 
 
This script doesn't returns any error messages, but only first
layer($layer) is visible. 
If is here anybody with some idea how to solve this mess, I'll be
thankful to you.
 
Best regards.
 
Josef Stromsky
 






More information about the mapserver-users mailing list