[mapserver-users] Developing Skins for Mapserver Apps

Stephen Woodbridge woodbri at swoodbridge.com
Fri Jan 18 05:29:40 PST 2002


This started as a reply to Daniel's reply to Re: [mapserver-users] User
Layer Attributes Enhancement but I think a more generic discussion on
developing a standard for Mapserver Skins might be appropriate. Assuming
that some people are interested in pursuing this we could create
SkinsDevelopment area on Wiki to collaberate the effort.

I think gmap is a great example of what can be done and I appreciate
that is has been made available. While looking it over and planning my
own navigation interface I thought that it would be great for everyone
if we could make navigation interfaces like "skins." It would be really
cool of you could drop a "skin" into a directory with a map file and it
would just work! You might need to run a utility to init the "skin", but
after that it would be fully functional. There would still be a need to
customize the interface to deal with non-navigation specific stuff like
for example at the Candian Endangered Species site, but in general
building the navigation and basic query should be able to be easily
defined using a "skin" like approach and an initialization utility.
Skins could also be writen in both PHP and Perl.

To accomplish this, you would need to be able to discover what is in a
map file (doable today) and maybe via the metadata get info on what
should be exposed via the skin. And if you wanted to use an external
legend/control like gmap you would need to be able to generate the
graphics durning the initialization process. This would have to be done
in a standardized way in the map file so different skins would be able
to do the discovery.

I send the following to Steve Lime off list, but maybe I should have
sent it to the list as we may be closer than I thought:

------------------ included mail ---------------------------------
Subject: Better Mapscript Control of Legends
Date: Thu, 17 Jan 2002 17:15:42 -0500

Hi Stephen,

I wanted to bounce an idea around with you to see what you thought. I
just started playing with gmap75 and PHP/Mapscript and one of things I
noticed is that you don't get a whole lot of control over the Legend,
but wait I'm a little ahead of myself.

What I would like to be able to do is build a navigation user interface
that is not dependent on knowing what is in the map file. I like what DM
Solutions has done with their HTML Legend/Control which combines the
display of a Legend and the Control to turn the layers on and off.

Unfortunately their code has to explicitly reference the layers by name
in the map file, so if you want to move their navigation interface to
another map file you have to recode all the layers.

I can get all the layer names via mapscript so I can dynamically
generate the code to turn layers on/off by their name. What is missing
is the ability to easily get at the graphics (IE: Legend pieces) either
at deployment or via mapscript. Integrating the control and the legend
save screen real estate and simplifies the user interface.

Now I see that there are some problems, like the graphics change with
scale, but for a given map file the set of graphics icons is constant
unless you change the mapfile by editing it or via mapscript so you
could potentially run a utility to generate all the legend icon pieces
using some automatic name generation that conbined layer+scale then if
that name was accessible via mapscript then the mapscript could generate
a link to it. The idea would be to generate multiple say Road icons if
there were multiple Road displays based on scale, so you might generate
road1.gif, road2.gif, etc. Then have an attribute for the layer the
would return which road?.gif to use for the given map scale being
generated. This might be easily calculated in mapscript from other info
so the attribute might not be required.

There probably is a better way to do this, but I don't think I know
enough yet. I took a quick look at maplegend.c to see if it might be
cloned to make a utility to generate all the posible legend icon images.
I think it might be done without too much trouble, but coordinating that
names to the scale I'm not so sure about.

Anyway I think the goal of being able to create modular navigation
widgets that anyone can easily drop on a mapfile would be a cool idea.
It would be like "Skins" that other application offer.

You might have some other ideas which I would be interested in hearing
about.

Thank you for your time and for Mapserver it really is great!

Best regards,
  -Stephen Woodbridge



More information about the MapServer-users mailing list