[mapserver-users] Re: MapScript WMS request

2011-09-08 Thread Mr . Puneet Kishor
a bit more investigation on producing a WMS response via Perl MapScript reveals 
the following error

  ?xml version='1.0' encoding=ISO-8859-1 standalone=no ?
  !DOCTYPE ServiceExceptionReport SYSTEM 
http://schemas.opengis.net/wms/1.1.0/exception_1_1_0.dtd;
  ServiceExceptionReport version=1.1.0
  ServiceException
  msWMSDispatch(): WMS server error. WMS request not enabled. Check 
wms/ows_enable_request settings.
  /ServiceException
  /ServiceExceptionReport

So, it seems I have to somehow, somewhere enable 'ows_enable_request'. Looking 
at the documentation, seems like if I had a map file, I could add the following 
line to do so

  ows_enable_request '*'

However, I am not using a map file at all. Not finding any documentation on 
this setting, I tried the following to no avail

  $map-{ows_enable_request} = '*';


Suggestions, anyone?


On Sep 7, 2011, at 10:18 PM, Mr. Puneet Kishor wrote:

 I would really appreciate insight from someone well-versed in the ins and 
 outs of WMS via MapScript. Looking at the discussion at 
 [http://trac.osgeo.org/mapserver/ticket/670], the `img = wms_map.draw()` step 
 seems to be a crucial part of drawing the image.
 
 So, I added `my $img = $map-draw();` to my code below, and indeed, the image 
 was drawn and sent back to the browser.
 
 Is this something that should be added to the examples in the documentation? 
 Is this the right way to do things? In any case, I am not write to STDOUT, 
 and sending the buffer directly. Instead, my code is very much like a regular 
 request (and it works) --
 
my $new_extent = $map-{extent};
 
my $req = new mapscript::OWSRequest();
$req-setParameter( SERVICE, WMS );
$req-setParameter( VERSION, 1.1.0 );
$req-setParameter( REQUEST, GetMap );
$req-setParameter( BBOX, -180,-90,180,90 );
$req-setParameter( LAYERS, layer_name);
$req-setParameter( SRS, -1);
$req-setParameter( WIDTH, 1200);
$req-setParameter( HEIGHT, 600);
 
my $dispatch_out = $map-OWSDispatch( $req );
my $img = $map-draw();
my $map_img = 'test_' . sprintf(%0.10d, rand(10)) . '.png';
$img-save(/path/to/$map_img);
return send_file(/path/to/$map_img);
 
 
 Comments? Corrections?
 
 
 On Sep 7, 2011, at 6:12 PM, Mr. Puneet Kishor wrote:
 
 
 On Sep 7, 2011, at 5:49 PM, Mr. Puneet Kishor wrote:
 
 I am trying to convert my MapScript program to a WMS responder. I create my 
 $map where I set all the layers and classes and colors, etc, just like for 
 a normal, non-WMS request that works perfectly correctly.
 
 my $map = undef;
 $map = mapObj(name = 'mymap') unless defined $map;
 
 my $req = new mapscript::OWSRequest();
 $req-setParameter( SERVICE, WMS );
 $req-setParameter( VERSION, 1.1.0 );
 $req-setParameter( REQUEST, GetCapabilities );
 
 I changed the above line to 
 
  $req-setParameter( REQUEST, GetMap);
 
 but, still no improvement.
 
 
 
 mapscript::msIO_installStdoutToBuffer();
 my $dispatch_out = $map-OWSDispatch( $req );
 printf %s\n, mapscript::msIO_getStdoutBufferString();
 
 Except, the above doesn't really do anything for me. I get nothing in my 
 browser. Suggestions?
 
 
 --
 Puneet Kishor
 
 

___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] Re: MapScript WMS request

2011-09-08 Thread thomas bonfort
it goes in map-web-metadata


