[mapserver-dev] Using tileindex raster layer with php_mapscript

laurent.baey at free.fr laurent.baey at free.fr
Wed Oct 1 07:10:31 EDT 2008


Hi

I don't know if it is really related to php_mapscript but here's my problem :

When I build a layer with php_mapscript, setting layer->tileindex and  
layer->tileitem, I have the following error :
[MapServer Error]: msDrawMap(): Failed to draw layer named 'relief'.
[MapServer Error]: msDrawRaster(): rasters/POL/BoraBora_relief.tif/  
using full path rasters/POL/BoraBora_relief.tif/

Note the extra '/' at the end of the path.

after a little investigation, I found that even if it's not defined  
anywhere in my code, layer->data is not null but an empty string.  
(maybe a default value in php_mapscript code)

In mapraster.c trunk code :
1401  if(layer->data == NULL) /* assume whole filename is in attribute  
field */
1402    strcpy( tilename, tshp.values[tileitemindex] );
1403  else
1404    sprintf(tilename, "%s/%s", tshp.values[tileitemindex], layer->data);
1405  filename = tilename;

I found the extra slash coming from line 1404.
Working with a mapfile solve the problem, as layer->data remains null  
if not defined in the mapfile. But I need to set it dynamically.

So when coming from php mapscript, as layer->data is not null, I would suggest
to replace line 1401 of mapraster.c with

if(layer->data == NULL || strlen(layer->data) == 0)

any comments ?
If it doesn't create side effect, can it be commited ?

Thanks

Laurent BAEY

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.




More information about the mapserver-dev mailing list