Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm trying to use this mapfile that I made:

MAP
  IMAGETYPE PNG
  EXTENT -90.000124 41.000032 -88.000044 42.000035
  SIZE 1600 800
  IMAGECOLOR 255 0 1 

OUTPUTFORMAT
  NAME png
  DRIVER AGG/PNG
  MIMETYPE "image/png"
  IMAGEMODE RGBA
  EXTENSION "png"
  FORMATOPTION "GAMMA=0.75"
 TRANSPARENT ON
END

LAYER
  NAME poly
  STATUS OFF
  TYPE POLYGON
  CONNECTIONTYPE POSTGIS
  CONNECTION "host=127.0.0.1 dbname=matt user=postgres password=postgres"
  DATA "the_geom from g41088"
  OPACITY 50
    CLASS
      NAME g41088P
        STYLE
          COLOR 200 200 200 
          OUTLINECOLOR 0 0 0
        END
    END
END

#LAYER
#  NAME line
#  STATUS OFF
#  TYPE LINE
#  CONNECTIONTYPE POSTGIS
#  CONNECTION "host=127.0.0.1 dbname=matt user=postgres password=postgres"
#  DATA "the_geom from g41088"
#   CLASS
#     NAME g41088L
#       STYLE
#         COLOR 0 0 0 
#       END
#   END
#END
END

But it only works when I have the second layer commented out. I can't figure out for the life of me what's wrong with it. I'm trying to do the same thing that this tutorial is doing, but with PostGis support.

share|improve this question

2 Answers 2

up vote 1 down vote accepted

your

NAME line

is probably causing the error, as "line" is a reserved mapfile keyword. Try with

NAME "line"

As a rule of thumb, you should always quote strings in a mapfile, even though the parser does allow strings that are not a reserved keyword to be left unquoted.

share|improve this answer

Perhaps you need to define the projection there or in the WEB section. Also it could be related to the mapserver executable, probably it's not located in the cgi-bin directory, so this isn't accessible in your HTML code. Try these links, especially the getCapabilities to see what error messages you get:

http://lists.maptools.org/pipermail/ms4w-users/2010-May/001541.html http://www.postgresql.org/message-id/20070821130754.GB1175@www.gisnet.com http://osgeo-org.1560.x6.nabble.com/still-have-problem-when-add-postgis-layer-on-mapserver-mapfile-td4997860.html

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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