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.

I am trying to display a raster image with Mapserver using different bbox arguments in a mapserv cgi request. I have been trying to specify different bbox arguments to "crop" the raster display, but mapserver returns the full map ignoring the bbox argument.

How can I corectly specify the bounding box to display the raster?

The following example call renders the map at its full extent, although only a small part is requested

http://urbmet.webfactional.com/mapserv.cgi?MODE=map&MAP=gstack_example.map&LAYERS=HYP_50M_SR_W&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&SRS=EPSG%3A4326&BBOX=0,0,10,10&WIDTH=128

Here is the mapfile I am using:

MAP
SHAPEPATH     "shapefiles"
IMAGETYPE     PNG
EXTENT        -180 -90 180 90
SIZE          400 200
IMAGECOLOR    255 255 255
UNITS         DD
STATUS        ON
DEBUG         ON

PROJECTION
    "init=epsg:4326"
END

LAYER
    NAME      "HYP_50M_SR_W"
    DATA      HYP_50M_SR_W/HYP_50M_SR_W.tif
    STATUS    ON
    TYPE      RASTER
END
END
share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

You request is a WMS request, but you have not completed the required configuration in the map file. In fact the map file that you have posted is only good for cgi usage through mapserver's own url format.

You can either add the required WMS params to the map file and keep invoking mapserver as a WMS server (I would recommend this approach):

http://mapserver.org/ogc/wms_server.html

or change your URL so that it conforms to mapserver's own standard and do away with the map file changes. A sample application that you can use to infer the actual URL can be found here:

http://demo.mapserver.org/cgi-bin/mapserv?map=/osgeo/mapserver/tutorial/htdocs/example2.map&layer=states&zoom=0&mode=browse&root=/tutorial&program=/cgi-bin/mapserv&map_web=template+example2-1.html

share|improve this answer
    
thanks a lot, this was what I needed to know. –  yellowcap Nov 7 '11 at 8:59
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.