[Mapserver-users] query on dynamic point data

Gijs Epping gijs at gijs.com
Fri Apr 16 09:17:06 EDT 2004


 
-----Oorspronkelijk bericht-----
Van: Eric Bridger [mailto:eric at gomoos.org] 
Verzonden: vrijdag 16 april 2004 14:50
Aan: Gijs Epping
CC: Mapserver List
Onderwerp: Re: [Mapserver-users] query on dynamic point data

On Fri, 2004-04-16 at 07:43, Gijs Epping wrote:
> Hello,
> 
> We got a problem with querying on dynamic created points. The error we
> get is:
> 
> Fatal error: [MapServer Error]: msLayerGetShape(): Cannot retrieve
> inline shapes randomly.
> 
> I understand the error, we need to index the inserted data but we
can't,
> because index is readonly. 
> 
> Is there a way that we can give a point an number (index number) and
> read it out.
> 
>   $layer = ms_newlayerObj($gpoMap);
>   $layer->set("name", "pnts");
>   $layer->set("type", MS_LAYER_POINT);
>   $layer->group='standaard';
>   $layer->set("status", MS_ON);
> 
>     $class = ms_newClassObj($layer);
>    $class->set("template", "blabla.html");
>    $style = ms_newStyleObj($class);
>    $style->color->setRGB(0,0,0);
>    $style->set("symbolname", "star");
>    $style->set("size", 10);
> 
> 
> 
>   $point_lookup1 = array(146626, 511696);
>   $layerObj = $gpoMap->getLayerByName(pnts);
>   $line = ms_newLineObj();
>   $shp =ms_newShapeObj(MS_SHAPE_POINT);
> 
> 
>   $point = ms_newPointObj();
>   $point->setXY($point_lookup1[0], $point_lookup1[1]);
>   $line->add($point);
>   $shp->add($line);
> 
> 
>   $layerObj->addFeature($shp);
> 
>   $gpoMap->draw();

In mapserver3.6 I use very similiar code but with the addition of:
$shp->{index} = $id

$id must be numeric. This $id is returned by the query.



Do you use this with perl or with php because we are using php and we
don't get anything back. 

This is what I get back from $oRes = $oLayer->getResult($iRes);:

stdClass Object ( [shapeindex] => -1 [tileindex] => -1 [classindex] => 0
)


Any idea???






More information about the mapserver-users mailing list