On Thu, Sep 8, 2011 at 19:48, Mr. Puneet Kishor punk.k...@gmail.com wrote:
 a bit more investigation on producing a WMS response via Perl MapScript 
 reveals the following error

  ?xml version='1.0' encoding=ISO-8859-1 standalone=no ?
  !DOCTYPE ServiceExceptionReport SYSTEM 
 http://schemas.opengis.net/wms/1.1.0/exception_1_1_0.dtd;
  ServiceExceptionReport version=1.1.0
  ServiceException
  msWMSDispatch(): WMS server error. WMS request not enabled. Check 
 wms/ows_enable_request settings.
  /ServiceException
  /ServiceExceptionReport

 So, it seems I have to somehow, somewhere enable 'ows_enable_request'. 
 Looking at the documentation, seems like if I had a map file, I could add the 
 following line to do so

  ows_enable_request '*'

 However, I am not using a map file at all. Not finding any documentation on 
 this setting, I tried the following to no avail

  $map-{ows_enable_request} = '*';


 Suggestions, anyone?


 On Sep 7, 2011, at 10:18 PM, Mr. Puneet Kishor wrote:

 I would really appreciate insight from someone well-versed in the ins and 
 outs of WMS via MapScript. Looking at the discussion at 
 [http://trac.osgeo.org/mapserver/ticket/670], the `img = wms_map.draw()` 
 step seems to be a crucial part of drawing the image.

 So, I added `my $img = $map-draw();` to my code below, and indeed, the 
 image was drawn and sent back to the browser.

 Is this something that should be added to the examples in the documentation? 
 Is this the right way to do things? In any case, I am not write to STDOUT, 
 and sending the buffer directly. Instead, my code is very much like a 
 regular request (and it works) --

    my $new_extent = $map-{extent};

    my $req = new mapscript::OWSRequest();
    $req-setParameter( SERVICE, WMS );
    $req-setParameter( VERSION, 1.1.0 );
    $req-setParameter( REQUEST, GetMap );
    $req-setParameter( BBOX, -180,-90,180,90 );
    $req-setParameter( LAYERS, layer_name);
    $req-setParameter( SRS, -1);
    $req-setParameter( WIDTH, 1200);
    $req-setParameter( HEIGHT, 600);

    my $dispatch_out = $map-OWSDispatch( $req );
    my $img = $map-draw();
    my $map_img = 'test_' . sprintf(%0.10d, rand(10)) . '.png';
    $img-save(/path/to/$map_img);
    return send_file(/path/to/$map_img);


 Comments? Corrections?


 On Sep 7, 2011, at 6:12 PM, Mr. Puneet Kishor wrote:


 On Sep 7, 2011, at 5:49 PM, Mr. Puneet Kishor wrote:

 I am trying to convert my MapScript program to a WMS responder. I create 
 my $map where I set all the layers and classes and colors, etc, just like 
 for a normal, non-WMS request that works perfectly correctly.

 my $map = undef;
 $map = mapObj(name = 'mymap') unless defined $map;

 my $req = new mapscript::OWSRequest();
 $req-setParameter( SERVICE, WMS );
 $req-setParameter( VERSION, 1.1.0 );
 $req-setParameter( REQUEST, GetCapabilities );

 I changed the above line to

  $req-setParameter( REQUEST, GetMap);

 but, still no improvement.



 mapscript::msIO_installStdoutToBuffer();
 my $dispatch_out = $map-OWSDispatch( $req );
 printf %s\n, mapscript::msIO_getStdoutBufferString();

 Except, the above doesn't really do anything for me. I get nothing in my 
 browser. Suggestions?


 --
 Puneet Kishor



 ___
 mapserver-users mailing list
 mapserver-users@lists.osgeo.org
 http://lists.osgeo.org/mailman/listinfo/mapserver-users

___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] Re: MapScript WMS request

2011-09-08 Thread Mr. Puneet Kishor

On Sep 8, 2011, at 1:03 PM, thomas bonfort wrote:

 it goes in map-web-metadata
 

