Back to PPS1 course ;
Back to PPS2 Section 6;
Back to PPS2 technology page ;
Back to JM-R homepage
Peter Murray-Rust, whose material I have adapted, and who burnt midnight oil to make my first map work for me.
Alan Mills for nagging me to write it down.
Why make clickable maps?
What happens when you browse a clickable
map
Making the map file
To be able to use your .conf and .gif files
What the files really look like
A small example
Why make
clickable maps?
Because they are a good way of displaying
increasing degrees of complexity e.g. the cell structure stuff on
the course.
Because they provide a pictorial way of organising
information so that you can find the relevant parts quickly, like the clickable UK map at UC
Dept of Computer Science.
What happens when you browse a
clickable mapThanks to Peter M-R for allowing me to adapt his text for this section.
Step 1. Click on part of the map. The
client knows it's an imagemap, because the HTML has
ISMAP keyword in the < IMG ... > tag. Your client has to work out the
coordinates of the click and encode them in a URL,e.g. if you click at 20,30 the URL might be something like :
http://www.bbk.somewhere /cgi-bin/imagemap/mymap?20,30
So we have the coordinates appended to a URL [N.B. This URL is an instruction to run the program imagemap (see below) - the cgi-bin and ? are clues].
The "mymap" comes from the HTML, and tells the server the name of the map file.
the HTML looks something like this:
< a href="http://eday.cryst.bbk.ac.uk:8079/cgi-bin/imagemap/mymap">
< img src="mymap.gif" ISMAP> < /A>
Note the ISMAP tag in
< img src="mymap.gif" ISMAP>
Step 2. The server decodes
the URL. It finds the name of the .map file(mymap) and the coordinates (20,30).
Step 3.The server starts
imagemap, a program in $SERVERROOT/cgi-bin, and passes it the
map name and the coordinates.
[This might, on some servers, be in something like /htbin. So long as your Webmaster has all this fixed you don't need to know]
Step 4. imagemap locates the
map file by reading a file imagemap.conf, which manages all the map files for
that server, and contains a list of .map file names.
You have to be root to edit imagemap.conf . This is the bit where you need the Webmaster.
Step 5. imagemap finds which
area was clicked.
[If you miss all the areas, it will look for a default .html file, usually default.html. This is obligatory with some servers, and good practice anyway.It usually contains a simple message about "you hit the background". Mapedit prompts for its location.]
[Question - why shouldn't the default file include a huge fancy image?!!]
Step 6. Then the URL for the area is
passed back to the server.
Step 7. Then the server
passes the URL to the client in the format:
Location: URL_returned_by_imagemap
Step 8. The client reacts to
Location: and retrieves the URL in normal
fashion.
Making the map file
You start with an image (I use .gif ) on
which you will create sensitive regions.
Then you make a .conf fileThese don't have to cover the whole area; conversely they can overlap, with the priorities being determined by the order of regions in the .map file. You need one of these for each image.
A default file is also defined,for when you click somewhere that isn't inside a marked-up area. Normally this is a background, and should be linked to a .html file which includes a small message like "You selected the background"!
How to markup the map Otherwise there are some tools to help with marking up:
mapedit runs on unix machines and pc's,
and we have copies of both versions at BBK.
This is not freeware, but educational establishments are only meant to send Thomas Boutell a postcard......
Both will allow you to draw round an area and link this to files or URLs on your system or elsewhere.
To be able to use your .conf and .gif
files
You make a .gif file.(With a drawing program :-))
You make a .conf file.
You write some .html which includes
a reference to a .gif file with the ISMAP tag:the HTML looks something like this:
< a href="http://www.cryst.bbk.ac.uk/cgi-bin/htimage/mymap.conf">
< img src="mymap.gif" ISMAP> < /A>
Ask your Webmaster for the proper path for the server you want to use.
What the files really look like
The map files.
.conf file for CERN serverrect (54,38) (162,63) click1.html
rect (219,10) (251,60) click2.html
.map file for NCSA serverrect click1.html 54,38 162,63
rect click2.html 219,10 251,60
imagemap.conf (NCSA only)
A small example:
The clickable map
The
.html
The .gif with the areas marked by mapedit
Here is a picture of the mapedit screen.
(you can also get to this from the map URL)
The .conf file
Here is the .conf file.
E-mail: ubcg09j@mail.cryst.bbk.ac.uk
Back to PPS1 course ;
Back to PPS2 Section 6;
Back to PPS2 technology page
Back to JM-R homepage