[Mapserver-users] simple php/mapscript questions

Eric Bridger eric at gomoos.org
Fri Dec 12 05:27:17 EST 2003


On Fri, 2003-12-12 at 14:04, Murat Isik wrote:
 
> -actually first question more about map file. when we write SHAPEPATH "data" at the beginning of the file, mapserver goes into "data" to find all layer data. Is there a way to get the mapserver to retrieve data for each layer from different folders or paths?

I think you can give DATA a full path to the shapefile. I.e. if it
starts with / the SHAPEPATH will not be used.

> 
> -I have a layer like this:
> 
> LAYER
>   NAME lastpoint
>   TYPE point
>   DATA lastpoint
>   STATUS OFF
>    CLASS
>     SYMBOL 'circle'
>     COLOR 102 255 36
>     SIZE 20
>      LABEL
>       COLOR 0 0 0
>      END
>    END
> END
> 
> This layer gets to be called within the php and turned ON. What I want to do is to use the same settings for different named layers but without rewriting this part multiple times. It is like: the php will get the layer by name (lastpoint) but for this layer it will retrieve data from firstpoint.shp, firstpoint.shx, firstpoint.dbf
> 
> Is there a php code that does this?

I do this all the time using Perl mapscript and would guess it can be
done with PHP mapscript. You just need to set the DATA to the path you
want to use.  In perl:
$layer = $map->getLayerByName('lastpoint');
$layer->{data} = '/path/to/shapefile/firstpoint';

HTH.
Eric





More information about the mapserver-users mailing list