[Mapserver-users] cant label streets in mapscript -- please help

Daniel Morissette morissette at dmsolutions.ca
Tue Nov 11 18:28:48 EST 2003


Murat Isik wrote:
> 
> As for the "stopped rendering", the web page only has the part that is until
> the start of the php code, like the title or the logo gif. The source of the
> web page only has the page title and the url of the page logo. When I check
> the temporary folder into which images are written, I see no images are
> produced. On the web page, there were no error messages. Unfortunately, I
> dont know how to use the error_log :(
> 

The Apache error_log is located in /var/log/httpd/error_log.  You can 
monitor it using the following command in a shell window:

   tail -f /var/log/httpd/error_log

Then run the PHP script again and see if anything is sent to the 
error_log that could help figuring the source of the problem.


> The lines I added to the mapfile for mapscript choose the streets by their
> value in the second column which is ID (numeric) and I choose all by /./
> 
> CLASSITEM 'ID'
>   CLASS
>        EXPRESSION /./
>   COLOR 66 34 249
>   END
> 

Makes sense.  All streets end up being caught by the first class and 
none are sent to the second class that contains the label definition. 
That's why it draws with no error but you don't get labels either: the 
label stuff is never used.


> I applied your test with the following php code:
> 
> <HEAD>
> <TITLE>TEST</TITLE>
> </HEAD>
> <CENTER>
> <?php
>     dl("php_mapscript.so");
>     $map =  ms_newMapObj("demonew.map");
>     $img = $map->draw();
>   #  $map->drawLabelCache($img);
>     $url = $img->saveWebImage(GIF,1,1,0);
> 
> ?>
> <INPUT TYPE="image" SRC="<?php echo $url; ?>">
> 
> Once again, the web page displays no images, no images produced in temp
> directory and web page source ends at <CENTER>. Also tried it with
> drawLabelCache on, getting the same result :(
> 

It seems clear that php_mapscript crashes (segmentation fault) during 
the $map->draw() call then.

First let's see if you'll get any hints about the source of the problem 
in the error_log, and if not then I think there are 75% chances that you 
are running conflicting versions of GD/freetype between your PHP and 
php_mapscript.so.  You can check if your PHP includes GD/freetype by 
running the phpinfo() command in a script and looking for GD/freetype 
stuff in the list of modules.  If you possible try to disable the PHP 
GD/freetype stuff.

If that's not a GD/freetype conflict then it could be a bug somewhere in 
MapServer, and the only way to figure it would be to run in a debugger 
and you can't do that with the RPM version.  Anyway that's getting quite 
involved if you are a beginner so I would suggest instead uninstalling 
the RPMs and installing MapServer v4.0 using the instructions that you 
can find in the wiki at:

http://mapserver.gis.umn.edu/cgi-bin/wiki.pl?RedHat9AndMapserver40

If the crash persists with version 4.0 then your best bet would be to 
package a small testcase that reproduces the problem with mapfile and 
sample data and submit a bug in the MapServer bugzilla.

Lots to learn, eh?   :)

Daniel
-- 
------------------------------------------------------------
  Daniel Morissette               morissette at dmsolutions.ca
  DM Solutions Group              http://www.dmsolutions.ca/
------------------------------------------------------------




More information about the mapserver-users mailing list