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: [email protected] > [mailto:[email protected]] On Behalf Of Mr. Puneet > Kishor > Sent: Thursday, September 08, 2011 9:32 PM > To: Daniel Morissette > Cc: [email protected] > 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 = -25000000, miny = -25000000, maxx = 25000000, maxy = 25000000} >> >> ...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=WMS&VERSION=1.1.1&REQUEST=GetMap&BBOX=-180,-90,180,90&SRS=EPSG:4326&WIDTH=1200&HEIGHT=600&LAYERS=gmna&STYLES=&FORMAT=image/png&TRANSPARENT=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 = -25000000, miny = -25000000, maxx = 25000000, maxy = > 25000000" 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 > [email protected] > http://lists.osgeo.org/mailman/listinfo/mapserver-users > > _______________________________________________ mapserver-users mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/mapserver-users
