[mapserver-users] Dynamically generated Raster images in mapfile

Heiko Schröter schroete at iup.physik.uni-bremen.de
Fri Apr 9 03:21:29 PDT 2010


Am Donnerstag 08 April 2010 14:56:33 schrieb Jörg Thomsen:

thanks a lot for the suggestions. I will give the WMS suggestion a first try.

> But a WMS is doing what you are asking for:
>  > create Raster images on the fly
> so perhaps you could use your script as WMS and call it with
> CONNECTIONTYPE WMS
> CONNECTION "http://.../yourscript"


The problem i'am facing is that with a "hardcoded" DATA staement everything works fine. The image is scaled and positioned even without a *.tfw file.
But getting the same image via the WMS connection the center of the received image is placed to the top left corner of the map. The whole image is there but resizing and proper positioning seems not to work.
When panning the map the image is recentered to the top left corner.
The "grid_test.pl" does nothing more but just copying the wackelkontakt.png from the file to STDOUT.
Warping and Reshaping works with DATA and WMS sources.

What do i have to do additionally to get the WMS raster positioned and scaled properly ?
Are there any return params needed from the WMS Server so that the WMS client does the display properly ?

Thanks and Regards
Heiko



/var/www/localhost/mapserver/mapserv -v
MapServer version 5.6.1 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG OUTPUT=WBMP OUTPUT=SVG SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=ICONV SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER SUPPORTS=WCS_SERVER INPUT=EPPL7 INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE

The Layer definition:
	LAYER
		EXTENT -180 -90 180 90
		NAME "GRID_TEST"
		OPACITY 60
		STATUS ON
		METADATA
			"wms_timeextent" "1970-01-01/2030-12-31"
			"wms_timeitem" "datum" #column in postgis table of type timestamp
			"wms_timedefault" "2007-12-10/2007-12-11"
			"wms_title" "grid_test"
			"wms_name" "grid_test"
			"wms_format" "image/png"
			"wms_server_version" "1.1.1"
			"wms_srs" "EPSG:4326"
			"wms_extent" "-180 -90 180 90"
		END
		PROJECTION
			"init=epsg:4326"
		END
#		CONNECTION "http://mailserv2/cgi-bin/grid_test.pl?"
#		CONNECTIONTYPE WMS
		DATA "/var/www/localhost/htdocs/grafik/wackelkontakt.png"
		TYPE RASTER
	END # Layer


grid_test.pl
#!/usr/bin/perl -w

use strict;
use DBI;
use CGI;

use File::Copy "copy";
$| = 1;

my $q = new CGI;
print $q->header(-type => 'image/png');
copy('/var/www/localhost/htdocs/grafik/wackelkontakt.png',\*STDOUT);

exit;





More information about the MapServer-users mailing list