two mapscript questions

Stephen Lime steve.lime at dnr.state.mn.us
Fri Feb 2 11:18:18 EST 2001


Not stupid questions, and not possible directly with the current mapscript 
implementation. Deletion isn't that big of a deal since you can always turn 
a layer off. Changing order is harder and is complicated by the underlying 
storage in C.

There are work arounds. In MapScript you could manage order in the scripting 
language using a list of layer names and then use that to direct drawing order. For
example in perl:

@layers = ('roads', 'landcover', 'cities');

foreach $layername (@layers);
  $layer = $map->getLayerByName($layername);
  $layer->draw(...);
}

draws layers in an order defined by you and not the order in the mapfile. 

In what context (i.e. drawing, writing mapfiles) are you needing these functions?
I see where improvements could be made with respect to writing. There is only
a single method for writing and I see a need to expose object specific write()
methods, at least for layers.

I have experimented with an "ORDER ..." parameter that allowed you to change
processing order by shuffling that array. It proved cumbersome to use though in
practice so I removed it.

Steve

Stephen Lime
Internet Applications Analyst

Minnesota DNR
500 Lafayette Road
St. Paul, MN 55155
651-297-2937

>>> "Jameson Tweedie" <jameson at topozone.com> 02/02/01 09:32AM >>>
hi, i have two quick (and presumably incredibly simple, pardon my
stupidity) questions:

1. can you remove a layer from a mapObj using mapscript?
2. can you change a layers position within a mapObj using mapscript?

i've checked through all the mapscript documentation i can get my hands
on and haven't seen an solution.  it would seem logical that they both
exist and to me the most logical option for the changing layers would be
to simply be able to change a layers index value, but that seems to be
read only. how do i go about doing these?
thanks jameson.




More information about the mapserver-users mailing list