I guessed as much, but I can't fathom the syntax. The webObj doesn't seem to 
have any constructor, and I don't see any documentation. Could you please point 
me to an example?



 
 On Thu, Sep 8, 2011 at 19:48, Mr. Puneet Kishor punk.k...@gmail.com wrote:
 a bit more investigation on producing a WMS response via Perl MapScript 
 reveals the following error
 
  ?xml version='1.0' encoding=ISO-8859-1 standalone=no ?
  !DOCTYPE ServiceExceptionReport SYSTEM 
 http://schemas.opengis.net/wms/1.1.0/exception_1_1_0.dtd;
  ServiceExceptionReport version=1.1.0
  ServiceException
  msWMSDispatch(): WMS server error. WMS request not enabled. Check 
 wms/ows_enable_request settings.
  /ServiceException
  /ServiceExceptionReport
 
 So, it seems I have to somehow, somewhere enable 'ows_enable_request'. 
 Looking at the documentation, seems like if I had a map file, I could add 
 the following line to do so
 
  ows_enable_request '*'
 
 However, I am not using a map file at all. Not finding any documentation on 
 this setting, I tried the following to no avail
 
  $map-{ows_enable_request} = '*';
 
 
 Suggestions, anyone?
 
 
 On Sep 7, 2011, at 10:18 PM, Mr. Puneet Kishor wrote:
 
 I would really appreciate insight from someone well-versed in the ins and 
 outs of WMS via MapScript. Looking at the discussion at 
 [http://trac.osgeo.org/mapserver/ticket/670], the `img = wms_map.draw()` 
 step seems to be a crucial part of drawing the image.
 
 So, I added `my $img = $map-draw();` to my code below, and indeed, the 
 image was drawn and sent back to the browser.
 
 Is this something that should be added to the examples in the 
 documentation? Is this the right way to do things? In any case, I am not 
 write to STDOUT, and sending the buffer directly. Instead, my code is very 
 much like a regular request (and it works) --
 
my $new_extent = $map-{extent};
 
my $req = new mapscript::OWSRequest();
$req-setParameter( SERVICE, WMS );
$req-setParameter( VERSION, 1.1.0 );
$req-setParameter( REQUEST, GetMap );
$req-setParameter( BBOX, -180,-90,180,90 );
$req-setParameter( LAYERS, layer_name);
$req-setParameter( SRS, -1);
$req-setParameter( WIDTH, 1200);
$req-setParameter( HEIGHT, 600);
 
my $dispatch_out = $map-OWSDispatch( $req );
my $img = $map-draw();
my $map_img = 'test_' . sprintf(%0.10d, rand(10)) . '.png';
$img-save(/path/to/$map_img);
return send_file(/path/to/$map_img);
 
 
 Comments? Corrections?
 
 
 On Sep 7, 2011, at 6:12 PM, Mr. Puneet Kishor wrote:
 
 
 On Sep 7, 2011, at 5:49 PM, Mr. Puneet Kishor wrote:
 
 I am trying to convert my MapScript program to a WMS responder. I create 
 my $map where I set all the layers and classes and colors, etc, just like 
 for a normal, non-WMS request that works perfectly correctly.
 
 my $map = undef;
 $map = mapObj(name = 'mymap') unless defined $map;
 
 my $req = new mapscript::OWSRequest();
 $req-setParameter( SERVICE, WMS );
 $req-setParameter( VERSION, 1.1.0 );
 $req-setParameter( REQUEST, GetCapabilities );
 
 I changed the above line to
 
  $req-setParameter( REQUEST, GetMap);
 
 but, still no improvement.
 
 
 
 mapscript::msIO_installStdoutToBuffer();
 my $dispatch_out = $map-OWSDispatch( $req );
 printf %s\n, mapscript::msIO_getStdoutBufferString();
 
 Except, the above doesn't really do anything for me. I get nothing in my 
 browser. Suggestions?
 
 
 --
 Puneet Kishor
 
 
 
 ___
 mapserver-users mailing list
 mapserver-users@lists.osgeo.org
 http://lists.osgeo.org/mailman/listinfo/mapserver-users
 

___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] Re: MapScript WMS request

2011-09-08 Thread thomas bonfort
someone else might, I don't use mapscript

