[MAPSERVER-USERS] problem: mapserv produces truncated image

BrainDrain paulborodaev at gmail.com
Wed Aug 13 09:22:17 EDT 2008


I have a correct map file & map extent set to some value tuple
when I request map tiles (256x256) I use urls like this
http://localhost/cgi-bin/mapserv.exe?layers=district_boundary&map=C%3A%2FWINDOWS%2FMicrosoft.NET%2FFramework%2Fv2.0.50727%2FTemporary%20ASP.NET%20Files%2Fwem%2Ff47bfcbf%2FSession_wdndwv554k5bdgzloezwkfng%2F0_cicbase.map&map_imagetype=AGG_JPEG&format=image%2Fjpeg&ts=1218632591362&session=wdndwv554k5bdgzloezwkfng&mode=map&mapext=45558.73493975904+-5410484.26506024+66216.46987951807+-5389826.530120482&imgext=45558.73493975904+-5410484.26506024+66216.46987951807+-5389826.530120482&map_size=256+256&imgx=128&imgy=128&imgxy=256+256
all works fine
but for my overview map I want to get small (180x90) image in single tile
mode:
http://localhost/cgi-bin/mapserv.exe?layers=street_axis%20water_resources%20district_boundary%20industrial_estate%20private_estate%20cottage%20culture_growth%20natural_growth%20highrise_estate%20graveyard&map=C%3A%2FWINDOWS%2FMicrosoft.NET%2FFramework%2Fv2.0.50727%2FTemporary%20ASP.NET%20Files%2Fwem%2Ff47bfcbf%2FSession_0nqmmljy3sq112anxcbz50yb%2F0_cicbase.map&map_imagetype=AGG_JPEG&format=image%2Fjpeg&ts=1218633146208&session=0nqmmljy3sq112anxcbz50yb&mode=map&mapext=-4660.150836680041+-5425914.804049532+102501.84916331996+-5372333.804049532&imgext=-4660.150836680041+-5425914.804049532+102501.84916331996+-5372333.804049532&map_size=180+90&imgx=90&imgy=45&imgxy=180+90
but mapserv produces truncated image
http://www.nabble.com/file/p18962950/truncated.jpg 
my web service (it's slower than mapserv) produces normal image
http://www.nabble.com/file/p18962950/normal.jpg 
my code:
private void emulateMapServer(HttpContext context, mapObj map)
{
	HttpRequest request = context.Request;
	HttpResponse response = context.Response;
	HttpServerUtility server = context.Server;            
	int i;		
	ArrayList layersQuery = new
ArrayList(context.Server.UrlDecode(request.QueryString["layers"]).Split('
'));            
	string
imageType=context.Server.UrlDecode(request.QueryString["map_imagetype"]);//AGG_PNG24
	string
format=context.Server.UrlDecode(request.QueryString["format"]);//"image/png"
	string
queryFile=context.Server.UrlDecode(request.QueryString["queryFile"]);	
	
	string[]
extentRaw=context.Server.UrlDecode(request.QueryString["mapext"]).Split('
');            
	string[]
mapSize=context.Server.UrlDecode(request.QueryString["map_size"]).Split('
');            
		
	for (i = 0; i < map.numlayers; i++)
	{                
		using (layerObj layer = map.getLayer(i))                
			if (layersQuery.Contains(layer.name))//Default
			{
				if (layer.status != mapscript.MS_ON)
					layer.status = mapscript.MS_ON;
				//layer.setFilter("");
			}
			else
				if (layer.status != mapscript.MS_OFF)
					layer.status = mapscript.MS_OFF;
	}

	rectObj currentExtent = new rectObj(map.extent.minx, map.extent.miny,
map.extent.maxx, map.extent.maxy, 0);//map.extent
	
	rectObj newExtent = new rectObj(double.Parse(extentRaw[0],
CultureInfo.InvariantCulture.NumberFormat), double.Parse(extentRaw[1],
CultureInfo.InvariantCulture.NumberFormat), double.Parse(extentRaw[2],
CultureInfo.InvariantCulture.NumberFormat), double.Parse(extentRaw[3],
CultureInfo.InvariantCulture.NumberFormat), 0);//Convert.ToDouble();
	if (currentExtent.minx != newExtent.minx || currentExtent.maxx !=
newExtent.maxx || currentExtent.miny != newExtent.miny || currentExtent.maxy
!= newExtent.maxy)
		map.extent = newExtent;                
	if (map.imagetype != imageType)
		map.setImageType(imageType);
	int newWidth = int.Parse(mapSize[0]);
	int newHeight = int.Parse(mapSize[1]);
	if (map.width != newWidth || map.height != newHeight)
	{
		map.width = newWidth;
		map.height = newHeight;		
	}
	response.ContentType = format;//outputFormatObj.mimetype?            	

	imageObj imgRaw=null;	

	if (queryFile!=null)
		map.loadQuery(queryFile);

	if (validateQuery(map))
	{
		if (map.querymap.status != mapscript.MS_ON)
			map.querymap.status = mapscript.MS_ON;
		imgRaw=map.drawQuery();
	}
	else
	{
		if (map.querymap.status != mapscript.MS_OFF)
			map.querymap.status = mapscript.MS_OFF;
		imgRaw = map.draw();		
	}	
	
	using (MemoryStream ms = new MemoryStream(imgRaw.getBytes()))
		ms.WriteTo(response.OutputStream);
}
nothing unusual.
how can I do it woth mapserv?


-- 
View this message in context: http://www.nabble.com/problem%3A-mapserv-produces-truncated-image-tp18962950p18962950.html
Sent from the Mapserver - User mailing list archive at Nabble.com.



More information about the mapserver-users mailing list