2

I am new to Mapserver. I have done sample application..

   MAP
   NAME "Hello_World"
   SIZE 400 300
   IMAGECOLOR 249 245 186
   IMAGETYPE png
   EXTENT -1.00 -1.00 1.00 1.00
   WEB
       TEMPLATE "C:/Mapserver/ms4w/Apache/htdocs/Hello/Hello.html"
       IMAGEPATH "C:/Mapserver/ms4w/Apache/htdocs/tmp/"
       IMAGEURL "/tmp/"
  END
  LAYER
       NAME 'TEST_LAYER'
       STATUS default
       TYPE point
       FEATURE
       POINTS 0.0 0.0 END
       TEXT "Hello World"
       END
  CLASS
      STYLE
         COLOR 255 0 0
      END
     LABEL
     TYPE bitmap
     END
 END # end class
 END # end layer
 END # end mapfile   

And my Html file is :

    <html>
<head><title>MapServer Hello World</title></head>
    <body>
       <form method=POST action="/cgi-bin/mapserv.exe">
          <input type="submit" value="Click Me">
          <input type="hidden" name="map" value="C:/Mapserver/ms4w/Apache/htdocs/Hello/mapdata/hello.map">
          <input type="hidden" name="map_web_imagepath" value="C:/Mapserver/ms4w/Apache/htdocs/tmp/">
       </form>
     <IMG SRC="[img]" width=400 height=300 border=0 />
   </body>
   </html>

When I run the through URL http://localhost:88/cgi-bin/mapserv.exe?map=C:/Mapserver/ms4w/Apache/htdocs/Hello/mapdata/hello.map

It generated image in the temporary folder.

When I click the "Click me" button , Its say loadWeb(): Unknown identifier. Parsing error near (C):(line 1)

I am using MapServer version 5.6.6

Please anybody help me.

Thanks in advance.

Piraba
  • 6,974
  • 17
  • 85
  • 135

3 Answers3

3

I got similar problem when I call WMS via URI. http://sun-web-extdev.ga.gov.au/cgi-bin/mapserv?map=map.map&map_web_template=template.html&map_imagetype=png

action to fix this problem: remove template line in .map file and using following WMS URI:

http://sun-web-extdev.ga.gov.au/cgi-bin/mapserv?map=map.map&map_web=template+template.html&map_imagetype=png

from version 5 WMS discard config template file in .map file instead using append parameter as above.

in your case try add

david
  • 31
  • 2
2

in your html file put this comment in the first line

<!-- Mapserver Template -->

and erase this line:

<input type="hidden" name="map_web_imagepath" value="C:/Mapserver/ms4w/Apache/htdocs/tmp/">

this worked for me.

bart
  • 21
  • 2
1

I got the same error while creating some tutorial on using MapServer on Windows.

The solution was change all "/" to "//" on the map file. Since Windows is sensitive to backslashes

Using the example IMAGEPATH path above

This

IMAGEPATH "C:/Mapserver/ms4w/Apache/htdocs/tmp/"

Changed to this Worked

IMAGEPATH "C://Mapserver//ms4w//Apache//htdocs//tmp//"

Erick
  • 1,408
  • 14
  • 19