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.

This is related to another question I asked just recently:

Use OpenLayers WMSGetFeatureInfo on Mapserver Layer?

unicoletti indicated that he/she was able to use OpenLayer's WMS Layer declaration to generate and query MapServer WMS. However, when I attempt the same, I get a error response:

mapserv(): Web application error. Query mode needs a point, imgxy and mapxy are not set.

This error makes sense in that when I use OL's MapServer Layer declaration, the url string includes these options with values filled in. But using the WMS Layer declaration with standard WMS GetMap options, i.e. BBOX, WIDTH, HEIGHT, generates this error. The image is not correct either which I describe next.

Another symptom is that the entire extent of the data defined in the mapfile is displayed rather than what's indicated in the BBOX when just doing a standard WMS GetMap request via a URL rather than using OpenLayers.

So for example, here's the first part of my mapfile:

MAP 
  NAME "testgrib" 
  IMAGETYPE      PNG 
  EXTENT         -14000000 3000000 -7000000 7000000

And here's a GetMap request using standard WMS options:

http://localhost:8080/cgi-bin/mapserv?REQUEST=GetMap&SERVICE=WMS&VERSION=1.1.1&FORMAT=image%2Fpng&MODE=map&MAP=wxmap%2Fglmpvis.map&LAYERS=mosaic&SRS=EPSG%3A3857&TRANSPARENT=TRUE&STYLES=&BBOX=-13807095.590531,3308267.5857033,-12241665.251469,4482340.3400001&WIDTH=640&HEIGHT=480

As you can see, the BBOX extent values are different from those in the mapfile. But, MapServer returns an image with the extent values in the mapfile no matter what BBOX values are passed. I've changed the mapfile extent to match the BBOX values and sure enough, an image of only that area is returned.

Hence this leads me to believe we've missed something during our MapServer installation, some setting or configuration. I've checked to see that WMS was supported and received SUPPORTS=WMS_SERVER when making a GetCapabilities request as well as a -v on the MapServer executable.

I considered attaching the options to the query function that I can see are used to generate images using OL's MapServer Layer declaration to get around this issue. But, as we eventually want our customers to access our data through the WMS, solving that would seem to be the main goal here.

I've searched the web and MS docs for a possible setting/configuration, but nothing really stood out as being critical. I do have "wms_enable_request" "*" in the map file and, as indicated, I am receiving images from MapServer, albeit for the max extent of the data vs the viewing area. And I'm receiving a response back to the query, so this doesn't look like a cross domain/proxy issue. Also, this occurs with displaying an image for raster data as well as an image of point data. The only thing that works is to use OL's MapServer declaration to generate the images properly for the viewing area. But, that's not what we want for a long term solution with our customers accessing the data via WMS.

So, open to suggestions as to what we should either configure differently or what we might've missed to enable standard WMS in our MapServer.

Thanks!

share|improve this question
    
Have you seen this document: mapserver.org/ogc/wms_server.html ? –  unicoletti Mar 4 '12 at 20:04
    
This answer should help you too: gis.stackexchange.com/a/18368/3895 –  unicoletti Mar 4 '12 at 21:47
    
Ref first comment - one of the first places I looked, but I may have to go over this section once again to see if I missed anything. Second comment: This doesn't appear to be projection related because when I use OL's MapServer declaration, everything lines up perfectly. And while recommended, if the wms_srs is not included in the LAYER metadata, the layer inherits the MAP level wms_srs, which is specified. And MapServer returns an image which appears to be projected correctly for the extent in the mapfile. Just doesn't apply the BBOX values that are sent. –  teknocreator Mar 5 '12 at 13:05
    
First, I should've said thanks for the suggestions. Next, I suppose one thing I could try is to start over with the required entries for a mapfile in the first reference you mentioned and see what happens. I did attempt to try something like this by commenting out the EXTENT and SIZE, but got an error that MS couldn't determine an image size. –  teknocreator Mar 5 '12 at 13:08
    
[SOLVED] Found out on another forum that a proper WMS call does not use the "MODE=map" option. When one does that, it's not a WMS call but a MapServer call. Therefore, MapServer specific values are required (e.g. imgext, mapext). Taking out the "MODE=map" using a point layer vs the raster I started to work with did indeed use the BBOX, HEIGHT, and WIDTH values in the WMS options. The reason I had thought it was needed was that I would get an error the with raster later I started to work with and it would go away if I put it back in. Different problem and might post that one as well. –  teknocreator Mar 6 '12 at 1:22
show 2 more comments

1 Answer 1

up vote 4 down vote accepted

[SOLVED] Posting my last comment as the answer because it really did solve the problem. Found out the MapServer User forum that a proper WMS call does not use the "MODE=map" option. When one does that, it's not a WMS call but a MapServer call. Therefore, MapServer specific values are required (e.g. imgext, mapext). Taking out the "MODE=map" and then using a point layer vs the raster I started to work with did indeed use the BBOX, HEIGHT, and WIDTH values in the WMS options to properly display the layer over the map area. The reason I had thought "MODE=map" was needed was that I would get an error with the raster layer I started to work with and it would go away if I put it back in. But, I then tried with a points layer with the same EPSG as the map (raster was different and real cause of that error) and that worked when I didn't use the "MODE=map" in the options. unicoletti was essentially correct that the mapserver link provided the answer. But, I couldn't see this detail in the doc due to the other error I was getting with the raster layer. A person on the MapServer User forum I asked the question to told me outright that including "MODE=map" makes the call a MapServer call and that expects different parameters (i.e. imgext, mapext), whereas taking MODE=map out and using the WMS options for GetMap makes it a WMS call. BTW, I also solved the problem with the raster layer. I was getting an error indicating the SRS had to be the same for the layers which didn't initially make sense according to the MapServer docs and how I had structured the mapfile. But, searched for the error, reread the MapServer docs, saw other possible answers on the user forums, changed around the mapfile, and finally got it to work. Thanks for the comments and to all for considering this problem!

share|improve this answer
add comment

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.