tutorial problem
Ferencik Ioan
ferencik.ioan at PERSONAL.RO
Wed Apr 6 02:38:20 PDT 2005
I am running MS4W, it is working fine, I downloaded Mapserver tutorial and
passed through it till example1-9. I have the folowing problem:
when I type: http://localhost/cgi-bin/mapserv.exe?
map=c:\ms4w\tutorial\example1-9.map&mode=browse
I see only 1 map though I should see pursunat to template file 2 maps: one png
image is generate in map mode and the other in browse mode. Instead of second
map I see a blank square and inside it is wtritten: Submit query.
Can you guys help me?
Here is the map file:
MAP
NAME EX1.9_
IMAGETYPE PNG24
EXTENT 201621.496941 -294488.285333 1425518.020722 498254.511514 # LAEA
#EXTENT -97.5 41.619778 -82.122902 49.38562 # Geographic
SIZE 400 300
SHAPEPATH "data"
SYMBOLSET "symbols/symbols35.sym"
FONTSET "fonts/fonts.list"
WEB
TEMPLATE 'example1-9.html'
IMAGEPATH 'tmp'
IMAGEURL 'tmp'
END
PROJECTION
# "proj=laea"
# "ellps=clrk66"
# "lat_0=45"
# "lon_0=-100"
#
# Alternatively, you can specify an EPSG code.
"init=epsg:2163"
#
END
# Start of LAYER DEFINITIONS ---------------------------------------------
LAYER # States polygon layer begins here
NAME states
DATA states_ugl
STATUS OFF
TYPE POLYGON
PROJECTION
"init=epsg:4326"
END
CLASSITEM "CLASS"
CLASS
EXPRESSION 'land'
SYMBOL 0
COLOR 232 232 232
END
END # States polygon layer ends here
LAYER # MODIS raster layer begins here
NAME modis
DATA "raster/mod09a12003161_ugl_ll_8bit.tif"
STATUS DEFAULT
TYPE RASTER
PROCESSING "BANDS=1,2,3"
OFFSITE 71 74 65
PROJECTION
"init=epsg:4326"
END
END # MODIS raster layer ends here
LAYER # LandSat WMS map from JPL (or from USGS)
NAME LandSat
TYPE RASTER
OFFSITE 0 0 0
STATUS OFF
CONNECTIONTYPE WMS
CONNECTION "http://wms.jpl.nasa.gov/wms.cgi?
REQUEST=map&LAYERS=us_landsat7&STYLES=&FORMAT=png&TRANSPARENT=true"
#CONNECTION "http://gisdata.usgs.net/servlet/com.esri.wms.Esrimap?
ServiceName=USGS_WMS_LANDSAT7&VERSION=1.0.0&REQUEST=map&Layers=LANDSAT7&SRS=EPSG
:4326&REASPECT=false&Format=png&"
METADATA
"wms_title" "LandSat"
"wms_name" "us_landsat7"
"wms_server_version" "1.0.0"
"wms_srs" "epsg:4326"
"wms_format" "image/png"
#"wms_title" "US_Landsat7"
# "wms_srs" "epsg:4326"
# "wms_connectiontimeout" "1000"
END
PROJECTION
"init=epsg:4326"
END
END # LandSat WMS image ends here
LAYER # States line layer begins here
NAME states
DATA states_ugl
STATUS DEFAULT
TYPE LINE
PROJECTION
"init=epsg:4326"
END
CLASSITEM "CLASS"
CLASS
EXPRESSION 'land'
SYMBOL 'line5'
COLOR 64 64 64
SIZE 1
END
END # States line layer ends here
LAYER # States label layer begins here
NAME states
DATA states_ugl
STATUS DEFAULT
TYPE ANNOTATION
PROJECTION
"init=epsg:4326"
END
CLASSITEM "CLASS"
LABELITEM "STATE"
CLASS
EXPRESSION 'land'
COLOR -1 -1 -1
LABEL
COLOR 255 255 255
TYPE TRUETYPE
FONT arial-bold
SIZE 12
ANTIALIAS FALSE
POSITION CL
PARTIALS FALSE
MINDISTANCE 300
BUFFER 4
END # end of label
END # end of class
END # States label layer ends here
# End of LAYER DEFINITIONS -------------------------------
END # end of map file
Here is the template file:
<html>
<head>
<title>MapServer 4.0 Tutorial</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link type="text/css" rel="stylesheet" href="/projects/tutorial/ms35.css" />
</head>
<body bgcolor="#FFFFFF" text="#000000">
<table align="center" width="600" border="0">
<tr>
<td>
<h3 align="center">MapServer Tutorial:<br />
Example 1.9</h3>
<div align="center">
<img border="1" src="/cgi-bin/mapserv.exe?
map=c:\ms4w\tutorial\example1-9.map&mode=map" />
</div>
<p align="left">The map above was created in "map" mode. It is
a static map.</p>
<!-- START OF MAPSERVER FORM -->
<form name="mapserv" method="GET" action="/cgi-bin/mapserv.exe">
<!-- HIDDEN MAPSERVER CGI VARIABLES -->
<input type="hidden" name="map" value="[map]">
<input type="hidden" name="imgext" value="[mapext]">
<input type="hidden" name="imgxy" value="199.5 149.5">
<input type="hidden" name="zoom" value="1">
<input type="hidden" name="mode" value="browse">
<div align="center">
<table border="1" cellpadding="0" cellspacing="0">
<tr><td>
<!-- THE INTERACTIVE, DYNAMICALLY CREATED MAP -->
<input type="image" name="img" src="[img]"
width="400" height="300">
</td></tr>
</table>
</div>
</form>
<p>This dynamic map is being generated in "browse" mode. Click
on any point in the map and see what happens.</p>
<p>Both of these maps use the same mapfile definitions. The difference is
that the second map (the dynamically created one) relies on HTML form
for interactivity. If you look at how this page is linked from the
previous
page, you'll see that it isn't the same as the previous examples. This
page is what's called, in MapServer terms, an HTML template. You will
learn more about HTML templates in section 2.</p>
<hr>
<p>have a look at the "form" block within this page (right
click
on your browser and select "view source" or something
similar):</p>
<pre> <!-- START OF MAPSERVER FORM -->
<form name="mapserv" method="GET" action="/cgi-
bin/mapserv40">
<!-- HIDDEN MAPSERVER CGI VARIABLES -->
<input type="hidden" name="map"
value="[map]">
<input type="hidden" name="imgext"
value="[mapext]">
<input type="hidden" name="imgxy" value="199.5
149.5">
<input type="hidden" name="zoom"
value="1">
<input type="hidden" name="mode"
value="browse">
<div align="center">
<table border="1" cellpadding="0"
cellspacing="0">
<tr><td>
<!-- THE INTERACTIVE, DYNAMICALLY CREATED MAP --
<input type="image" name="img"
src="[ img ]" width="400"
height="300">
</td></tr>
</table>
</div>
</form></pre>
<p>This block executes the MapServer CGI program ("/cgi-
bin/mapserv40")
each time a user clicks on the map. The map is actually another form
"input",
represented here by the line:
<pre><input type="image" name="img"
src="[img]" width="400"
height="300"></pre>
The items in square brackets ([map], [mapext], and
[img])
are what's known as MapServer tags--these are MapServer CGI variables and
they get replaced by the MapServer CGI program when it reloads. The tag
[map] is a placeholder for the mapfile path so it's replaced
with
"[map]" when MapServer runs. The tag [mapext] is
replaced
with the current map extent, "[mapext]", and the
[img]
tag is replaced with the path to the image the MapServer CGI program
creates,
"[img]".</p>
<p>The hidden variable "mode" with the value "browse"
tells the CGI program that it needs to create and dump an image in the
"tmp" directory. This image is then referenced as
[img] and
this is what you see on your browser.</p>
<hr>
<p align="left">Now, have a look at the mapfile:</p>
<pre align="left">MAP
NAME EX1.9_
IMAGETYPE PNG24
EXTENT 201621.496941 -294488.285333 1425518.020722 498254.511514 # LAEA
#EXTENT -97.5 41.619778 -82.122902 49.38562 # Geographic
SIZE 400 300
SHAPEPATH "data"
SYMBOLSET "symbols/symbols35.sym"
FONTSET "fonts/fonts.list"
WEB
TEMPLATE 'example1-9.html'
IMAGEPATH '/tmp/'
IMAGEURL '/tmp/'
END
PROJECTION
# "proj=laea"
# "ellps=clrk66"
# "lat_0=45"
# "lon_0=-100"
#
# Alternatively, you can specify an EPSG code.
"init=epsg:2163"
#
END
# Start of LAYER DEFINITIONS ---------------------------------------------
LAYER # States polygon layer begins here
NAME states
DATA states_ugl
STATUS OFF
TYPE POLYGON
PROJECTION
"init=epsg:4326"
END
CLASSITEM "CLASS"
CLASS
EXPRESSION 'land'
SYMBOL 0
COLOR 232 232 232
END
END # States polygon layer ends here
LAYER # MODIS raster layer begins here
NAME modis
DATA "raster/mod09a12003161_ugl_ll_8bit.tif"
STATUS DEFAULT
TYPE RASTER
PROCESSING "BANDS=1,2,3"
OFFSITE 71 74 65
PROJECTION
"init=epsg:4326"
END
END # MODIS raster layer ends here
LAYER # LandSat WMS map from JPL (or from USGS)
NAME LandSat
TYPE RASTER
OFFSITE 0 0 0
STATUS OFF
CONNECTIONTYPE WMS
CONNECTION "http://wms.jpl.nasa.gov/wms.cgi?
REQUEST=map&LAYERS=us_landsat7&STYLES=
&FORMAT=png&TRANSPARENT=true"
#CONNECTION "http://gisdata.usgs.net/servlet/com.esri.wms.Esrimap?
ServiceName=USGS_WMS_LANDSAT7
&VERSION=1.0.0&REQUEST=map&Layers=LANDSAT7&SRS=EPSG:4326&REASPECT=false&Format=p
ng&"
METADATA
"wms_title" "LandSat"
"wms_name" "us_landsat7"
"wms_server_version" "1.0.0"
"wms_srs" "epsg:4326"
"wms_format" "image/png"
#"wms_title" "US_Landsat7"
# "wms_srs" "epsg:4326"
# "wms_connectiontimeout" "1000"
END
PROJECTION
"init=epsg:4326"
END
END # LandSat WMS image ends here
LAYER # States line layer begins here
NAME states
DATA states_ugl
STATUS DEFAULT
TYPE LINE
PROJECTION
"init=epsg:4326"
END
CLASSITEM "CLASS"
CLASS
EXPRESSION 'land'
SYMBOL 'line5'
COLOR 64 64 64
SIZE 1
END
END # States line layer ends here
LAYER # States label layer begins here
NAME states
DATA states_ugl
STATUS DEFAULT
TYPE ANNOTATION
PROJECTION
"init=epsg:4326"
END
CLASSITEM "CLASS"
LABELITEM "STATE"
CLASS
EXPRESSION 'land'
COLOR -1 -1 -1
LABEL
COLOR 255 255 255
TYPE TRUETYPE
FONT arial-bold
SIZE 12
ANTIALIAS FALSE
POSITION CL
PARTIALS FALSE
MINDISTANCE 300
BUFFER 4
END # end of label
END # end of class
END # States label layer ends here
# End of LAYER DEFINITIONS -------------------------------
END # end of map file</pre>
<hr>
<p>There's really only one thing that's been added to the mapfile:</p>
<p>TEMPLATE 'example1-9.html'<br>
This tells MapServer to use the page "example1-9.html" as a
template file. MapServer will process this file and replace the tags it
encounters before sending it to the web browser. This is how the next
two sections in this tutorial works.</p>
<hr>
<p>This marks the end of Section 1. I hope you leave this section with
enough
knowledge on how things are set in a MapServer MapFile. I can't stress
enough the importance of keeping the <a
href="http://mapserver.gis.umn.edu/doc40/cgi-reference.html">MapServer
MapFile Reference</a> open as you create your own mapfile and
application.
Without it, I wouldn't have gone very far with this tutorial.. For a
hierarchical
view of the mapfile objects and keywords, please have a look at the <a
href="http://vega.unm.edu/mapserver_workshop/reference/mapfile-reference-
table.html">reference
page</a> from Earth Data Analysis Center (EDAC) at the University of
New
Mexico.</p>
<hr>
<p class="Small" align="center"><a href="/projects/tutorial/example1-
8.html">Back
to Example 1.8</a> | <a href="/projects/tutorial/section1.html">Back to
Section 1</a> | <a href="/projects/tutorial/sections.html">Back to the
Sections Page</a> | <a href="/projects/tutorial/section2.html">Proceed
to Section 2</a></p>
</td>
</tr>
</table>
</body>
</html>
I have modified the httpd.conf in this way:
Alias /tutorial/ "/ms4w/tutorial/"
<Directory "/ms4w/tutorial/">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
<Directory "/ms4w/tmp/">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
I believe that i am missing something with WEB object(IMAGEURL)
Can you give me from what I have written a hint about what should I write at
IMAGEPATH and IMAGEURL?
Thanks
_____________________________________________
Castiga peste 1000 de premii cu Wella Design!
http://wella.boom.ro
More information about the MapServer-users
mailing list