TransWikia.com

MapServer WMS client - blank image

Geographic Information Systems Asked by Eylül on March 2, 2021

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

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.

Answered by nmtoken on March 2, 2021

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

Answered by Fabian Molina on March 2, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP