[Mapserver-users] How to create new layer and add user points ???
Eric Bridger
eric at gomoos.org
Tue Mar 9 07:45:07 PST 2004
My guess would be that your "x" and "y" form input values are not
geographic coordinates in the correct units. If they are image
coordinates (pixels) you could try adding:
$layerObj->set('transform', MS_FALSE);
On Mon, 2004-03-08 at 14:15, Josef Stromský wrote:
> 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
>
>
>
>
> _______________________________________________
> Mapserver-users mailing list
> Mapserver-users at lists.gis.umn.edu
> http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
>
More information about the MapServer-users
mailing list