2

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

1 Answer 1

4

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

0

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.