繁体   English   中英

找不到地图服务器中的 postgres db http://localhost/cgi-bin/LAYER157439308110272.png

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM