[mapserver-users] addfeature - point appearing at center of map?

woodbri at swoodbridge.com woodbri at swoodbridge.com
Tue Jul 9 16:17:51 PDT 2002


On 9 Jul 2002 at 14:36, Debbie Pagurek wrote:

> here's a bit of code:
> // loop through records and display (addfeature) each point
> $dummylayer=ms_newLayerObj($map); //a new layerobject
> 
> $numrows = count($long);
> for ($i = 0 ; $i <= $numrows; ++$i) 
> {
>    $oShp=ms_newShapeObj(MS_SHP_POINT);
>    $oLine=ms_newLineObj();
>    $oLine->addXY($long[$i],$lat[$i]);
>    $oShp->add($oLine);
>    $dummylayer=$map->getLayerByName("COLLECTIONS");
>    $dummylayer->addfeature($oShp);
> }
> 
> Anyone have any ideas why this point is appearing in the centre?

You are cycling one too many time through the $long array. Try

for ($i = 0 ; $i < $numrows; ++$i) 

-Steve



More information about the MapServer-users mailing list