Proposing to support for creating maps with mapserv.exe using the command line

Tamas Szekeres szekerest at GMAIL.COM
Wed Jun 21 12:21:27 EDT 2006


Frank,

My primary aim was to enable the image creation by using mapserver as
a command line tool by utilizing the sophisticated funcionality
provided by mapserv.exe. The implementation suggested was obvious
requiring few line to be changed. Suppressing the header seems to be
equivalent for me and i am ready to move into this direction if
needed.
However i am a bit uncertain about the benefit using the OWS
functionality this way. It requires to change much amount of code that
i haven't addressed.
I am not disagreed about the latter if someone can convince me of the
usability of this functionality.

Best Regards,

Tamas


2006/6/21, Frank Warmerdam <warmerdam at pobox.com>:
> Tamas Szekeres wrote:
> > Developers,
> >
> > I would be required to enable using mapserv.exe as a commandline tool
> > for the map image creation. The current implementation already has a
> > QUERY_STRING argument to receive the cgi style parameter list.
> > However mapserv.exe is creating the generated image onto the stdout
> > including the content type header information. With the following
> > patch one could specify the output file as an additional commandline
> > parameter, like:
> >
> > mapserv.exe "QUERY_STRING=map=mymap.map&mode=map" -omymap.png
>
> Tamas,
>
> I would be inclined to approach this as a flag to suppress the
> content type flag, and to leave it to normal file redirection to
> write to a file.  But if you are doing this, wouldn't it also be
> desirable to have it work for WMS and other sorts of requests too,
> not just "traditional mode" mapserver map rendering?  If so, I think
> you would need to touch quite a few additional bits of code.
>
> I would add that the shp2img utility can be used for commandline
> map output though it lacks some options available with mapserv.
>
> Best regards,
>
> > In order to achieve this functionality the following changes should be made
> >
> > --- mapserv.c    14 Dec 2005 19:55:07 -0000    1.150
> > +++ mapserv.c    21 Jun 2006 14:50:07 -0000
> > @@ -1109,6 +1109,7 @@
> >     char buffer[1024];
> >     imageObj *img=NULL;
> >     int status;
> > +    char* outfile = NULL;
> >
> > /* -------------------------------------------------------------------- */
> > /*      Process arguments.  In normal use as a cgi-bin there are no     */
> > @@ -1147,6 +1148,9 @@
> >             putenv( "REQUEST_METHOD=GET" );
> >             putenv( argv[1] );
> >         }
> > +        else if(strncmp(argv[iArg], "-o", 2) == 0) {
> > +            outfile = argv[iArg] + 2;
> > +        }
> >         else
> >         {
> >             /* we don't produce a usage message as some web servers pass
> > @@ -1318,9 +1322,9 @@
> >
> >       msIO_printf("Content-type:
> > %s%c%c",MS_IMAGE_MIME_TYPE(msObj->Map->outputformat), 10,10);
> >       if( msObj->Mode == MAP )
> > -          status = msSaveImage(msObj->Map,img, NULL);
> > +          status = msSaveImage(msObj->Map,img, outfile);
> >       else
> > -          status = msSaveImage(NULL,img, NULL);
> > +          status = msSaveImage(NULL,img, outfile);
> >
> >       if(status != MS_SUCCESS) writeError();
> >
> > @@ -1344,7 +1348,7 @@
> >           if(!img) writeError();
> >
> >           msIO_printf("Content-type:
> > %s%c%c",MS_IMAGE_MIME_TYPE(msObj->Map->outputformat), 10,10);
> > -          status = msSaveImage(NULL, img, NULL);
> > +          status = msSaveImage(NULL, img, outfile);
> >           if(status != MS_SUCCESS) writeError();
> >
> >           msFreeImage(img);
> > @@ -1579,7 +1583,7 @@
> >     if(!img) writeError();
> >
> >     msIO_printf("Content-type:
> > %s%c%c",MS_IMAGE_MIME_TYPE(msObj->Map->outputformat), 10,10);
> > -    status = msSaveImage(msObj->Map, img, NULL);
> > +    status = msSaveImage(msObj->Map, img, outfile);
> >     if(status != MS_SUCCESS) writeError();
> >     msFreeImage(img);
> >
> >
> > Any objections?
> >
> > Best Regards,
> >
> > Tamas
> >
> >
>
>
> --
> ---------------------------------------+--------------------------------------
> I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
> light and sound - activate the windows | http://pobox.com/~warmerdam
> and watch the world go round - Rush    | President OSGF, http://osgeo.org
>
>



More information about the mapserver-dev mailing list