[Mapserver-users] Any One Plz?

Thorsten Fischer thfischer at mapmedia.de
Fri May 23 06:33:59 PDT 2003


On Fri, 2003-05-23 at 11:54, Dwijadas Dey wrote:
> PROBLEM1:-
> 
>         I  am using mapserver3.5 and  new to it.

This version is outdated. You might want to try the latest version 3.6.x

>  I have written the mapfile and 
> template
> fie(both given below). In the template file in the [  ] portion, i 
> have used the values directly. e.g in ["map"] i have given 
> ["c:\program....\templ.map"] 

Maybe this is just a typo here ... you do not write ["map"], but only
[map]. MapServer is scanning for certain keywords enclosed in [] and
replaces them. "map" is not a keyword, but map is.

Similar, ["c:\..."] does not work because "c:\" is not a keyword. Just
write c:\... here. In the template file below I see you've done it
correctly.

> SHAPEPATH  "C:\Program Files\Apache Group\Apache2\htdocs\shape"
> FONTSET "C:\Program Files\Apache 
> Group\Apache2\htdocs\fonts.list"
> SYMBOLSET "C:\Program Files\Apache 
> Group\Apache2\htdocs\symbol\circle.sym"
> 
>   WEB
>      TEMPLATE  templ.html
>       IMAGEPATH  "C:\Program Files\Apache 
> Group\Apache2\htdocs\images\"
>       IMAGEURL  ".\images\"
                  ^^^

This means to check for a directory /image in the current working
directory, which is probably not what you want. If this directory is in
your webserver root directory, write "/images/"

>       <input type="hidden" name="imgext" value= "2700051.860 
> 2462746.020 3582564.801 3012459.468">
>    <!  <input type="hidden" name="mapext" value= "2700051.860 
> 2462746.020 3582564.801 3012459.468">

With hardcoding these variables, nothing will ever change, because you
will always have the same map extent, no matter if you zoom in or out.
This is a variable value. Try:

<input type="hidden" name="imgext" value="[mapext]">

>      <input type="hidden" name="imgxy" value="199.5 149.5">
>     <! <input type="hidden" name="imgxy" value="[imgxy]">

In case this is supposed to be a comment, HTML comments start with <!--
and have to be closed with --> again.

>     <table border=1 cellpadding=3>
>      <tr>
>     <td align=center>
> <! THE PROBLEM IS HERE IN THE NEXT TWO LINE>
>     <input type="image" name="img" src= "[img]">
>   <!  <input type="image" name="img" src= "c:\Program Files\Apache 
> Group\Apache2\htdocs\images\">

You define an image but you give a directory name as a source. Nothing
will be displayed.

>      </td>
>       <td valign=top> <font size=+1 face=arial,helvetica>Map 
> Controls</font>
>       <center><p> Select layers to display:<br>
>       <select multiple name="layer">
>       <option value="assam_a"[assam_a_select]> District Head 
> Quarters
>        <option value="assm-rvr"[assm-rvr_select]> Rivers
>        <option value="airport"[air_port_select]> Airports
                              ^^^^

This is a common error that happens to me surprisingly often too. You
need a space between the quote and the mapserver tags.

>         <select name="zoom" size="1">
>          <option value="10" [zoom_10_select]> Zoom in 10 times
>          <option value="8" [zoom_8_select]> Zoom in 8 times
>             <option value="4" [zoom_4_select]> Zoom in 4 times
>             <option value="3" [zoom_3_select]> Zoom in 3 times

There is no option called zoom. You can define zoomdir, which gives the
direction of the zoom (1 zooms in, 0 stays at the current level and -1
zooms out). In addition, you can define zoomsize, which gives a factor
to use for zooming.

>        <hr>
>        <p align="center"><font 
> face=arial,helvetica><b>Legend</b></font><br>
>           <img src="c:/Program Files/Apache 
> Group/Apache2/htdocs/lgnd/">
>          <p align="center"> <img src="c:/Program Files/Apache 
> Group/Apache2/htdocs/images/">

Again, you only give directory names.

> PROBLEM2:-(If i donot used the values inside [ ] directly)
>   I have tried with [ ] also AS  values between [ ] will filled up  
> by the mapserver from URL  and .map file. But it is giving an 
> error message which  is like "msLoadMap(): Unable to access file. 
> Illegal mapfile name".

[snip]

>                  <input type="hidden" name="imgext" value= 
> "[imgext]">

It's [mapext].

>     Considering the CGI variable [map] in the template file, 
> Mapserver should atleast know the value of the "map" then it 
> should replace it. But from where and which portion of the mapfile 
> the mapserver will find the value of map?????

map is the name of the mapfile. You give it as a parameter in the URL
that you use to call mapserver. In your template, you define

<input type="hidden" name="map" value="[map]">

So when using the form in the HTML file, the next call to mapserver will
include the value for map again.

> (Probably form NAME 
> at the first line
> of the mapfile) then probably i have to give a mappath like 
> shapepath?

NAME is only used as a prefix for generation temporary filenames.

>            Please tell me from which portion of the map file these 
> values([ ]) will come????

They are either taken/computed from the mapfile (like [imgxy] for
example, which is calculated by dividing the SIZE parameter by 2), or
they are provided via the URL (like [map] in most cases).

>  whether these values will be within the 
> WEB .....END structure ?? I am totally confused. I have gone 
> through the Mapserver CGI variables which you refers in the 
> mail.

Maybe you want to take a step backward and familiarize yourself with the
official Itasca demo package. You can download it from the mapserver
website.


hth,

thorsten




More information about the MapServer-users mailing list