RE: [mapserver-users] MapScript WMS request

2011-09-10 Thread Nicol Hermann
Hello,

I did some tests with the WXS warpper in PHP Mapscript as well.
I used MapServer version 6.0.0
Base is a working map file (datasource is a postgresql database) which
produces maps and capability documents using plain WMS requests like

http://localhost/cgi-bin/mapserv_600?map=postgis.mapREQUEST=GetMAPSERVICE=WMSversion=1.1.1SRS=EPSG:4326WIDTH=600HEIGHT=600LAYERS=geobilderSTYLES=FORMAT=image/pngTRANSPARENT=trueBBOX=5.86628568,47.27360151,15.0486318,55.05826185

If I am trying to send a GetMap request with the WXS Mapscript wrapper I
run into trouble as well.
I am able to request the Capability document but never managed to get a
Map request working

Therefore one question.
If I print out the members of the OWSRequestObj
(http://mapserver.org/mapscript/php/index.html#owsrequestobj)
what would be the expected values?

My sample script shows:
printf('numparams: %d - type: %s', $owsRequest- numparams,
$owsRequest-type );
numparams: 10 - type: 4294967295
^

The number of parameters are correct, but according to the documentation
(int type (read-only): MS_GET_REQUEST or MS_POST_REQUEST) I would expect
something like 0 or 1 for the 'type' member
var_dump( MS_GET_REQUEST );
int(0)

var_dump( MS_POST_REQUEST);
int(1)

Could it be that something is going wrong here?

Thanks.
Best regards
Nicol


Am Freitag, den 09.09.2011, 11:44 -0500 schrieb Fawcett, David (MPCA):
 DNS issue, should be fixed by Monday...   ; ('
 
 -Original Message-
 From: Mr. Puneet Kishor [mailto:punk.k...@gmail.com] 
 Sent: Friday, September 09, 2011 10:00 AM
 To: Fawcett, David (MPCA)
 Cc: mapserver-users@lists.osgeo.org
 Subject: Re: [mapserver-users] MapScript WMS request
 
 David,
 
 
 On Sep 9, 2011, at 9:47 AM, Fawcett, David (MPCA) wrote:
 
  Puneet, 
  
  Using MapServer CGI and layer.MapServer would not set you up well for other 
  client libraries, so I see your point.  It can be viable though.
  
  In this app (just an imagemap, not OL), there are no attribute values 
  associated with the spatial data.  The classes are generated on-the-fly and 
  the county id's for each class are passed in as URL vars.  Same thing for 
  the legend.  This allows flexibility for compounds who's emissions may vary 
  from tens of pounds to millions of pounds.
  
  This approach may not work for your case, but it is another way to slice 
  it...
 
 
 Possibly. See, it is crucially important for me to be able to generate 
 classes on the fly, and with a lot of flexibility. Not just that, the 
 criteria for generating the classes can change. So, what I am doing actually 
 is setting up a separate application that does nothing but respond with class 
 information. The mapping application (and, any other application, for that 
 matter), would query this class generating application and make the classes 
 as per the latest information. Hence, my need for MapScripting. Well, there 
 are other reasons as well, but this is an important one.
 
 
  
  http://www.pca.state.mn.us/index.php/topics/environmental-data/eda-environmental-data-access/eda-air-quality-searches/eda-air-quality-search-emissions-by-county-data.html
 
 
 
 By the way, the app above is not working. I get broken images, and the 
 following errors in the web inspector (that might help you troubleshoot)
 
 
 GET http://www.pca.state.mn.us/oea/css/master.css 404 (Not Found)
 
 emissions.cfm:28 ReferenceError: Can't find variable: urchinTracker
 
 GET http://maps.pca.state.mn.us/cgi-bin/mapserv? ..snipped.. A server with 
 the specified hostname could not be found.
 
 GET http://maps.pca.state.mn.us/cgi-bin/mapserv? ..snipped.. A server with 
 the specified hostname could not be found.
 
 GET 
 http://cf.pca.state.mn.us/data/edaAir/artwork/edaP2results_edaAmbientResultsPollutantsJuly_04.gif
  404 (Not Found)
 
 master-print.cssGET http://www.pca.state.mn.us/oea/css/master-print.css 404 
 (Not Found)
 
 
 
 
  
  David.
  
  -Original Message-
  From: mapserver-users-boun...@lists.osgeo.org 
  [mailto:mapserver-users-boun...@lists.osgeo.org] On Behalf Of Mr. Puneet 
  Kishor
  Sent: Friday, September 09, 2011 9:35 AM
  To: mapserver-users@lists.osgeo.org
  Subject: Re: [mapserver-users] MapScript WMS request
  
  
  On Sep 9, 2011, at 8:39 AM, Fawcett, David (MPCA) wrote:
  
  Puneet, 
  
  As far as I know, OpenLayers still has support for a layer based on 
  MapServer CGI.  Because MapServer can also serve up WMS well, this layer 
  type isn't necessarily recommended or as well supported.  
  
  http://dev.openlayers.org/docs/files/OpenLayers/Layer/MapServer-js.html
  
  
  
  Indeed David. Because, going by the docs, the MapServer CGI calls are 
  discouraged (or so it seems), I'd rather not invest in that path. This is a 
  long term project that I am working on, so the foundations have to be very 
  robust. Besides, I may or may not use OL. While I like OL a lot, I am also 
  looking at other frameworks (Gmaps, Leaflet, Polymaps

RE: [mapserver-users] MapScript WMS request

2011-09-09 Thread Fawcett, David (MPCA)
Puneet, 

As far as I know, OpenLayers still has support for a layer based on MapServer 
CGI.  Because MapServer can also serve up WMS well, this layer type isn't 
necessarily recommended or as well supported.  

http://dev.openlayers.org/docs/files/OpenLayers/Layer/MapServer-js.html

David.

-Original Message-
From: mapserver-users-boun...@lists.osgeo.org 
[mailto:mapserver-users-boun...@lists.osgeo.org] On Behalf Of Mr. Puneet Kishor
Sent: Thursday, September 08, 2011 9:32 PM
To: Daniel Morissette
Cc: mapserver-users@lists.osgeo.org
Subject: Re: [mapserver-users] MapScript WMS request


On Sep 8, 2011, at 8:28 PM, Daniel Morissette wrote:

 On 11-09-08 09:02 PM, Mr. Puneet Kishor wrote:
 
 On Sep 8, 2011, at 7:43 PM, Daniel Morissette wrote:
 
 Maybe call $map-save(/tmp/my.map) in your script after the map and layer 
 have been populated and paste the result... that may give us a hint...
 
 
 wow! this is a super-awesome debugging technique. I have sent you the map 
 file off list to not pollute the entire list serve.
 
 
 I was able to reproduce the issue with the copy of the mapfile you sent 
 off-list.
 
 It turns out that mappostgis.c's msPostGISLayerGetExtent() is hardcoded to 
 always return
 
 {minx = -2500, miny = -2500, maxx = 2500, maxy = 2500}
 
 ...and then it returns MS_SUCCESS.
 
 I think this function should either be left unimplemented (this way MapServer 
 would fallback on other mechanisms), or return MS_FAILURE to indicate to the 
 calling code that it didn't do anything useful.
 
 A quick search indicates an open ticket about the issue:
 
 http://trac.osgeo.org/mapserver/ticket/3585
 
 You could bump the ticket and hope someone works on it at the FOSS4G code 
 sprint next week.
 
 The short term fix for you would be to set the ows_extent metadata in your 
 layer:
 
METADATA
  ows_extent -180 -90 180 90
   ...
END
 


Thanks Daniel. I will bump the ticket. For now, see below --

Using the my.map file I sent you, with no further modifications to it, I am 
able to successfully get an image back via 
[http://localhost.local/cgi-bin/gmna?SERVICE=WMSVERSION=1.1.1REQUEST=GetMapBBOX=-180,-90,180,90SRS=EPSG:4326WIDTH=1200HEIGHT=600LAYERS=gmnaSTYLES=FORMAT=image/pngTRANSPARENT=true]

Note, no further modifications is required, that is, not even the ows_extent 
-180 -90 180 90 bit in the layer METADATA. and I still get a good image.


However, if I use the following program to access the same map file, I get the 
spurious minx = -2500, miny = -2500, maxx = 2500, maxy = 2500 
in the GetCapabilities.

Finally, if I add the ows_extent -180 -90 180 90 line in the layer METADATA 
in the my.map file, the GetCapabilities returns the correct bounds now, 
however, the image is still blank.

#!/opt/local/bin/perl

use strict;
use mapscript;

my $wms = new mapscript::OWSRequest();
$wms-setParameter(SERVICE, WMS );
$wms-setParameter(VERSION, 1.1.1 );
$wms-setParameter(REQUEST, GetMap );
$wms-setParameter(BBOX, -180,-90,180,90 );
$wms-setParameter(LAYERS, gmna);
$wms-setParameter(SRS, EPSG:4326);
$wms-setParameter(WIDTH, 1200);
$wms-setParameter(HEIGHT, 600);
$wms-setParameter(FORMAT, image/png);
$wms-setParameter(TRANSPARENT, true);

my $map = new 
mapscript::mapObj(/Users/punkish/Sites/test/mapscript/my.map);

if(!$map) {
warn New mapObj() error: $mapscript::ms_error-{message}\n;
}

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

I have now spent an enormous amount of time on this, and for now, I have to 
move on. This is just not working out. Maybe I will try some other technique, 
perhaps this mode=tile to see if I can get MapServer powered maps in my apps.

Thanks much for your help. If you (or anyone else) can come up with a bright 
idea, I will be happy to try it.

Puneet.

___
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] MapScript WMS request

2011-09-09 Thread Mr. Puneet Kishor

On Sep 9, 2011, at 8:39 AM, Fawcett, David (MPCA) wrote:

 Puneet, 
 
 As far as I know, OpenLayers still has support for a layer based on MapServer 
 CGI.  Because MapServer can also serve up WMS well, this layer type isn't 
 necessarily recommended or as well supported.  
 
 http://dev.openlayers.org/docs/files/OpenLayers/Layer/MapServer-js.html



Indeed David. Because, going by the docs, the MapServer CGI calls are 
discouraged (or so it seems), I'd rather not invest in that path. This is a 
long term project that I am working on, so the foundations have to be very 
robust. Besides, I may or may not use OL. While I like OL a lot, I am also 
looking at other frameworks (Gmaps, Leaflet, Polymaps), and it would be wise to 
decouple the backend from the front-end as much as possible.

I have no issues with using WMS, but I just am unable to get MapServer WMS to 
work via MapScript. And, yes, I do have to use MapScript if I can help it -- my 
layer classification is generated on demand, and MapScript is the easiest way I 
can think of for doing that.

I did find yesterday that `mode=tile` works really well, but I am trying to 
make that work with MapScript. A separate email thread for that question.




 
 David.
 
 -Original Message-
 From: mapserver-users-boun...@lists.osgeo.org 
 [mailto:mapserver-users-boun...@lists.osgeo.org] On Behalf Of Mr. Puneet 
 Kishor
 Sent: Thursday, September 08, 2011 9:32 PM
 To: Daniel Morissette
 Cc: mapserver-users@lists.osgeo.org
 Subject: Re: [mapserver-users] MapScript WMS request
 
 
 On Sep 8, 2011, at 8:28 PM, Daniel Morissette wrote:
 
 On 11-09-08 09:02 PM, Mr. Puneet Kishor wrote:
 
 On Sep 8, 2011, at 7:43 PM, Daniel Morissette wrote:
 
 Maybe call $map-save(/tmp/my.map) in your script after the map and 
 layer have been populated and paste the result... that may give us a 
 hint...
 
 
 wow! this is a super-awesome debugging technique. I have sent you the map 
 file off list to not pollute the entire list serve.
 
 
 I was able to reproduce the issue with the copy of the mapfile you sent 
 off-list.
 
 It turns out that mappostgis.c's msPostGISLayerGetExtent() is hardcoded to 
 always return
 
 {minx = -2500, miny = -2500, maxx = 2500, maxy = 2500}
 
 ...and then it returns MS_SUCCESS.
 
 I think this function should either be left unimplemented (this way 
 MapServer would fallback on other mechanisms), or return MS_FAILURE to 
 indicate to the calling code that it didn't do anything useful.
 
 A quick search indicates an open ticket about the issue:
 
 http://trac.osgeo.org/mapserver/ticket/3585
 
 You could bump the ticket and hope someone works on it at the FOSS4G code 
 sprint next week.
 
 The short term fix for you would be to set the ows_extent metadata in your 
 layer:
 
   METADATA
 ows_extent -180 -90 180 90
  ...
   END
 
 
 
 Thanks Daniel. I will bump the ticket. For now, see below --
 
 Using the my.map file I sent you, with no further modifications to it, I am 
 able to successfully get an image back via 
 [http://localhost.local/cgi-bin/gmna?SERVICE=WMSVERSION=1.1.1REQUEST=GetMapBBOX=-180,-90,180,90SRS=EPSG:4326WIDTH=1200HEIGHT=600LAYERS=gmnaSTYLES=FORMAT=image/pngTRANSPARENT=true]
 
 Note, no further modifications is required, that is, not even the 
 ows_extent -180 -90 180 90 bit in the layer METADATA. and I still get a 
 good image.
 
 
 However, if I use the following program to access the same map file, I get 
 the spurious minx = -2500, miny = -2500, maxx = 2500, maxy = 
 2500 in the GetCapabilities.
 
 Finally, if I add the ows_extent -180 -90 180 90 line in the layer 
 METADATA in the my.map file, the GetCapabilities returns the correct bounds 
 now, however, the image is still blank.
 
   #!/opt/local/bin/perl
   
   use strict;
   use mapscript;
   
   my $wms = new mapscript::OWSRequest();
   $wms-setParameter(SERVICE, WMS );
   $wms-setParameter(VERSION, 1.1.1 );
   $wms-setParameter(REQUEST, GetMap );
   $wms-setParameter(BBOX, -180,-90,180,90 );
   $wms-setParameter(LAYERS, gmna);
   $wms-setParameter(SRS, EPSG:4326);
   $wms-setParameter(WIDTH, 1200);
   $wms-setParameter(HEIGHT, 600);
   $wms-setParameter(FORMAT, image/png);
   $wms-setParameter(TRANSPARENT, true);
   
   my $map = new 
 mapscript::mapObj(/Users/punkish/Sites/test/mapscript/my.map);
   
   if(!$map) {
   warn New mapObj() error: $mapscript::ms_error-{message}\n;
   }
   
   my $io = mapscript::msIO_installStdoutToBuffer();
   my $dispatch_out = $map-OWSDispatch( $wms );
   printf %s\n, mapscript::msIO_getStdoutBufferString();
 
 I have now spent an enormous amount of time on this, and for now, I have to 
 move on. This is just not working out. Maybe I will try some other technique, 
 perhaps this mode=tile to see if I can get MapServer powered maps in my apps.
 
 Thanks much for your help. If you (or anyone

RE: [mapserver-users] MapScript WMS request

2011-09-09 Thread Fawcett, David (MPCA)
Puneet, 

Using MapServer CGI and layer.MapServer would not set you up well for other 
client libraries, so I see your point.  It can be viable though.

In this app (just an imagemap, not OL), there are no attribute values 
associated with the spatial data.  The classes are generated on-the-fly and the 
county id's for each class are passed in as URL vars.  Same thing for the 
legend.  This allows flexibility for compounds who's emissions may vary from 
tens of pounds to millions of pounds.

This approach may not work for your case, but it is another way to slice it...

http://www.pca.state.mn.us/index.php/topics/environmental-data/eda-environmental-data-access/eda-air-quality-searches/eda-air-quality-search-emissions-by-county-data.html

David.

-Original Message-
From: mapserver-users-boun...@lists.osgeo.org 
[mailto:mapserver-users-boun...@lists.osgeo.org] On Behalf Of Mr. Puneet Kishor
Sent: Friday, September 09, 2011 9:35 AM
To: mapserver-users@lists.osgeo.org
Subject: Re: [mapserver-users] MapScript WMS request


On Sep 9, 2011, at 8:39 AM, Fawcett, David (MPCA) wrote:

 Puneet, 
 
 As far as I know, OpenLayers still has support for a layer based on MapServer 
 CGI.  Because MapServer can also serve up WMS well, this layer type isn't 
 necessarily recommended or as well supported.  
 
 http://dev.openlayers.org/docs/files/OpenLayers/Layer/MapServer-js.html



Indeed David. Because, going by the docs, the MapServer CGI calls are 
discouraged (or so it seems), I'd rather not invest in that path. This is a 
long term project that I am working on, so the foundations have to be very 
robust. Besides, I may or may not use OL. While I like OL a lot, I am also 
looking at other frameworks (Gmaps, Leaflet, Polymaps), and it would be wise to 
decouple the backend from the front-end as much as possible.

I have no issues with using WMS, but I just am unable to get MapServer WMS to 
work via MapScript. And, yes, I do have to use MapScript if I can help it -- my 
layer classification is generated on demand, and MapScript is the easiest way I 
can think of for doing that.

I did find yesterday that `mode=tile` works really well, but I am trying to 
make that work with MapScript. A separate email thread for that question.




 
 David.
 
 -Original Message-
 From: mapserver-users-boun...@lists.osgeo.org 
 [mailto:mapserver-users-boun...@lists.osgeo.org] On Behalf Of Mr. Puneet 
 Kishor
 Sent: Thursday, September 08, 2011 9:32 PM
 To: Daniel Morissette
 Cc: mapserver-users@lists.osgeo.org
 Subject: Re: [mapserver-users] MapScript WMS request
 
 
 On Sep 8, 2011, at 8:28 PM, Daniel Morissette wrote:
 
 On 11-09-08 09:02 PM, Mr. Puneet Kishor wrote:
 
 On Sep 8, 2011, at 7:43 PM, Daniel Morissette wrote:
 
 Maybe call $map-save(/tmp/my.map) in your script after the map and 
 layer have been populated and paste the result... that may give us a 
 hint...
 
 
 wow! this is a super-awesome debugging technique. I have sent you the map 
 file off list to not pollute the entire list serve.
 
 
 I was able to reproduce the issue with the copy of the mapfile you sent 
 off-list.
 
 It turns out that mappostgis.c's msPostGISLayerGetExtent() is hardcoded to 
 always return
 
 {minx = -2500, miny = -2500, maxx = 2500, maxy = 2500}
 
 ...and then it returns MS_SUCCESS.
 
 I think this function should either be left unimplemented (this way 
 MapServer would fallback on other mechanisms), or return MS_FAILURE to 
 indicate to the calling code that it didn't do anything useful.
 
 A quick search indicates an open ticket about the issue:
 
 http://trac.osgeo.org/mapserver/ticket/3585
 
 You could bump the ticket and hope someone works on it at the FOSS4G code 
 sprint next week.
 
 The short term fix for you would be to set the ows_extent metadata in your 
 layer:
 
   METADATA
 ows_extent -180 -90 180 90
  ...
   END
 
 
 
 Thanks Daniel. I will bump the ticket. For now, see below --
 
 Using the my.map file I sent you, with no further modifications to it, I am 
 able to successfully get an image back via 
 [http://localhost.local/cgi-bin/gmna?SERVICE=WMSVERSION=1.1.1REQUEST=GetMapBBOX=-180,-90,180,90SRS=EPSG:4326WIDTH=1200HEIGHT=600LAYERS=gmnaSTYLES=FORMAT=image/pngTRANSPARENT=true]
 
 Note, no further modifications is required, that is, not even the 
 ows_extent -180 -90 180 90 bit in the layer METADATA. and I still get a 
 good image.
 
 
 However, if I use the following program to access the same map file, I get 
 the spurious minx = -2500, miny = -2500, maxx = 2500, maxy = 
 2500 in the GetCapabilities.
 
 Finally, if I add the ows_extent -180 -90 180 90 line in the layer 
 METADATA in the my.map file, the GetCapabilities returns the correct bounds 
 now, however, the image is still blank.
 
   #!/opt/local/bin/perl
   
   use strict;
   use mapscript;
   
   my $wms = new mapscript::OWSRequest();
   $wms-setParameter(SERVICE, WMS );
   $wms

Re: [mapserver-users] MapScript WMS request

2011-09-09 Thread Mr. Puneet Kishor
David,


On Sep 9, 2011, at 9:47 AM, Fawcett, David (MPCA) wrote:

 Puneet, 
 
 Using MapServer CGI and layer.MapServer would not set you up well for other 
 client libraries, so I see your point.  It can be viable though.
 
 In this app (just an imagemap, not OL), there are no attribute values 
 associated with the spatial data.  The classes are generated on-the-fly and 
 the county id's for each class are passed in as URL vars.  Same thing for the 
 legend.  This allows flexibility for compounds who's emissions may vary from 
 tens of pounds to millions of pounds.
 
 This approach may not work for your case, but it is another way to slice it...


Possibly. See, it is crucially important for me to be able to generate classes 
on the fly, and with a lot of flexibility. Not just that, the criteria for 
generating the classes can change. So, what I am doing actually is setting up a 
separate application that does nothing but respond with class information. The 
mapping application (and, any other application, for that matter), would query 
this class generating application and make the classes as per the latest 
information. Hence, my need for MapScripting. Well, there are other reasons as 
well, but this is an important one.


 
 http://www.pca.state.mn.us/index.php/topics/environmental-data/eda-environmental-data-access/eda-air-quality-searches/eda-air-quality-search-emissions-by-county-data.html



By the way, the app above is not working. I get broken images, and the 
following errors in the web inspector (that might help you troubleshoot)


GET http://www.pca.state.mn.us/oea/css/master.css 404 (Not Found)

emissions.cfm:28 ReferenceError: Can't find variable: urchinTracker

GET http://maps.pca.state.mn.us/cgi-bin/mapserv? ..snipped.. A server with the 
specified hostname could not be found.

GET http://maps.pca.state.mn.us/cgi-bin/mapserv? ..snipped.. A server with the 
specified hostname could not be found.

GET 
http://cf.pca.state.mn.us/data/edaAir/artwork/edaP2results_edaAmbientResultsPollutantsJuly_04.gif
 404 (Not Found)

master-print.cssGET http://www.pca.state.mn.us/oea/css/master-print.css 404 
(Not Found)




 
 David.
 
 -Original Message-
 From: mapserver-users-boun...@lists.osgeo.org 
 [mailto:mapserver-users-boun...@lists.osgeo.org] On Behalf Of Mr. Puneet 
 Kishor
 Sent: Friday, September 09, 2011 9:35 AM
 To: mapserver-users@lists.osgeo.org
 Subject: Re: [mapserver-users] MapScript WMS request
 
 
 On Sep 9, 2011, at 8:39 AM, Fawcett, David (MPCA) wrote:
 
 Puneet, 
 
 As far as I know, OpenLayers still has support for a layer based on 
 MapServer CGI.  Because MapServer can also serve up WMS well, this layer 
 type isn't necessarily recommended or as well supported.  
 
 http://dev.openlayers.org/docs/files/OpenLayers/Layer/MapServer-js.html
 
 
 
 Indeed David. Because, going by the docs, the MapServer CGI calls are 
 discouraged (or so it seems), I'd rather not invest in that path. This is a 
 long term project that I am working on, so the foundations have to be very 
 robust. Besides, I may or may not use OL. While I like OL a lot, I am also 
 looking at other frameworks (Gmaps, Leaflet, Polymaps), and it would be wise 
 to decouple the backend from the front-end as much as possible.
 
 I have no issues with using WMS, but I just am unable to get MapServer WMS to 
 work via MapScript. And, yes, I do have to use MapScript if I can help it -- 
 my layer classification is generated on demand, and MapScript is the easiest 
 way I can think of for doing that.
 
 I did find yesterday that `mode=tile` works really well, but I am trying to 
 make that work with MapScript. A separate email thread for that question.
 
 
 
 
 
 David.
 
 -Original Message-
 From: mapserver-users-boun...@lists.osgeo.org 
 [mailto:mapserver-users-boun...@lists.osgeo.org] On Behalf Of Mr. Puneet 
 Kishor
 Sent: Thursday, September 08, 2011 9:32 PM
 To: Daniel Morissette
 Cc: mapserver-users@lists.osgeo.org
 Subject: Re: [mapserver-users] MapScript WMS request
 
 
 On Sep 8, 2011, at 8:28 PM, Daniel Morissette wrote:
 
 On 11-09-08 09:02 PM, Mr. Puneet Kishor wrote:
 
 On Sep 8, 2011, at 7:43 PM, Daniel Morissette wrote:
 
 Maybe call $map-save(/tmp/my.map) in your script after the map and 
 layer have been populated and paste the result... that may give us a 
 hint...
 
 
 wow! this is a super-awesome debugging technique. I have sent you the map 
 file off list to not pollute the entire list serve.
 
 
 I was able to reproduce the issue with the copy of the mapfile you sent 
 off-list.
 
 It turns out that mappostgis.c's msPostGISLayerGetExtent() is hardcoded to 
 always return
 
 {minx = -2500, miny = -2500, maxx = 2500, maxy = 2500}
 
 ...and then it returns MS_SUCCESS.
 
 I think this function should either be left unimplemented (this way 
 MapServer would fallback on other mechanisms), or return MS_FAILURE to 
 indicate to the calling code that it didn't do anything

RE: [mapserver-users] MapScript WMS request

2011-09-09 Thread Fawcett, David (MPCA)
DNS issue, should be fixed by Monday...   ; ('

-Original Message-
From: Mr. Puneet Kishor [mailto:punk.k...@gmail.com] 
Sent: Friday, September 09, 2011 10:00 AM
To: Fawcett, David (MPCA)
Cc: mapserver-users@lists.osgeo.org
Subject: Re: [mapserver-users] MapScript WMS request

David,


On Sep 9, 2011, at 9:47 AM, Fawcett, David (MPCA) wrote:

 Puneet, 
 
 Using MapServer CGI and layer.MapServer would not set you up well for other 
 client libraries, so I see your point.  It can be viable though.
 
 In this app (just an imagemap, not OL), there are no attribute values 
 associated with the spatial data.  The classes are generated on-the-fly and 
 the county id's for each class are passed in as URL vars.  Same thing for the 
 legend.  This allows flexibility for compounds who's emissions may vary from 
 tens of pounds to millions of pounds.
 
 This approach may not work for your case, but it is another way to slice it...


Possibly. See, it is crucially important for me to be able to generate classes 
on the fly, and with a lot of flexibility. Not just that, the criteria for 
generating the classes can change. So, what I am doing actually is setting up a 
separate application that does nothing but respond with class information. The 
mapping application (and, any other application, for that matter), would query 
this class generating application and make the classes as per the latest 
information. Hence, my need for MapScripting. Well, there are other reasons as 
well, but this is an important one.


 
 http://www.pca.state.mn.us/index.php/topics/environmental-data/eda-environmental-data-access/eda-air-quality-searches/eda-air-quality-search-emissions-by-county-data.html



By the way, the app above is not working. I get broken images, and the 
following errors in the web inspector (that might help you troubleshoot)


GET http://www.pca.state.mn.us/oea/css/master.css 404 (Not Found)

emissions.cfm:28 ReferenceError: Can't find variable: urchinTracker

GET http://maps.pca.state.mn.us/cgi-bin/mapserv? ..snipped.. A server with the 
specified hostname could not be found.

GET http://maps.pca.state.mn.us/cgi-bin/mapserv? ..snipped.. A server with the 
specified hostname could not be found.

GET 
http://cf.pca.state.mn.us/data/edaAir/artwork/edaP2results_edaAmbientResultsPollutantsJuly_04.gif
 404 (Not Found)

master-print.cssGET http://www.pca.state.mn.us/oea/css/master-print.css 404 
(Not Found)




 
 David.
 
 -Original Message-
 From: mapserver-users-boun...@lists.osgeo.org 
 [mailto:mapserver-users-boun...@lists.osgeo.org] On Behalf Of Mr. Puneet 
 Kishor
 Sent: Friday, September 09, 2011 9:35 AM
 To: mapserver-users@lists.osgeo.org
 Subject: Re: [mapserver-users] MapScript WMS request
 
 
 On Sep 9, 2011, at 8:39 AM, Fawcett, David (MPCA) wrote:
 
 Puneet, 
 
 As far as I know, OpenLayers still has support for a layer based on 
 MapServer CGI.  Because MapServer can also serve up WMS well, this layer 
 type isn't necessarily recommended or as well supported.  
 
 http://dev.openlayers.org/docs/files/OpenLayers/Layer/MapServer-js.html
 
 
 
 Indeed David. Because, going by the docs, the MapServer CGI calls are 
 discouraged (or so it seems), I'd rather not invest in that path. This is a 
 long term project that I am working on, so the foundations have to be very 
 robust. Besides, I may or may not use OL. While I like OL a lot, I am also 
 looking at other frameworks (Gmaps, Leaflet, Polymaps), and it would be wise 
 to decouple the backend from the front-end as much as possible.
 
 I have no issues with using WMS, but I just am unable to get MapServer WMS to 
 work via MapScript. And, yes, I do have to use MapScript if I can help it -- 
 my layer classification is generated on demand, and MapScript is the easiest 
 way I can think of for doing that.
 
 I did find yesterday that `mode=tile` works really well, but I am trying to 
 make that work with MapScript. A separate email thread for that question.
 
 
 
 
 
 David.
 
 -Original Message-
 From: mapserver-users-boun...@lists.osgeo.org 
 [mailto:mapserver-users-boun...@lists.osgeo.org] On Behalf Of Mr. Puneet 
 Kishor
 Sent: Thursday, September 08, 2011 9:32 PM
 To: Daniel Morissette
 Cc: mapserver-users@lists.osgeo.org
 Subject: Re: [mapserver-users] MapScript WMS request
 
 
 On Sep 8, 2011, at 8:28 PM, Daniel Morissette wrote:
 
 On 11-09-08 09:02 PM, Mr. Puneet Kishor wrote:
 
 On Sep 8, 2011, at 7:43 PM, Daniel Morissette wrote:
 
 Maybe call $map-save(/tmp/my.map) in your script after the map and 
 layer have been populated and paste the result... that may give us a 
 hint...
 
 
 wow! this is a super-awesome debugging technique. I have sent you the map 
 file off list to not pollute the entire list serve.
 
 
 I was able to reproduce the issue with the copy of the mapfile you sent 
 off-list.
 
 It turns out that mappostgis.c's msPostGISLayerGetExtent() is hardcoded to 
 always return
 
 {minx = -2500, miny

Re: [mapserver-users] MapScript WMS request

2011-09-08 Thread Mr. Puneet Kishor
top posting, as most of the relevant info is self-contained in this email --

Ok, with the help of the suggestions from many of you, and by adding the 
following lines to my program, I am no longer getting any error.

..
$map-setMetaData(ows_enable_request, *);

..
$map-setProjection(init=epsg:4326);

..
$layerOne-setProjection(init=epsg:4326);

..
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, mylayer);
$req-setParameter(SRS, EPSG:4326);
$req-setParameter(WIDTH, 1200);
$req-setParameter(HEIGHT, 600);
$req-setParameter(FORMAT, image/png);

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

The only problem is -- I am getting an image with nothing in it. This implies 
that I have likely got all the params for WMS correct, but now I am screwing up 
with some step in the layer creation. The interesting thing is, this is the 
same code that works fine as a regular MapServer request; makes an image fast 
and quick and correct. Is there a way I can add error logging to my WMS program 
to see what is going on at every step? Perhaps capture the database query being 
made, etc.


On Sep 8, 2011, at 1:22 PM, Frank Warmerdam wrote:

 Puneet,
 
 I would add that there is a lot of other metadata that you need to set on a
 map in order to get WxS services like WMS working.  If you haven't done
 that either you are going to be frustrated.
 
 I would suggest getting your script working initially with an actual mapfile
 and then if you really want to construct the map programmatically use
 that as a guide.
 
 Best regards,
 
 On Thu, Sep 8, 2011 at 11:15 AM, Armin Burger armin.bur...@gmx.net wrote:
 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 

Re: [mapserver-users] MapScript WMS request

2011-09-08 Thread Daniel Morissette

Hi Puneet,

A few things to try:

1- Reduce your map to a single layer if that's not already the case for 
your first round of tests.


2- Try a GetCapabilities instead of GetMap, and make sure your layer 
shows up properly and with no WARNING in the GetCapabilities XML output. 
Make sure the name of the layer is not changed: if you have multiple 
layers with the same name then the WMS handler will rename them to make 
them unique (WMS spec requirement)


3- Enable DEBUG at the map and layer level and look for any hints as to 
why nothing shows up. Compare the debug output between your WMS requests 
and the regular MapServer requests (the one that you say works fine) 
(see http://mapserver.org/optimization/debugging.html)


4- Frank's earlier suggestion to start by making things work from a 
regular mapfile first and then converting/moving stuff to mapscript 
progressively still stands as a great option.


Daniel


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

top posting, as most of the relevant info is self-contained in this email --

Ok, with the help of the suggestions from many of you, and by adding the 
following lines to my program, I am no longer getting any error.

..
$map-setMetaData(ows_enable_request, *);

..
$map-setProjection(init=epsg:4326);

..
$layerOne-setProjection(init=epsg:4326);

..
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, mylayer);
$req-setParameter(SRS, EPSG:4326);
$req-setParameter(WIDTH, 1200);
$req-setParameter(HEIGHT, 600);
$req-setParameter(FORMAT, image/png);

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

The only problem is -- I am getting an image with nothing in it. This implies 
that I have likely got all the params for WMS correct, but now I am screwing up 
with some step in the layer creation. The interesting thing is, this is the 
same code that works fine as a regular MapServer request; makes an image fast 
and quick and correct. Is there a way I can add error logging to my WMS program 
to see what is going on at every step? Perhaps capture the database query being 
made, etc.


On Sep 8, 2011, at 1:22 PM, Frank Warmerdam wrote:


Puneet,

I would add that there is a lot of other metadata that you need to set on a
map in order to get WxS services like WMS working.  If you haven't done
that either you are going to be frustrated.

I would suggest getting your script working initially with an actual mapfile
and then if you really want to construct the map programmatically use
that as a guide.

Best regards,

On Thu, Sep 8, 2011 at 11:15 AM, Armin Burgerarmin.bur...@gmx.net  wrote:

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

Re: [mapserver-users] MapScript WMS request

2011-09-08 Thread Mr . Puneet Kishor
fwiw, here is the pastebin link to the XML response to my GetCapabilities 
request. http://pastebin.com/zu8kjNDX

On Sep 8, 2011, at 6:44 PM, Mr. Puneet Kishor wrote:

 Great suggestions Daniel. Here is what I have to report --
 
 
 On Sep 8, 2011, at 6:27 PM, Daniel Morissette wrote:
 
 Hi Puneet,
 
 A few things to try:
 
 1- Reduce your map to a single layer if that's not already the case for your 
 first round of tests.
 
 
 It is already reduced to a single layer.
 
 
 
 2- Try a GetCapabilities instead of GetMap, and make sure your layer shows 
 up properly and with no WARNING in the GetCapabilities XML output. Make sure 
 the name of the layer is not changed: if you have multiple layers with the 
 same name then the WMS handler will rename them to make them unique (WMS 
 spec requirement)
 
 
 That was very useful. No errors, but I do notice the following funky issue 
 (see below)
 
   Layer queryable=0 opaque=0 cascaded=0
Namegmna/Name
Titlegmna/Title
SRSEPSG:4326/SRS
LatLonBoundingBox minx=-2.5e+07 miny=-2.5e+07 maxx=2.5e+07 
 maxy=2.5e+07 /
BoundingBox SRS=EPSG:4326
minx=-2.5e+07 miny=-2.5e+07 maxx=2.5e+07 
 maxy=2.5e+07 /
Style
  Namedefault/Name
  Titledefault/Title
  LegendURL width=167 height=7029
 Formatimage/png/Format
 OnlineResource xmlns:xlink=http://www.w3.org/1999/xlink; 
 xlink:type=simple 
 xlink:href=http://lucknow-2.local/test/mapscript/test3.cgi?version=1.1.0amp;service=WMSamp;request=GetLegendGraphicamp;layer=gmnaamp;format=image/pngamp;STYLE=default/
  /LegendURL
/Style
 
 
 Where the heck did that (+-)2.5e+07 business get into the BoundingBox? I 
 didn't add that. All I did was query in lat/lon. Maybe that is where my error 
 remains now.
 
 
 ..
 
 4- Frank's earlier suggestion to start by making things work from a regular 
 mapfile first and then converting/moving stuff to mapscript progressively 
 still stands as a great option.
 ..
 
 Indeed, a great suggestion. Actually, that is exactly how I started. Got 
 everything working with a Mapfile, then migrated to MapScript (I am touching 
 MapScript after many years now, perhaps half a decade), got that working, and 
 am now on to WMS.
 
 Anyway, I seem to be close to a resolution. Something is going on with my 
 BoundingBox.
 
 Puneet.
 

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


Re: [mapserver-users] MapScript WMS request

2011-09-08 Thread Mr. Puneet Kishor

On Sep 8, 2011, at 6:52 PM, Daniel Morissette wrote:

 On 11-09-08 07:44 PM, Mr. Puneet Kishor wrote:
 
 
 2- Try a GetCapabilities instead of GetMap, and make sure your layer shows 
 up properly and with no WARNING in the GetCapabilities XML output. Make 
 sure the name of the layer is not changed: if you have multiple layers with 
 the same name then the WMS handler will rename them to make them unique 
 (WMS spec requirement)
 
 
 That was very useful. No errors, but I do notice the following funky issue 
 (see below)
 
Layer queryable=0 opaque=0 cascaded=0
 Namegmna/Name
 Titlegmna/Title
 SRSEPSG:4326/SRS
 LatLonBoundingBox minx=-2.5e+07 miny=-2.5e+07 maxx=2.5e+07 
 maxy=2.5e+07 /
 BoundingBox SRS=EPSG:4326
 minx=-2.5e+07 miny=-2.5e+07 maxx=2.5e+07 
 maxy=2.5e+07 /
 Style
   Namedefault/Name
   Titledefault/Title
   LegendURL width=167 height=7029
  Formatimage/png/Format
  OnlineResource xmlns:xlink=http://www.w3.org/1999/xlink; 
 xlink:type=simple 
 xlink:href=http://lucknow-2.local/test/mapscript/test3.cgi?version=1.1.0amp;service=WMSamp;request=GetLegendGraphicamp;layer=gmnaamp;format=image/pngamp;STYLE=default/
   /LegendURL
 /Style
 
 
 Where the heck did that (+-)2.5e+07 business get into the BoundingBox? I 
 didn't add that. All I did was query in lat/lon. Maybe that is where my 
 error remains now.
 
 
 What is your data? a Shapefile? What is the source projection of the data?

PostGIS. lat/lng. SRID 4326

 
 I suspect the BoundingBox is invalid because the layer projection is not set 
 to the right value. Those funky numbers look like values in meters, so 
 presumably your data is in a projected coordinate system.
 
 In your script you set:
   $layerOne-setProjection(init=epsg:4326);

Already have that line in both $mapObj and in the $layerObj

$map-setProjection(init=epsg:4326);
..
$layerOne-setProjection(init=epsg:4326);


 
 This will work only if your data is in EPSG:4326. If that's not the case then 
 you need to set the layer projection to match the source data.
 

punkish@lucknow$/opt/local/lib/postgresql90/bin/psql -U postgres -d macromap
psql (9.0.4)
Type help for help.

macromap=# SELECT ST_SRID(the_geom) FROM gmna LIMIT 1;
 st_srid 
-
4326
(1 row)

macromap=# SELECT * FROM geometry_columns WHERE f_table_name = 'gmna';
 f_table_catalog | f_table_schema | f_table_name | f_geometry_column | 
coord_dimension | srid | type 
-++--+---+-+--+--
 | gmna   | gmna | the_geom  |  
 2 | 4326 | MULTIPOLYGON
(1 row)

macromap=#


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


Re: [mapserver-users] MapScript WMS request

2011-09-08 Thread Daniel Morissette

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


On Sep 8, 2011, at 7:16 PM, Mr. Puneet Kishor wrote:


PostGIS. lat/lng. SRID 4326




[...]



I should have also added the following

macromap=# SELECT ST_AsText(the_geom) FROM gmna LIMIT 1;
MULTIPOLYGON(((170.095660072181 65.6251237164987,170.158707739831 
65.6269635224645,170.173265447057 65.6291258974802,170.2497277762 
65.6357072803021,170.257074956711 65.6372005203368,170.267729454865 
65.6409199441452,170.283323865029 65.6476938262634,170.30182707 
65.657286936117,170.370058904075 65.6852127397289,170.394158265237 
65.6971816353387,170.45719236517 65.7228758026517,170.477794791157 
65.7331303689249,170.501440218163 65.7431659781412,170.506165498289 
65.745957239196,170.509550359131 65.74948784687,170.517163313193 
65.7692852345393,170.523452830315 65.7856156337451,170.527911709329 
65.7872471861488,170.564509940928 65.8002968138894,170.605805308438 
65.815184809157,17


As you can see, everything is in lat/lng.




Thanks. That rules out the possibility of a data problem.

With PostGIS, the WMS extents reported for a layer cannot be derived 
from the data. In the shapefile case we use the shapefile's extents, but 
this is not readily available with postgis, so unless I'm mistaken, 
MapServer looks up the wms/ows_extent metadata in the layer, and if not 
found then it falls back on the map's EXTENT for the mandatory 
BoundingBox and LatLonBoundingBox elements.


Maybe call $map-save(/tmp/my.map) in your script after the map and 
layer have been populated and paste the result... that may give us a hint...



--
Daniel Morissette
http://www.mapgears.com/
Provider of Professional MapServer Support since 2000

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


Re: [mapserver-users] MapScript WMS request

2011-09-08 Thread Mr. Puneet Kishor

On Sep 8, 2011, at 7:43 PM, Daniel Morissette wrote:

 On 11-09-08 08:40 PM, Mr. Puneet Kishor wrote:
 
 On Sep 8, 2011, at 7:16 PM, Mr. Puneet Kishor wrote:
 
 PostGIS. lat/lng. SRID 4326
 
 
 [...]
 
 
 I should have also added the following
 
 macromap=# SELECT ST_AsText(the_geom) FROM gmna LIMIT 1;
 MULTIPOLYGON(((170.095660072181 65.6251237164987,170.158707739831 
 65.6269635224645,170.173265447057 65.6291258974802,170.2497277762 
 65.6357072803021,170.257074956711 65.6372005203368,170.267729454865 
 65.6409199441452,170.283323865029 65.6476938262634,170.30182707 
 65.657286936117,170.370058904075 65.6852127397289,170.394158265237 
 65.6971816353387,170.45719236517 65.7228758026517,170.477794791157 
 65.7331303689249,170.501440218163 65.7431659781412,170.506165498289 
 65.745957239196,170.509550359131 65.74948784687,170.517163313193 
 65.7692852345393,170.523452830315 65.7856156337451,170.527911709329 
 65.7872471861488,170.564509940928 65.8002968138894,170.605805308438 
 65.815184809157,17
 
 
 As you can see, everything is in lat/lng.
 
 
 
 Thanks. That rules out the possibility of a data problem.
 
 With PostGIS, the WMS extents reported for a layer cannot be derived from the 
 data. In the shapefile case we use the shapefile's extents, but this is not 
 readily available with postgis, so unless I'm mistaken, MapServer looks up 
 the wms/ows_extent metadata in the layer, and if not found then it falls back 
 on the map's EXTENT for the mandatory BoundingBox and LatLonBoundingBox 
 elements.
 
 Maybe call $map-save(/tmp/my.map) in your script after the map and layer 
 have been populated and paste the result... that may give us a hint...
 

wow! this is a super-awesome debugging technique. I have sent you the map file 
off list to not pollute the entire list serve.

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


Re: [mapserver-users] MapScript WMS request

2011-09-08 Thread Mr. Puneet Kishor

On Sep 8, 2011, at 8:28 PM, Daniel Morissette wrote:

 On 11-09-08 09:02 PM, Mr. Puneet Kishor wrote:
 
 On Sep 8, 2011, at 7:43 PM, Daniel Morissette wrote:
 
 Maybe call $map-save(/tmp/my.map) in your script after the map and layer 
 have been populated and paste the result... that may give us a hint...
 
 
 wow! this is a super-awesome debugging technique. I have sent you the map 
 file off list to not pollute the entire list serve.
 
 
 I was able to reproduce the issue with the copy of the mapfile you sent 
 off-list.
 
 It turns out that mappostgis.c's msPostGISLayerGetExtent() is hardcoded to 
 always return
 
 {minx = -2500, miny = -2500, maxx = 2500, maxy = 2500}
 
 ...and then it returns MS_SUCCESS.
 
 I think this function should either be left unimplemented (this way MapServer 
 would fallback on other mechanisms), or return MS_FAILURE to indicate to the 
 calling code that it didn't do anything useful.
 
 A quick search indicates an open ticket about the issue:
 
 http://trac.osgeo.org/mapserver/ticket/3585
 
 You could bump the ticket and hope someone works on it at the FOSS4G code 
 sprint next week.
 
 The short term fix for you would be to set the ows_extent metadata in your 
 layer:
 
METADATA
  ows_extent -180 -90 180 90
   ...
END
 


Thanks Daniel. I will bump the ticket. For now, see below --

Using the my.map file I sent you, with no further modifications to it, I am 
able to successfully get an image back via 
[http://localhost.local/cgi-bin/gmna?SERVICE=WMSVERSION=1.1.1REQUEST=GetMapBBOX=-180,-90,180,90SRS=EPSG:4326WIDTH=1200HEIGHT=600LAYERS=gmnaSTYLES=FORMAT=image/pngTRANSPARENT=true]

Note, no further modifications is required, that is, not even the ows_extent 
-180 -90 180 90 bit in the layer METADATA. and I still get a good image.


However, if I use the following program to access the same map file, I get the 
spurious minx = -2500, miny = -2500, maxx = 2500, maxy = 2500 
in the GetCapabilities.

Finally, if I add the ows_extent -180 -90 180 90 line in the layer METADATA 
in the my.map file, the GetCapabilities returns the correct bounds now, 
however, the image is still blank.

#!/opt/local/bin/perl

use strict;
use mapscript;

my $wms = new mapscript::OWSRequest();
$wms-setParameter(SERVICE, WMS );
$wms-setParameter(VERSION, 1.1.1 );
$wms-setParameter(REQUEST, GetMap );
$wms-setParameter(BBOX, -180,-90,180,90 );
$wms-setParameter(LAYERS, gmna);
$wms-setParameter(SRS, EPSG:4326);
$wms-setParameter(WIDTH, 1200);
$wms-setParameter(HEIGHT, 600);
$wms-setParameter(FORMAT, image/png);
$wms-setParameter(TRANSPARENT, true);

my $map = new 
mapscript::mapObj(/Users/punkish/Sites/test/mapscript/my.map);

if(!$map) {
warn New mapObj() error: $mapscript::ms_error-{message}\n;
}

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

I have now spent an enormous amount of time on this, and for now, I have to 
move on. This is just not working out. Maybe I will try some other technique, 
perhaps this mode=tile to see if I can get MapServer powered maps in my apps.

Thanks much for your help. If you (or anyone else) can come up with a bright 
idea, I will be happy to try it.

Puneet.

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


[mapserver-users] MapScript WMS request

2011-09-07 Thread Mr. Puneet Kishor
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 );
  
  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