On Thu, Sep 8, 2011 at 20:05, Mr. Puneet Kishor punk.k...@gmail.com wrote:

 On Sep 8, 2011, at 1:03 PM, thomas bonfort wrote:

 it goes in map-web-metadata


 I guessed as much, but I can't fathom the syntax. The webObj doesn't seem to 
 have any constructor, and I don't see any documentation. Could you please 
 point me to an example?




 On Thu, Sep 8, 2011 at 19:48, Mr. Puneet Kishor punk.k...@gmail.com wrote:
 a bit more investigation on producing a WMS response via Perl MapScript 
 reveals the following error

  ?xml version='1.0' encoding=ISO-8859-1 standalone=no ?
  !DOCTYPE ServiceExceptionReport SYSTEM 
 http://schemas.opengis.net/wms/1.1.0/exception_1_1_0.dtd;
  ServiceExceptionReport version=1.1.0
  ServiceException
  msWMSDispatch(): WMS server error. WMS request not enabled. Check 
 wms/ows_enable_request settings.
  /ServiceException
  /ServiceExceptionReport

 So, it seems I have to somehow, somewhere enable 'ows_enable_request'. 
 Looking at the documentation, seems like if I had a map file, I could add 
 the following line to do so

  ows_enable_request '*'

 However, I am not using a map file at all. Not finding any documentation on 
 this setting, I tried the following to no avail

  $map-{ows_enable_request} = '*';


 Suggestions, anyone?


 On Sep 7, 2011, at 10:18 PM, Mr. Puneet Kishor wrote:

 I would really appreciate insight from someone well-versed in the ins and 
 outs of WMS via MapScript. Looking at the discussion at 
 [http://trac.osgeo.org/mapserver/ticket/670], the `img = wms_map.draw()` 
 step seems to be a crucial part of drawing the image.

 So, I added `my $img = $map-draw();` to my code below, and indeed, the 
 image was drawn and sent back to the browser.

 Is this something that should be added to the examples in the 
 documentation? Is this the right way to do things? In any case, I am not 
 write to STDOUT, and sending the buffer directly. Instead, my code is very 
 much like a regular request (and it works) --

    my $new_extent = $map-{extent};

    my $req = new mapscript::OWSRequest();
    $req-setParameter( SERVICE, WMS );
    $req-setParameter( VERSION, 1.1.0 );
    $req-setParameter( REQUEST, GetMap );
    $req-setParameter( BBOX, -180,-90,180,90 );
    $req-setParameter( LAYERS, layer_name);
    $req-setParameter( SRS, -1);
    $req-setParameter( WIDTH, 1200);
    $req-setParameter( HEIGHT, 600);

    my $dispatch_out = $map-OWSDispatch( $req );
    my $img = $map-draw();
    my $map_img = 'test_' . sprintf(%0.10d, rand(10)) . '.png';
    $img-save(/path/to/$map_img);
    return send_file(/path/to/$map_img);


 Comments? Corrections?


 On Sep 7, 2011, at 6:12 PM, Mr. Puneet Kishor wrote:


 On Sep 7, 2011, at 5:49 PM, Mr. Puneet Kishor wrote:

 I am trying to convert my MapScript program to a WMS responder. I create 
 my $map where I set all the layers and classes and colors, etc, just 
 like for a normal, non-WMS request that works perfectly correctly.

 my $map = undef;
 $map = mapObj(name = 'mymap') unless defined $map;

 my $req = new mapscript::OWSRequest();
 $req-setParameter( SERVICE, WMS );
 $req-setParameter( VERSION, 1.1.0 );
 $req-setParameter( REQUEST, GetCapabilities );

 I changed the above line to

  $req-setParameter( REQUEST, GetMap);

 but, still no improvement.



 mapscript::msIO_installStdoutToBuffer();
 my $dispatch_out = $map-OWSDispatch( $req );
 printf %s\n, mapscript::msIO_getStdoutBufferString();

 Except, the above doesn't really do anything for me. I get nothing in my 
 browser. Suggestions?


 --
 Puneet Kishor



 ___
 mapserver-users mailing list
 mapserver-users@lists.osgeo.org
 http://lists.osgeo.org/mailman/listinfo/mapserver-users



___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] Re: MapScript WMS request

2011-09-08 Thread Armin Burger

in PHP MapScript should be something like
  $map-setMetaData(ows_enable_request, *);

in Python:
  map.setMetaData(ows_enable_request, *)

armin


On 08/09/2011 20:05, Mr. Puneet Kishor wrote:


On Sep 8, 2011, at 1:03 PM, thomas bonfort wrote:


it goes in map-web-metadata



I guessed as much, but I can't fathom the syntax. The webObj doesn't seem to 
have any constructor, and I don't see any documentation. Could you please point 
me to an example?





On Thu, Sep 8, 2011 at 19:48, Mr. Puneet Kishorpunk.k...@gmail.com  wrote:

a bit more investigation on producing a WMS response via Perl MapScript reveals 
the following error

  ?xml version='1.0' encoding=ISO-8859-1 standalone=no ?
  !DOCTYPE ServiceExceptionReport SYSTEM 
http://schemas.opengis.net/wms/1.1.0/exception_1_1_0.dtd;
  ServiceExceptionReport version=1.1.0
  ServiceException
  msWMSDispatch(): WMS server error. WMS request not enabled. Check 
wms/ows_enable_request settings.
  /ServiceException
  /ServiceExceptionReport

So, it seems I have to somehow, somewhere enable 'ows_enable_request'. Looking 
at the documentation, seems like if I had a map file, I could add the following 
line to do so

  ows_enable_request '*'

However, I am not using a map file at all. Not finding any documentation on 
this setting, I tried the following to no avail

  $map-{ows_enable_request} = '*';


Suggestions, anyone?


