[mapserver-users] Can not draw single point

Ludwig Kniprath ludwig at kni-online.de
Fri Nov 27 16:15:12 EST 2009


Hello,
I used your slightly changed PHP and the mapfile below, it worked 
perfectly for me. Maybe your problems were caused by the extent defined 
in your mapfile?
Regards
Ludwig

<?php
$map = ms_newMapObj('e:\website\WVER_IMS\mapfiles\test.map');
$daLayer = ms_newLayerObj($map);
$daLayer->set("type", MS_LAYER_POINT);
$daLayer->set("status", MS_ON);
$class = ms_newClassObj($daLayer);
$style = ms_newStyleObj($class);
$style->color->setRGB(255,0,0);
$style->set("symbolname", "circle");
$style->set("size", 10);
$my_point = ms_newpointObj();
$my_point->setXY(60,60);
$image=$map->draw();
$my_point->draw( $map, $daLayer, $image, 0, "Temp Point" );
$image_url=$image->saveWebImage();
echo "<img src='$image_url'/>";
?>

map
   name "test"
   units dd
   extent 0 0 100 100
   size 640 480
   imagecolor 255 255 255
   WEB
       IMAGEPATH "your_path"
       IMAGEURL "your_url"
   END
   SYMBOL
       NAME "circle"
       FILLED true
       TYPE vector
       POINTS
           0 0
           0 1
           1 1
           1 0
           0 0
       END
   END
end


> From: mapserver-users-bounces at lists.osgeo.org
> [mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of Helen 
> Eskina
> Sent: Wednesday, November 25, 2009 5:39 PM
> To: mapserver-users at lists.osgeo.org
> Subject: [mapserver-users] Can not draw single point
>
>  
>
> Hello,
>
>  
>
> I try to draw single point on the map. My point is defined by lat/long
> coordinates. The problem is that the point is always in the same place on
> the map regardless of the lat/long defined.
>
> Here is my code:
>
> $map = ms_newMapObj($map_path."mymap.map");
>
> $daLayer = ms_newLayerObj($map);
>
>  $daLayer->set("type", MS_LAYER_POINT);
>
> $daLayer->set("status", MS_ON);
>
>  $class = ms_newClassObj($daLayer);
>
>  $style = ms_newStyleObj($class);
>
>  $style->color->setRGB(255,0,0);
>
>  $style->set("symbolname", "circle");
>
>  $style->set("size", 10);
>
>  
>
> $my_point = ms_newpointObj();
>
>  
>
> $my_point->setXY(42.19,-75.46);
>
>  
>
> $image=$map->draw();
>
> $my_point->draw( $map, $ daLayer, $image, 0, "Temp Point" );
>
>  
>
> $image_url=$image->saveWebImage();
>
>  
>
> What is wrong with it? I will appreciate any help.
>  
>
> Thank you,
>
> Helen




More information about the mapserver-users mailing list