1

I set up WMS server using MapServer, and the following requests work:

http://localhost:8081/cgi-bin/mapserv.exe?map=/ms4w/apps/tutorial/htdocs/example2_wms.map&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetCapabilities

http://localhost:8081/cgi-bin/mapserv.exe?map=/ms4w/apps/tutorial/htdocs/example2_wms.map&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&LAYERS=hydro&STYLES=&SRS=EPSG:4326&BBOX=-97.239,41.6198,-82.1229,49.3856&WIDTH=400&HEIGHT=300&FORMAT=image/png

I also tried to use the WMS that I serve in a map file, added the WMS in the following way:

LAYER 
  NAME         hydro
  # PROCESSING   "LOAD_WHOLE_IMAGE=TRUE"
  TYPE         RASTER
  STATUS       ON
  CONNECTIONTYPE WMS
  CONNECTION "http://localhost:8081/cgi-bin/mapserv.exe?"  

  METADATA
    "wms_srs" "EPSG:4326"
    "wms_name" "hydro"
    "wms_server_version" "1.1.1"
    "wms_format" "image/jpeg"
  END
END 

Then requested it with the following URL: http://localhost:8081/cgi-bin/mapserv.exe?map=/ms4w/apps/tutorial/htdocs/example1-7.map&layer=hydro&mode=map

However, I only see a blank image.

Looks like this is the way, see http://mapserver.org/ogc/wms_client.html#wms-client & http://demo.mapserver.org/cgi-bin/mapserv?map=/osgeo/mapserver/tutorial/htdocs/example1-7.map&layers=states+states_label+modis_jpl&mode=map. Here modis_jpl is not visible too, but in the map file its status is off, this can be the reason.

Any idea on what I am doing wrong here?

1

Any idea on what I am doing wrong here?

You need to remove the mode=map parameter from your requests if you want to have MapServer provide a WMS.

  • As I am truly a beginner in MapServer, I am trying to follow the MapServer tutorial. So, in the example 2.5 (demo.mapserver.org/cgi-bin/mapserv?map=/osgeo/mapserver/…) a remote WMS is attempted to be used (modis_jpl - "Daily MODIS Image"). But I cannot see it. In any case I added my local WMS layer in the map file and edited the HTML and HTML template. Still nothing. – Eylül Feb 27 '17 at 12:31
  • Mapserver can through a single map file be configured to provide multiple types of service. Your title suggests that you have a client that operates on a WMS, but if your requests to the server include the mode=map parameter then you will not get a WMS response. To see if you have configured your map file correctly as a WMS try using a client such as QGIS to consume the service. In your map file set the DEBUG level to 4, and look at the logs if things don't work – nmtoken Feb 27 '17 at 13:42

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.