On Sep 7, 2011, at 10:18 PM, Mr. Puneet Kishor wrote:


I would really appreciate insight from someone well-versed in the ins and outs 
of WMS via MapScript. Looking at the discussion at 
[http://trac.osgeo.org/mapserver/ticket/670], the `img = wms_map.draw()` step 
seems to be a crucial part of drawing the image.

So, I added `my $img = $map-draw();` to my code below, and indeed, the image 
was drawn and sent back to the browser.

Is this something that should be added to the examples in the documentation? Is 
this the right way to do things? In any case, I am not write to STDOUT, and 
sending the buffer directly. Instead, my code is very much like a regular 
request (and it works) --

my $new_extent = $map-{extent};

my $req = new mapscript::OWSRequest();
$req-setParameter( SERVICE, WMS );
$req-setParameter( VERSION, 1.1.0 );
$req-setParameter( REQUEST, GetMap );
$req-setParameter( BBOX, -180,-90,180,90 );
$req-setParameter( LAYERS, layer_name);
$req-setParameter( SRS, -1);
$req-setParameter( WIDTH, 1200);
$req-setParameter( HEIGHT, 600);

my $dispatch_out = $map-OWSDispatch( $req );
my $img = $map-draw();
my $map_img = 'test_' . sprintf(%0.10d, rand(10)) . '.png';
$img-save(/path/to/$map_img);
return send_file(/path/to/$map_img);


Comments? Corrections?


On Sep 7, 2011, at 6:12 PM, Mr. Puneet Kishor wrote:



On Sep 7, 2011, at 5:49 PM, Mr. Puneet Kishor wrote:


I am trying to convert my MapScript program to a WMS responder. I create my 
$map where I set all the layers and classes and colors, etc, just like for a 
normal, non-WMS request that works perfectly correctly.

my $map = undef;
$map = mapObj(name =  'mymap') unless defined $map;

my $req = new mapscript::OWSRequest();
$req-setParameter( SERVICE, WMS );
$req-setParameter( VERSION, 1.1.0 );
$req-setParameter( REQUEST, GetCapabilities );


I changed the above line to

  $req-setParameter( REQUEST, GetMap);

but, still no improvement.




mapscript::msIO_installStdoutToBuffer();
my $dispatch_out = $map-OWSDispatch( $req );
printf %s\n, mapscript::msIO_getStdoutBufferString();

Except, the above doesn't really do anything for me. I get nothing in my 
browser. Suggestions?


--
Puneet Kishor






___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users



___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] Re: MapScript WMS request

2011-09-08 Thread Armin Burger

Puneet

if you're interested in general in some sample code using PHP or Python 
MapScript for OWS request handling, please find some classes here:


http://p-ows.pmapper.net/trac/browser/p-ows/trunk

armin

On 08/09/2011 20:05, Mr. Puneet Kishor wrote:


On Sep 8, 2011, at 1:03 PM, thomas bonfort wrote:


it goes in map-web-metadata



I guessed as much, but I can't fathom the syntax. The webObj doesn't seem to 
have any constructor, and I don't see any documentation. Could you please point 
me to an example?





On Thu, Sep 8, 2011 at 19:48, Mr. Puneet Kishorpunk.k...@gmail.com  wrote:

a bit more investigation on producing a WMS response via Perl MapScript reveals 
the following error

  ?xml version='1.0' encoding=ISO-8859-1 standalone=no ?
  !DOCTYPE ServiceExceptionReport SYSTEM 
http://schemas.opengis.net/wms/1.1.0/exception_1_1_0.dtd;
  ServiceExceptionReport version=1.1.0
  ServiceException
  msWMSDispatch(): WMS server error. WMS request not enabled. Check 
wms/ows_enable_request settings.
  /ServiceException
  /ServiceExceptionReport

So, it seems I have to somehow, somewhere enable 'ows_enable_request'. Looking 
at the documentation, seems like if I had a map file, I could add the following 
line to do so

  ows_enable_request '*'

However, I am not using a map file at all. Not finding any documentation on 
this setting, I tried the following to no avail

  $map-{ows_enable_request} = '*';


Suggestions, anyone?


On Sep 7, 2011, at 10:18 PM, Mr. Puneet Kishor wrote:


