[mapserver-users] dynamic class creation vs. static

Stephen Woodbridge woodbri at swoodbridge.com
Tue Jun 11 19:11:58 PDT 2002


Well if the customer just wants random stuff then you are stuck with
creating random classes to support it. You could set CLASS ITEM
"Place_name" and match the names or dynamically create the classes as
you suggested via mapscript. Sounds like you have a handle on it.

-Steve

Pushkar Pradhan wrote:
> 
> Data organiz.:
> city_bounds.shp
> One of the Attributes is Place_name
> I know I can use a criteria like POPULATION > 50K and POPULATION <= 50K
> I hope the client's specs. were like this but he has specified particular
> city names,
> rivers.shp: some random rivers to be drawn. Moreover all these must be
> done in different colors, e.g. each river in new color.
> Thus I defined each city he wants in the .map file as a diff. class, but
> the COLOR values etc. I set them in mapscript.
> I hope that's a reasonable approach?
> 
> P.S.: The data that the client wants displayed is just random not based on
> any criteria.
> > Pushkar,
> >
> > Off hand is seems like you are approaching the problem from the wrong
> > direction, IE there is a different way to solve the problem. Only I'm
> > having trouble understanding how you data is organized.
> >
> > For example, if I want to display cities I have a cities.shp file that
> > has the point locations of the cities and the name as an attribute. Then
> > I make a layer to display and label the cities. If I want different
> > symbols for say population then I set a a CLASS ITEM "POPULATION" and
> > set up CLASSes with EXPRESSIONs to display different symbols or circle
> > sizes based on the expression.
> >
> > So what does your data look like and what do you wnat to do with it.
> > Clearly as you posted you don't want to declare 30 some classes.
> >
> > -Steve
> >
> > Pushkar Pradhan wrote:
> > >
> > > I have a list of layers (~30 or more), I need to display only certain
> > > classes in each of these. There doesn't seem to be a criteria defined by
> > > my client, just a word file containing the names.
> > >
> > > Static:
> > > Pasting the names of the classes in each layer in the .map file seems
> > > boring, i.e. in cities layer he wants 30 cities to be displayed.
> > > LAYER cities
> > >
> > > CLASS1
> > > CLASS2
> > > ...
> > > CLASS30
> > >
> > > END
> > >
> > > similarly for all layers
> > >
> > > Dynamic:
> > > I can take the layer name and look it up in a text file which contains the
> > > city names and then create all the classes in a loop:
> > > for(no. of cities in the text file) {
> > >    create new class obj.
> > >    set attributes
> > > }
> > >
> > > Would the 1st approach be faster, I think in the 2nd approach the classes
> > > will be created each time a user zooms in or adds more classes, please
> > > advice. Thanks,
> > >
> > > -Pushkar S. Pradhan
> >
> 
> -Pushkar S. Pradhan



More information about the MapServer-users mailing list