0

I am trying to create WMS service using Postgres data in MapServer, my map file (wms.map) is:

MAP
 EXTENT 8240841.450745 2400319.900386 9218007.463612 3107183.406947
 TRANSPARENT on
 IMAGETYPE png
 size 150 500
 web
 metadata
 "wms_title" "Customer Airports"
 "wms_onlineresource" "http://localhost:8085/cgi-bin/mapserv.exe?"
 "wms_enable_request" "*"
 "wms_srs" "EPSG:4326 EPSG:900913"
 "wms_feature_info_mime_type" "text/html"
 "wms_format" "image/png"
 end
 end
 LAYER
 CONNECTIONTYPE postgis 
 CONNECTION "user=postgres password=abcd dbname=sample port=5432 host=localhost"
 DATA "geom FROM district_old using unique gid"
 STATUS Default
 TYPE polygon
 PROJECTION
 "init=epsg:900913"
 END 
 labelitem 'district'
 class 
 style 
 outlinecolor 90 90 90
 width 2
 end 
 LABEL
 size 2
 BACKGROUNDCOLOR 255 201 14
 position auto
 END 
 end 
 END
END # nmtoken edit added missing Map END tag

When I paste in the browser this URL:

"http://localhost/cgi-bin/mapserv.exe?map=c://ms4w/apps/webgis/wms.map&SERVICE=WMS&REQUEST=GetCapabilities" it is not displaying the XML file instead it is downloading a mapserv.exe file

Please correct my code.

nmtoken
13.6k5 gold badges39 silver badges91 bronze badges
asked Nov 23, 2015 at 9:23
9
  • 1
    Open the mapserver.exe file with a text editor. It contains the error message. Commented Nov 24, 2015 at 19:10
  • i am not getting any error message in xml file instead i am getting a warning as " WARNING: This layer has its status set to DEFAULT and will always be displayed when doing a GetMap request even if it is not requested by the client. This is not in line with the expected behavior of a WMS server. Using status ON or OFF is recommended. " Commented Nov 26, 2015 at 7:37
  • 1
    What message do you get from localhost/cgi-bin/mapserv.exe?map=c://ms4w/apps/webgis/wms.map? Commented Nov 27, 2015 at 19:19
  • 1
    What version of MapServer are you using? Commented Feb 11, 2016 at 9:19
  • 1
    Is your data stored in EPSG:900913 projection? Commented Mar 22, 2016 at 9:12

1 Answer 1

2

What you are seeing here is an error response from MapServer. There is something wrong with your request or your service and MapServer is sending an error message.

The name of the error file is mapserv.exe it is a file of type application/vnd.ogc.se_xml, not a copy of the MapServer executable. If you open the file in a text editor you should see what the error is, otherwise you should look at your log files.

Whilst improving the code formatting of your question I noticed that the code posted is missing a closing END statement for the opening MAP statement. Is this just a transcription error on your part, if not it then it's probably your error.

answered Oct 8, 2016 at 10:04

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.