I would really appreciate insight from someone well-versed in the ins and outs 
of WMS via MapScript. Looking at the discussion at 
[http://trac.osgeo.org/mapserver/ticket/670], the `img = wms_map.draw()` step 
seems to be a crucial part of drawing the image.

So, I added `my $img = $map-draw();` to my code below, and indeed, the image 
was drawn and sent back to the browser.

Is this something that should be added to the examples in the documentation? Is 
this the right way to do things? In any case, I am not write to STDOUT, and 
sending the buffer directly. Instead, my code is very much like a regular 
request (and it works) --

my $new_extent = $map-{extent};

my $req = new mapscript::OWSRequest();
$req-setParameter( SERVICE, WMS );
$req-setParameter( VERSION, 1.1.0 );
$req-setParameter( REQUEST, GetMap );
$req-setParameter( BBOX, -180,-90,180,90 );
$req-setParameter( LAYERS, layer_name);
$req-setParameter( SRS, -1);
$req-setParameter( WIDTH, 1200);
$req-setParameter( HEIGHT, 600);

my $dispatch_out = $map-OWSDispatch( $req );
my $img = $map-draw();
my $map_img = 'test_' . sprintf(%0.10d, rand(10)) . '.png';
$img-save(/path/to/$map_img);
return send_file(/path/to/$map_img);


Comments? Corrections?


On Sep 7, 2011, at 6:12 PM, Mr. Puneet Kishor wrote:



On Sep 7, 2011, at 5:49 PM, Mr. Puneet Kishor wrote:


I am trying to convert my MapScript program to a WMS responder. I create my 
$map where I set all the layers and classes and colors, etc, just like for a 
normal, non-WMS request that works perfectly correctly.

my $map = undef;
$map = mapObj(name =  'mymap') unless defined $map;

my $req = new mapscript::OWSRequest();
$req-setParameter( SERVICE, WMS );
$req-setParameter( VERSION, 1.1.0 );
$req-setParameter( REQUEST, GetCapabilities );


I changed the above line to

  $req-setParameter( REQUEST, GetMap);

but, still no improvement.




mapscript::msIO_installStdoutToBuffer();
my $dispatch_out = $map-OWSDispatch( $req );
printf %s\n, mapscript::msIO_getStdoutBufferString();

Except, the above doesn't really do anything for me. I get nothing in my 
browser. Suggestions?


--
Puneet Kishor






___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users



___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] Re: MapScript WMS request

2011-09-07 Thread Frank Warmerdam

On 11-09-07 08:18 PM, Mr. Puneet Kishor wrote:

I would really appreciate insight from someone well-versed in the ins and outs 
of WMS via MapScript. Looking at the discussion at 
[http://trac.osgeo.org/mapserver/ticket/670], the `img = wms_map.draw()` step 
seems to be a crucial part of drawing the image.

So, I added `my $img = $map-draw();` to my code below, and indeed, the image 
was drawn and sent back to the browser.

Is this something that should be added to the examples in the documentation? Is 
this the right way to do things? In any case, I am not write to STDOUT, and 
sending the buffer directly. Instead, my code is very much like a regular 
request (and it works) --

 my $new_extent = $map-{extent};

 my $req = new mapscript::OWSRequest();
 $req-setParameter( SERVICE, WMS );
 $req-setParameter( VERSION, 1.1.0 );
 $req-setParameter( REQUEST, GetMap );
 $req-setParameter( BBOX, -180,-90,180,90 );
 $req-setParameter( LAYERS, layer_name);
 $req-setParameter( SRS, -1);
 $req-setParameter( WIDTH, 1200);
 $req-setParameter( HEIGHT, 600);

 my $dispatch_out = $map-OWSDispatch( $req );
 my $img = $map-draw();
 my $map_img = 'test_' . sprintf(%0.10d, rand(10)) . '.png';
 $img-save(/path/to/$map_img);
 return send_file(/path/to/$map_img);


Comments? Corrections?


Puneet,

I rarely use PHP and it is possible something is broken now with PHP
OWS dispatching.  But it should work like:

  http://mapserver.org/ogc/mapscript.html#php-example

Alternatively if you don't install the stdout redirection the OWSDispatch
call should produce the image to stdout.

Note that if you want things handled properly as a WMS request you should
not be calling draw().  The ticket you reference long predates the WxS
MapScript services effort.

I suspect you are not really setting all the environment variables needed
to make the WMS handler kick in during OWSDispatch though I'd have to
play around with it to be sure.

Best regards,
--
---+--
I set the clouds in motion - turn up   | Frank Warmerdam, warmer...@pobox.com
light and sound - activate the windows | http://pobox.com/warmerda
and watch the world go round - Rush| Geospatial Software Developer

___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users