Re: [mapserver-users] Line numbers of error messages in mapfiles with includes
Yes, it was under 5.7. I tested it under 6 and there it works OK. Thanks, Jan On 09/07/2011 09:52 PM, Steve Lime wrote: Which version are you using? For some reason I thought this was in place in the 6.0 release. Steve On Wed, Sep 7, 2011 at 8:29 AM, Jan Hartmannj.l.h.hartm...@uva.nl wrote: Sometimes it's difficult to find the location of an error in a Mapfile, when that Mapfiles includes another Mapfile. In that case the line number is that of the combined files. Would it be possible to set the line-counter to the actual file Mapserver is parsing? Jan ___ 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] Problem compiling MapServer 6.0.1 with libpng
Hi, After many trials and missings, I am still unable to compile MapServer 6.0.1 (6.0.0 also) on my Debian Lenny machine. Here is the error I get: ./libmapserver.a(mapimageio.o): In function `savePalettePNG': /home/dgambin/mapserver-6.0.1/mapimageio.c:274: undefined reference to `png_set_longjmp_fn' ./libmapserver.a(mapimageio.o): In function `saveAsPNG': /home/dgambin/mapserver-6.0.1/mapimageio.c:461: undefined reference to `png_set_longjmp_fn' ./libmapserver.a(mapimageio.o): In function `readPNG': /home/dgambin/mapserver-6.0.1/mapimageio.c:738: undefined reference to `png_set_longjmp_fn' collect2: ld returned 1 exit status Here is my configure: ./configure --with-ogr=/usr/local/bin/gdal-config --with-gdal=/usr/local/bin/gda l-config --with-wfs --with-wfsclient --with-wmsclient --enable-debug --with-curl -config=/usr/bin/curl-config --with-proj=/usr --with-jpeg --with-freetype=/usr/b in/ --with-postgis=/usr/bin/pg_config --with-mysql=/usr/bin/mysql_config --with- libiconv=/usr --with-kml=yes --with-php=/usr/include/php5 --with-png=/usr/local Since I have system libpng 1.2.27-2, I downloaded and installed 1.5.4 and put --with-png=/usr/local in my configure file. But seems like it doesn't help. I also tried with 1.4.8. Stiil the same issue. Also tried without --with-png=/usr/local (so it should use system libpng)...nothing I have compiled using newest gdal 1.8.1. GDAL compiled ok with libpng 1.5.4. Am I doing something wrong? Thank you very much for any useful info regards, dejan___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
RE: [mapserver-users] how to define the CLASSITEM and EXPRESSION in this case?
Have you looked at this page in the documentation? http://mapserver.org/mapfile/expressions.html#arithmetic-operations-and-functions-that-return-a-number You should be able to do this. You wouldn't use a CLASSITEM, just an expression. Create individual classes for green, yellow, and red. The expression for green would be something like: EXPRESSION ([PopulationOver65] / [PopulationTotal] * 100 10) David. -Original Message- From: mapserver-users-boun...@lists.osgeo.org [mailto:mapserver-users-boun...@lists.osgeo.org] On Behalf Of jjwang Sent: Thursday, September 08, 2011 12:47 AM To: mapserver-users@lists.osgeo.org Subject: [mapserver-users] how to define the CLASSITEM and EXPRESSION in this case? I want to define classes according to the proportion between two attributes of the feature. How to do this? For example: feature has two attributes 'PopulationOver65' and 'PopulationTotal'. They are both numbers. I want the color of this feature: green if PopulationOver65/PopulationTotal 10%, yellow if 10% -30%, red if 30%. Anyway to do this? JJ -- View this message in context: http://osgeo-org.1803224.n2.nabble.com/how-to-define-the-CLASSITEM-and-EXPRESSION-in-this-case-tp6770598p6770598.html Sent from the Mapserver - User mailing list archive at Nabble.com. ___ 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] Line numbers of error messages in mapfiles with includes
Tanks Steve, not necessary. Better spend my time on updating everything to 6 ... Jan On 09/08/2011 04:22 PM, Steve Lime wrote: Changes are restricted to maplexer.l if you felt the need to patch 5.7. Let me know if you need assistance... Steve On Thu, Sep 8, 2011 at 3:39 AM, Jan Hartmannj.l.h.hartm...@uva.nl wrote: Yes, it was under 5.7. I tested it under 6 and there it works OK. Thanks, Jan On 09/07/2011 09:52 PM, Steve Lime wrote: Which version are you using? For some reason I thought this was in place in the 6.0 release. Steve On Wed, Sep 7, 2011 at 8:29 AM, Jan Hartmannj.l.h.hartm...@uva.nl wrote: Sometimes it's difficult to find the location of an error in a Mapfile, when that Mapfiles includes another Mapfile. In that case the line number is that of the combined files. Would it be possible to set the line-counter to the actual file Mapserver is parsing? Jan ___ 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] Re: Getting blank tiles in google maps
(retrying message) Hi all, I am new to MapServer. I have downloaded and setup MS4W and was able to overlay the example Bath and other map data on google maps. I then created my own .map file using QGIS and supplied my data but the served tiles are completely blank(transparant or white when I select RGB). My data set is .GML and I also tried converting it to .SHP format. I have checked that my setup is ok by doing is on two different computers. When I use shp2img.exe then it renders the layers properly. c:\ shp2img.exe -m hampshire.map -o hampshire.png -s 2048 2048 I am using this URL scheme: http://localhost:8088/cgi-bin/mapserv.exe?map=C:/ms4w/apps/gmap/htdocs/hampshire.maplayers=HampshireAreasmode=tiletilemode=gmaptile=[x]+[y]+[z] I have attached all the relevant files. (2 sets, one is .SHP and the other is .GML, both cases I get transparent empty tiles) Can anyone please help me identify the reason why the generated tiles are transparent and how I can fix it. (7MB total, 1MB pieces, sorry if this is large, I am new to mailing lists too, please use 7Z to unzip) SHP: Hampshire.map Hampshire.7z.001...006 GML: Hampshire-gml.map Hampshire-gml.7z Download links here: (7z, 7mb total) http://osgeo-org.1803224.n2.nabble.com/Getting-blank-tiles-in-google-maps-td6746323.html Alternate download (zip format, 14mb) http://www.megaupload.com/?d=DAD6SR5P Thanks you very much. Vaibhav G -- View this message in context: http://osgeo-org.1803224.n2.nabble.com/Getting-blank-tiles-in-google-maps-tp6772814p6772946.html Sent from the Mapserver - User mailing list archive at Nabble.com. ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] Re: MapScript WMS request
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
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
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: Getting blank tiles in google maps
Have you verified that the map will display when not in tile mode? http://localhost:8088/cgi-bin/mapserv.exe?map=C:/ms4w/apps/gmap/htdocs/hampshire.maplayers=HampshireAreasmode=maphttp://localhost:8088/cgi-bin/mapserv.exe?map=C:/ms4w/apps/gmap/htdocs/hampshire.maplayers=HampshireAreasmode=tiletilemode=gmaptile=[x]+[y]+[z] On Thu, Sep 8, 2011 at 12:47 PM, vaibhavgarg vaibhavkumarg...@gmail.comwrote: (retrying message) Hi all, I am new to MapServer. I have downloaded and setup MS4W and was able to overlay the example Bath and other map data on google maps. I then created my own .map file using QGIS and supplied my data but the served tiles are completely blank(transparant or white when I select RGB). My data set is .GML and I also tried converting it to .SHP format. I have checked that my setup is ok by doing is on two different computers. When I use shp2img.exe then it renders the layers properly. c:\ shp2img.exe -m hampshire.map -o hampshire.png -s 2048 2048 I am using this URL scheme: http://localhost:8088/cgi-bin/mapserv.exe?map=C:/ms4w/apps/gmap/htdocs/hampshire.maplayers=HampshireAreasmode=tiletilemode=gmaptile=[x]+[y]+[z] I have attached all the relevant files. (2 sets, one is .SHP and the other is .GML, both cases I get transparent empty tiles) Can anyone please help me identify the reason why the generated tiles are transparent and how I can fix it. (7MB total, 1MB pieces, sorry if this is large, I am new to mailing lists too, please use 7Z to unzip) SHP: Hampshire.map Hampshire.7z.001...006 GML: Hampshire-gml.map Hampshire-gml.7z Download links here: (7z, 7mb total) http://osgeo-org.1803224.n2.nabble.com/Getting-blank-tiles-in-google-maps-td6746323.html Alternate download (zip format, 14mb) http://www.megaupload.com/?d=DAD6SR5P Thanks you very much. Vaibhav G -- View this message in context: http://osgeo-org.1803224.n2.nabble.com/Getting-blank-tiles-in-google-maps-tp6772814p6772946.html Sent from the Mapserver - User mailing list archive at Nabble.com. ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users -- A computer without Windows is like chocolate cake without mustard. ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Re: MapScript WMS request
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
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
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
[mapserver-users] Re: Getting blank tiles in google maps
Thanks for replying. I am new to mapserver so I did now know we can do that. Anyway, yes I was able to use that url to generate the map: http://osgeo-org.1803224.n2.nabble.com/file/n6773174/MapImage.png It looks just like the result of shp2img.exe How do I identify and specify the right projections, which really confuses me and I am guessing that that is the problem.. Can you have a look at the sample .SHP data please? -- View this message in context: http://osgeo-org.1803224.n2.nabble.com/Getting-blank-tiles-in-google-maps-tp6772814p6773174.html Sent from the Mapserver - User mailing list archive at Nabble.com. ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Re: Getting blank tiles in google maps
Doesn't look like you have SRS on the shapefiles. ogrinfo info shows you what you need to know about the shapefiles: ogrinfo -so -al HampshireLines.shp ogrinfo -so -al HampshirePoints.shp ogrinfo -so -al HampshireAreas.shp All three currently have: Layer SRS WKT: (unknown) I've had good luck using ogr2ogr to add SRS. For example to add EPSG:4326 (What google uses) ogr2ogr -a_srs EPSG:4326 HampshireAreas2 HampshireAreas.shp ogr2ogr -a_srs EPSG:4326 HampshirePoints2 HampshirePoints.shp ogr2ogr -a_srs EPSG:4326 HampshireLines2 HampshireLines.shp Ends up with: Layer SRS WKT: GEOGCS[GCS_WGS_1984, DATUM[WGS_1984, SPHEROID[WGS_84,6378137,298.257223563]], PRIMEM[Greenwich,0], UNIT[Degree,0.017453292519943295]] Hope that helps. On Thu, Sep 8, 2011 at 1:41 PM, vaibhavgarg vaibhavkumarg...@gmail.comwrote: Thanks for replying. I am new to mapserver so I did now know we can do that. Anyway, yes I was able to use that url to generate the map: http://osgeo-org.1803224.n2.nabble.com/file/n6773174/MapImage.png It looks just like the result of shp2img.exe How do I identify and specify the right projections, which really confuses me and I am guessing that that is the problem.. Can you have a look at the sample .SHP data please? -- View this message in context: http://osgeo-org.1803224.n2.nabble.com/Getting-blank-tiles-in-google-maps-tp6772814p6773174.html Sent from the Mapserver - User mailing list archive at Nabble.com. ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users -- A computer without Windows is like chocolate cake without mustard. ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] how to specify the location of projection library, how to do it not in map file?
Hi, I specify the location proj library in the map file, which points to apache cgin-bin dirs.. Because we have 32 bit and 64 bit machines, and the paths of the apache software on those two types machines are not the same, I end up having two map files. That creates installation problems for us. I'm wondering if there is more elegant way to specify the path to proj library? In basegn.x32.map CONFIG PROJ_LIB C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin/ In basegn.x64.map CONFIG PROJ_LIB C:/Program Files (x86)/Apache Software Foundation/Apache2.2/cgi-bin/ Thanks. JK ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] how to specify the location of projection library, how to do it not in map file?
On 9/8/2011 5:05 PM, JK Chen wrote: Hi, I specify the location proj library in the map file, which points to apache cgin-bin dirs.. Because we have 32 bit and 64 bit machines, and the paths of the apache software on those two types machines are not the same, I end up having two map files. That creates installation problems for us. I'm wondering if there is more elegant way to specify the path to proj library? In basegn.x32.map CONFIG PROJ_LIB C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin/ In basegn.x64.map CONFIG PROJ_LIB C:/Program Files (x86)/Apache Software Foundation/Apache2.2/cgi-bin/ I believe you can set this up as an environment variable in each apache instance so so it points to the correct file. You would have to do this in the apache config file(s). -Steve W ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] how to specify the location of projection library, how to do it not in map file?
On 9/8/2011 5:02 PM, Stephen Woodbridge wrote: On 9/8/2011 5:05 PM, JK Chen wrote: Hi, I specify the location proj library in the map file, which points to apache cgin-bin dirs.. Because we have 32 bit and 64 bit machines, and the paths of the apache software on those two types machines are not the same, I end up having two map files. That creates installation problems for us. I'm wondering if there is more elegant way to specify the path to proj library? In basegn.x32.map CONFIG PROJ_LIB C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin/ In basegn.x64.map CONFIG PROJ_LIB C:/Program Files (x86)/Apache Software Foundation/Apache2.2/cgi-bin/ I believe you can set this up as an environment variable in each apache instance so so it points to the correct file. You would have to do this in the apache config file(s). See: http://trac.osgeo.org/mapserver/wiki/EnvironmentVariables If you can do it in the apache config because you do not have access to it, you could write a simple wrapper script the exports the enviroment variable and then executes mapserver. -Steve W ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] how to specify the location of projection library, how to do it not in map file?
Any chance you can just install Apache to same locations? Just override the installation directory to C:/Program Files/ on both. On Thu, Sep 8, 2011 at 4:02 PM, Stephen Woodbridge wood...@swoodbridge.comwrote: On 9/8/2011 5:05 PM, JK Chen wrote: Hi, I specify the location proj library in the map file, which points to apache cgin-bin dirs.. Because we have 32 bit and 64 bit machines, and the paths of the apache software on those two types machines are not the same, I end up having two map files. That creates installation problems for us. I'm wondering if there is more elegant way to specify the path to proj library? In basegn.x32.map CONFIG PROJ_LIB C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin/ In basegn.x64.map CONFIG PROJ_LIB C:/Program Files (x86)/Apache Software Foundation/Apache2.2/cgi-bin/ I believe you can set this up as an environment variable in each apache instance so so it points to the correct file. You would have to do this in the apache config file(s). -Steve W __**_ mapserver-users mailing list mapserver-users@lists.osgeo.**org mapserver-users@lists.osgeo.org http://lists.osgeo.org/**mailman/listinfo/mapserver-**usershttp://lists.osgeo.org/mailman/listinfo/mapserver-users -- A computer without Windows is like chocolate cake without mustard. ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] Re: label problem since MS6
I logged a bug regarding the issue with PNGs. Oddly enough, when I switch it to GIF it appears to work normally for me, so I'm not sure what's happening in your case. http://trac.osgeo.org/mapserver/ticket/4013 -- View this message in context: http://osgeo-org.1803224.n2.nabble.com/label-problem-since-MS6-tp6768768p6773845.html Sent from the Mapserver - User mailing list archive at Nabble.com. ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] how to specify the location of projection library, how to do it not in map file?
I would try something like the following in: /etc/apache2/sites-enabled/000-default ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ Directory /usr/lib/cgi-bin AddHandlerfastcgi-script .fcgi SetEnv PROJ_LIB C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin/ AllowOverride None Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Order allow,deny Allow from all /Directory I have not tried this. Probably a good idea to read about it in the apache docs. Oh and since I copy and pasted the above block from a Linux system and than added your windows path I'm sure the above will not work verbatim on either system ;) but it will hopefully give you a guide. -Steve W On 9/8/2011 5:40 PM, JK Chen wrote: Hi Steve, How to do it via Apache configuration? What is the syntax? Is it like this: PROJ_LIB ./cgi-bin/ Nope, we can't over-write the path names. Thanks for your helps. JK -Original Message- From: mapserver-users-boun...@lists.osgeo.org [mailto:mapserver-users-boun...@lists.osgeo.org] On Behalf Of Stephen Woodbridge Sent: Thursday, September 08, 2011 3:06 PM To: mapserver-users@lists.osgeo.org Subject: Re: [mapserver-users] how to specify the location of projection library, how to do it not in map file? On 9/8/2011 5:02 PM, Stephen Woodbridge wrote: On 9/8/2011 5:05 PM, JK Chen wrote: Hi, I specify the location proj library in the map file, which points to apache cgin-bin dirs.. Because we have 32 bit and 64 bit machines, and the paths of the apache software on those two types machines are not the same, I end up having two map files. That creates installation problems for us. I'm wondering if there is more elegant way to specify the path to proj library? In basegn.x32.map CONFIG PROJ_LIB C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin/ In basegn.x64.map CONFIG PROJ_LIB C:/Program Files (x86)/Apache Software Foundation/Apache2.2/cgi-bin/ I believe you can set this up as an environment variable in each apache instance so so it points to the correct file. You would have to do this in the apache config file(s). See: http://trac.osgeo.org/mapserver/wiki/EnvironmentVariables If you can do it in the apache config because you do not have access to it, you could write a simple wrapper script the exports the enviroment variable and then executes mapserver. -Steve W ___ 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
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
[mapserver-users] advice on best practice for MapServer layer in OL/Gmaps
In another tortured thread I am seeking advice on WMS with MapScript. My ultimate intent is to provide MapServer layers in OL/Gmaps/(some_other) web app. I need to use MapScript because of the flexibility and freedom it gives me in querying my datasources, and in constructing the map. Do I have to use WMS? What, if any, are the alternative? I notice that MapServer now has a `mode=tile` that is designed with Gmaps kinda app in mind. Is that a better mode? Would that work with OL as well? Or with Leaflet or some other client-side web mapping framework? Its been a while since I have used MapServer extensively for creating a full-fledged app, but the time to do is coming up now. I would really appreciate any advice on this front. Puneet.___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] MapScript WMS request
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
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
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
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
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
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] mode=tile and MapScript
I am trying out mode=tile as detailed at [http://mapserver.org/output/tile_mode.html], and actually, it works great! Might be able to avoid the pains of WMS completely. However, it works great with MapServer CGI. What if I want to use MapScript? In other words, instead of var urlTemplate = 'http://localhost/cgi-bin/myapp?'; urlTemplate += 'layers=layer1 layer2'; urlTemplate += 'mode=tile'; urlTemplate += 'tilemode=gmap'; urlTemplate += 'tile={X}+{Y}+{Z}'; I have var urlTemplate = 'http://localhost/myapp.cgi?'; urlTemplate += 'tile={X}+{Y}+{Z}'; and I add mode=tile and tilemode=gmap on the server side. My question is -- one, will the above work? and, how do I pass mode=tile and tilemode=gmap and the tile={X}+{Y}+{Z} parameters to the program? I didn't see any MapScript documentation for these parameters. I need to translate a call such as [http://localhost/cgi-bin/myapp?layers=layer1mode=tiletilemode=gmaptile=30+46+7] into a MapScript request. Puneet.___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users