MapServer & PostGIS won't work..

Robert Campbell rrc124 at GMAIL.COM
Thu Jun 2 21:55:25 PDT 2005


I just installed Postgres 8.0 and PostGIS 1.0.1 Win32 binaries. Both
work; I have a nice demo table set up with geometry columns, queries
work okay through pgAdmin III, etc.

I also installed MapServer for Windows - MS4W Base Install 1.1 which
is also working just fine (I'm able to run the tutorial pages and
modify the MapFiles, etc).

My problem is that when I add a postgis layer to a MapFile, nothing is
displayed. I went through the MapServer/PostGIS Wiki on
troubleshooting and I passed every test. I have included below my test
MapFile (the states layer displays perfectly):

MAP
  IMAGETYPE      PNG
  EXTENT         201621.496941 -294488.285333 1425518.020722 498254.511514
  SIZE           400 300
  SHAPEPATH      "data"
  IMAGECOLOR     255 255 255

  PROJECTION
    "proj=laea"
    "ellps=clrk66"
    "lat_0=45"
    "lon_0=-100"
  #
  # Alternatively, you can specify an EPSG code.
  # "init=epsg:2163"
  #
  END

  # Start of LAYER DEFINITIONS ---------------------------------------------

  LAYER # States polygon layer begins here
    NAME         states
    DATA         states_ugl
    STATUS       DEFAULT
    TYPE         POLYGON

    PROJECTION
      "init=epsg:4326"
    END

    CLASS
      COLOR        232 232 232
      OUTLINECOLOR 32 32 32
    END
  END # States polygon layer ends here


  LAYER
    CONNECTIONTYPE postgis
    NAME test
    # Connect to a remote spatial database
    CONNECTION "user=postgres dbname=GISage host=localhost"
    # Get the lines from the 'geom' column of the 'roads' table
    DATA "geom from gtest"
    STATUS ON

    PROJECTION
      "init=epsg:4326"
    END

    TYPE LINE
    # Of the lines in the extents, only render the wide highways
    CLASS
      # All the rest are darker and only 1 pixel wide
      COLOR 255 22 22      
      SIZE 2      
    END
  END

  # End of LAYER DEFINITIONS -------------------------------

END # end of map file/object




While my table looks like:

SELECT id, name, AsText(geom) AS geom FROM gtest;

Results in:

id;name;geom
"1";"First Geometry";"LINESTRING(2 3,4 5,6 5,7 8)"
"2";"Second Geometry";"LINESTRING(202621 -194488,502621 -94488,801621
294488,1101621 394488)"
"3";"Third Geometry";"LINESTRING(45 -100,30 -80,20 -60,-20 50)"


Thanks everyone! Oh, and I was able to log in with psql using the two
above CONNECTION string details (postgres & localhost).



More information about the MapServer-users mailing list