1

I am trying to generate a map in mapserver by connecting a postgres database but it is not displaying any maps. My table name is a19010100001001.

mapfile is LAYER.map

MAP
NAME "MP"
SIZE 400 400
STATUS ON
EXTENT 1143759 4417539 1146436 4420390
UNITS METERS 

WEB
TEMPLATE "template.html"
  IMAGEPATH "C:\ms4w\Apache\htdocs\output"
  IMAGEURL "/OUTPUT/"
END



LAYER
        CONNECTIONTYPE Postgis
        CONNECTION "host=localhost dbname=postgis20 user=postgres password=******* port=5432"
        DATA "the geom FROM a19010100001001"
    NAME "a19010100001001"
    TYPE POLYGON
    STATUS ON
    CLASS
      STYLE
        COLOR 255 235 190
        OUTLINECOLOR 0 0 0
        SYMBOL 0
      END
    END
END
END

startmap.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:8080/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>

Where is the mistake?

1
  • Try if STATUS DEFAULT helps. – user30184 Feb 6 '15 at 10:30
1

Replace the geom for the_geom (note the underscore).

If the column really includes a space then you must reference it with double quotes: "the geom". This later case is not such a good idea, I would advise you to rename the table column to the_geom.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.