![](/img/trans.png)
[英]How to deploy flask application to cgi-bin folder on shared hosting?
[英]postgres db in mapserver getting not found http://localhost/cgi-bin/LAYER157439308110272.png
代碼 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
樣本文件 樣本.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 文件並單擊鏈接查看時,我在控制台中出現找不到圖像的錯誤,找不到http://localhost/cgi-bin/LAYER157439308110272.png 。
您的查詢模板文件結構不正確。 它應該看起來像這樣(列出數據庫表中所需的每一列):
<!-- MapServer Template -->
<tr>
<td>[name]</td>
<td>[description]</td>
</tr>
並且您應該從 LAYER 內部指向該模板文件,例如:
LAYER
...
CLASS
...
TEMPLATE "template.html"
...
END # CLASS
END # layer
我建議查看 MapServer 教程第 3.1 節中的完整工作示例: https://demo.mapserver.org/tutorial/section3.html
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.