2

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?

2 Answers 2

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.

2
  • 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, 2017 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, 2017 at 13:42
0

A PROJECTION must be set in the mapfile for the MAP unless you are sure that all your WMS layers support only a single projection which is the same as the PROJECTION of the map. The MAP PROJECTION can be set using "init=epsg:xxxx" codes or using regular PROJ parameters. Failure to set a MAP PROJECTION may result in blank maps coming from remote WMS servers (because of inconsistent BBOX+SRS combination being used in the WMS connection URL).

https://www.mapserver.org/ogc/wms_client.html#mapfile-configuration

This is an exemple: https://mapserver.org/tutorial/example1-7.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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