[mapserver-users] mapserver not generating proper map
sunny74
sb.ray at hotmail.com
Mon Mar 22 02:26:39 PDT 2010
Hi,
I am generating a simple map but mapserver is not generating a proper map.
In fact initially it produced a proper one but after that due to code
changes or some other reason started producing this one.
My code to call mapserver is:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script
type="text/javascript"src="OL28/OL28/lib/OpenLayers.js"></script>
<script type="text/javascript" language="javascript">
var mapview, layer, layer1, map;
function init() {
//alert("in init");
map = new OpenLayers.Map('<%=map.ClientID%>');
//
layer = new OpenLayers.Layer.WMS("OpenLayers WMS",
"http://172.16.0.144:9000/cgi-bin/mapserv.exe?", { map:
'Shape/newwr1.map', layers: 'STATE', 'format': 'png' });
//layer1 = new OpenLayers.Layer.WMS("RLine",
"http://172.16.0.144:9000/cgi-bin/mapserv.exe?", { map: 'Shape/newwr1.map',
transparent: 'true', layers: 'RailwayStations', 'format': 'png' });
highlightLayer = new OpenLayers.Layer.Vector("Highlighted
Features", {
displayInLayerSwitcher: false,
isBaseLayer: false
}
);
map.addLayers([layer]);
map.setCenter(new OpenLayers.LonLat(73.25, 20.35), 6);
// for (var i in infoControls) {
// infoControls[i].events.register("getfeatureinfo",
this, showInfo);
// map.addControl(infoControls[i]);
// }
map.addControl(new OpenLayers.Control.LayerSwitcher());
map.zoomToMaxExtent();
// infoControls.click.activate();
}
</script>
</head>
<body onload="init()">
<form id="form1" runat="server">
<div id="map" runat="server" style="width:600px;height:600px">
</div>
</form>
</body>
and my map file is:
# Map file created from QGIS project file D:/QGIS/newwr.qgs
# Edit this file to customize for your map interface
# (Created with PyQgis MapServer Export plugin)
MAP
NAME newwr.map
# Map image size
SIZE 600 600
UNITS dd
EXTENT 67.440106 17.379867 78.390250 25.122977
FONTSET 'D:\ms4w\Apache\cgi-bin\Shape\font.txt'
PROJECTION
'proj=longlat'
'ellps=WGS84'
'datum=WGS84'
'no_defs'
''
END
# Background color for the map canvas -- change as desired
IMAGECOLOR 192 192 192
IMAGEQUALITY 95
IMAGETYPE gif
OUTPUTFORMAT
NAME GIF
DRIVER 'GD/gif'
MIMETYPE 'image/gif'
#IMAGEMODE PC256
EXTENSION 'gif'
END
# Legend
LEGEND
IMAGECOLOR 255 255 255
STATUS ON
KEYSIZE 18 12
LABEL
TYPE BITMAP
SIZE MEDIUM
COLOR 0 0 89
END
END
# Web interface definition. Only the template parameter
# is required to display a map. See MapServer documentation
WEB
# Set IMAGEPATH to the path where MapServer should
# write its output.
IMAGEPATH '/tmp/'
# Set IMAGEURL to the url that points to IMAGEPATH
# as defined in your web server configuration
IMAGEURL '/tmp/'
# WMS server settings
METADATA
'wms_title' 'newwr.map'
'wms_onlineresource'
'http://my.host.com/cgi-bin/mapserv?map=wms.map&'
'wms_srs' 'EPSG:4326'
END
#Scale range at which web interface will operate
# Template and header/footer settings
# Only the template parameter is required to display a map. See
MapServer documentation
END
LAYER
NAME 'STATE'
TYPE POLYGON
DATA 'D:\ms4w\Apache\cgi-bin\Shape\STATE.shp'
METADATA
'wms_title' 'STATE'
END
STATUS DEFAULT
TRANSPARENCY 100
PROJECTION
'proj=longlat'
'ellps=WGS84'
'datum=WGS84'
'no_defs'
''
END
CLASS
NAME 'STATE'
STYLE
SYMBOL 0
SIZE 2
OUTLINECOLOR 0 0 0
COLOR 255 255 127
END
END
END
LAYER
NAME 'WaterBody'
TYPE POLYGON
DATA 'D:\ms4w\Apache\cgi-bin\Shape\WaterBody.shp'
METADATA
But when my map comes up it is having a BBOX size of 256 * 256.
the url of the generated map is as follows:
http://172.16.0.144:9000/cgi-bin/mapserv.exe?MAP=Shape%2Fnewwr1.map&LAYERS=STATE&FORMAT=png&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A4326&BBOX=0,-90,180,90&WIDTH=256&HEIGHT=256
Why does it happen?
Is it because of some wrong openlayers code I have written or some bug?
What should I do to get back to the desired size i.e 600 * 600
Thanks for your attention & efforts.
--
View this message in context: http://n2.nabble.com/mapserver-not-generating-proper-map-tp4776875p4776875.html
Sent from the Mapserver - User mailing list archive at Nabble.com.
More information about the MapServer-users
mailing list