[Mapserver-users] PhpMapScript and Labels

Eric Bridger eric at gomoos.org
Mon Jun 16 02:30:18 PDT 2003


You should try and figure out exactly where the script is failing, using
debug statements.

The only thing which jumps out is that for truetype fonts your size
should be some integer, e.g. 10, 12,etc. not MS_MEDIUM, which is for
bitmap fonts.



On Mon, 2003-06-16 at 07:46, Jaros³aw Kowalczyk wrote:
> Thank you for your answer. I have added the line you mentioned and now code
> looks like the one bellow. This should be ok, but for unknown (for me)
> reasons i get error in PHP_MAPSCRIPT_36.DLL and finally server error 500.
> 
> Maybe I have wrong settings for label?
> 
> 
>   $newClass->{label}->set(font,fritqat);
>   $newClass->{label}->set(type,MS_TRUETYPE);
>   $newClass->{label}->set(size,MS_MEDIUM);
>   $newClass->{label}->set(position,MS_CC);
>   $newClass->{label}->set(color,$map->addColor(0, 0, 0));
>   $newClass->{label}->set(antialias,true);
> 
>   $shapefile_temp=ms_newShapefileObj
> ("c:/usr/krasnal/htdocs/data/".$shapetempname,-1);
> 
>     $l_ofert=$shapefile_temp->{numshapes};
>      for ($i=0;($i<$l_ofert);$i++)
>       {
>          $newShapeObj=ms_newShapeObj(MS_SHAPE_POINT);
>          $newShapeObj=$shapefile_temp->getShape($i);
>          $ok=$newShapeObj->set(text,$i);
>          $newLayer->addFeature($newShapeObj);
>          $newShapeObj->free();
>       }
> 
>     $shapefile_temp->free();
> 
> 
> 
> 
> 
> ----- Original Message -----
> From: "Eric Bridger" <eric at gomoos.org>
> To: "Jaroslaw Kowalczyk" <karas1974 at wp.pl>
> Cc: "Mapserver List" <mapserver-users at lists.gis.umn.edu>
> Sent: Friday, June 13, 2003 1:17 PM
> Subject: Re: [Mapserver-users] PhpMapScript and Labels
> 
> 
> > Jaroslaw,
> > You need to add the label text to your shape before your call to
> > addFeature.
> >
> > $newshapeObj->{text} = $my_label_text;
> >
> > Sorry this is Perl syntax. In PHP it might be
> > $newshapeObj->set('text', $my_label_text); but I'm not sure.
> >
> >
> >
> > On Fri, 2003-06-13 at 08:54, Jaroslaw Kowalczyk wrote:
> > > Hello,
> > >
> > > Maybe someone could help with my probelm. I would like to display labels
> > > using phpmapscript. First I create Layer, Class and than add shapes form
> > > dynamically created shapefile. Shapefile is based on data I store in
> mySQL
> > > database.
> > >
> > > Although this new layer appears correctly (red symbols + black outlines)
> > > labels does not appear at all. What is wrong with my code (bellow)?
> > >
> > > Thank you.
> > > Jaroslaw Kowalczyk
> > >
> > > //----------------------------------
> > >  $newLayer=ms_newLayerObj($map);
> > >  $newLayer->set(status,MS_ON);
> > >  $newLayer->set(name,"Oferty");
> > >  $newLayer->set(type,MS_LAYER_POINT);
> > >  $newLayer->set(labelitem,"id_oferty");
> > >  $newClass=ms_newClassObj($newLayer);
> > >  $newClass->set(symbol,4);
> > >  $newClass->set(size,15);
> > >  $newClass->set(color,$map->addColor(255, 0, 0));
> > >  $newClass->set(outlinecolor,$map->addColor(0, 0, 0));
> > >   $newClass->{label}->{position}=MS_CC;
> > >   $newClass->{label}->set(color, $map->addColor(0, 0, 0));
> > >   $newClass->{label}->{font}=fritqat;
> > >   $newClass->{label}->{type}=truetype;
> > >   $newClass->{label}->{size}=5;
> > >   $newClass->{label}->{antialias}=true;
> > >
> > >
> $shapefile_temp=ms_newShapefileObj("c:/usr/krasnal/www/edeveloper/map/htdocs
> > > /data/".$shapetempname,-1);
> > >   $l_ofert=$shapefile_temp->{numshapes};
> > >       for ($i=0;($i<$l_ofert);$i++)
> > >       {
> > >          $newShapeObj=ms_newShapeObj(MS_SHAPE_POINT);
> > >        $newShapeObj=$shapefile_temp->getShape($i);
> > >        $newLayer->addFeature($newShapeObj);
> > >        $newShapeObj->free();
> > >       }
> > >       $shapefile_temp->free();
> > >
> > >
> > >
> > >
> > > ---------------------------
> > > Jaroslaw Kowalczyk
> > > www.ekoprojekt.pl
> > >
> > > _______________________________________________
> > > Mapserver-users mailing list
> > > Mapserver-users at lists.gis.umn.edu
> > > http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
> > >
> >
> >
> >
> 
> _______________________________________________
> 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