[Mapserver-users] can I use different symbols in the same dynamic layer?

Eric Bridger eric at gomoos.org
Tue Sep 23 07:09:41 EDT 2003


I do this all the time.  You probably could acheive this using CLASSITEM
and EXPRESSION, but typically I'll use a layer with a single class for
such a layer.  Then based on my data: (Perl mapscript, sorry not PHP)

my $sym_idx_1 = $map->getSymbolByName("symbol_1");
my $sym_idx_2 = $map->getSymbolByName("symbol_2");
my $class = $layer->getClass(0);

if(we want symbol 1){
   $class->{symbol} = $sym_idx_1;
}
if(we want symbol 2){
   $class->{symbol} = $sym_idx_2;
}
...
$point->draw($map, $layer, $img, 0, 'label');

HTH

Eric


On Tue, 2003-09-23 at 07:45, Frieso ter Haseborg wrote:
> Hi,
> 
> 
> I'm using PHP/MapScript to draw dynamic point-layers in a map. What I
> would like to do is using different symbols for different points in the
> same layer. Is there any way to achieve this using the mapfile
> (expressions or something) or can this be done using PHP/MapScript?
> 
> Here are parts of my setup:
> 
> //points are created with mapscript
> [...]
> $pt = ms_newPointObj();
> $pt->setXY( -700000, 5950000 );
> $pt->draw($map, $layer, $image, 0, "Pt1");
> [...]
> 
> //Symbol- and label-attributes are specified in the mapfile.
> [...]
> LAYER
> NAME p
> TYPE POINT
> STATUS ON
> #CLASSITEM "" //is there a classItem when creating a layer dynamic?
> 	CLASS
> 		SYMBOL 17
> 		COLOR 128 128 255
> 		SIZE 35
> 		#EXPRESSION "" //would this work, when having a
> classitem on a dynamic layer?
> 		LABEL
> 			POSITION AUTO
> 		END
> 	END
> END
> [...]
> 
> I had some attempts using a class/expression, but since I don't know the
> correct classItem I think this can't work. Well, is there a possible
> "classitem" at all, when the layer isn't retrieved from a shapefile?
> 
> Is there a way to do this, or must there be different layers for each
> symbol-type?
> 
> Any hints would be appreciated.
> 
> TIA,
>  
> Frieso ter Haseborg
> - Software Development - 
>  
> --
> 
> -------------------------------------------------- 
> S&F Datentechnik GmbH&Co.KG 
> Reimersstr. 41b 
> 26789 Leer, Germany
> 
> 
> _______________________________________________
> 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