【发布时间】:2019-11-22 03:36:49
【问题描述】:
代码LAYER.map文件Layer.map文件
MAP
NAME "LAYER"
SIZE 400 400
STATUS ON
EXTENT 1143759 4417539 1146436 4420390
UNITS METERS
WEB
TEMPLATE "template.html"
END
LAYER
CONNECTIONTYPE Postgis
CONNECTION "host=localhost dbname=newmapserver user=postgres password=**** port=5432"
DATA "geom FROM song"
NAME "song"
TYPE POLYGON
STATUS ON
CLASS
STYLE
COLOR 255 235 190
OUTLINECOLOR 0 0 0
SYMBOL 0
END
END
END
END
示例文件 sample.html 示例.html 文件
<html>
<head><title>Creating a simple image using Mapserver and a Shapefile</title></head>
<body bgcolor="#FFFFFF">
<h2>Creating a simple image using Mapserver and a Shapefile</h2>
<p><hr><p>
This page simply contains a link which sends a set of instructions to the Mapserver application using a mapfile.<br />
The information stored within the mapfile tells the Mapserver application how to draw the map.<p>
<!-- The following link sends the local file structure path of the mapfile to the web location of the mapserver executable file -->
<A HREF="http://localhost/cgi-bin/mapserv.exe?map=C:\ms4w\Apache\htdocs\LAYER.map">
Click on this link</A> to view a map generated using a Shapefile.
<p><hr><p>
</body>
</html>
template.html 文件 模板文件
<!-- MapServer Template -->
<html>
<head><title>Simple Mapserver Template HTML Document</title></head>
<body bgcolor=#AAAAAA>
<h2>The image below was illustrated based on the instructions sent in the mapfile.</h2>
<!-- When using Mapserver with a template, the Mapserver application looks for the [img] tag within the template document to place the map -->
<IMG SRC="[img]" width=400 height=300 border=0>
</body>
</html>
当我运行 sample.html 文件并单击链接查看时,我得到了 image not found 错误 在控制台中找不到http://localhost/cgi-bin/LAYER157439308110272.png。
【问题讨论】:
标签: javascript html postgresql mapserver