Re: [mapserver-users] Access control for wms served from mapserver cgi
Hello Rahkonen (and Stephan), This is an idea that I could make work...I'd have to lock-down mapserv itself from all connections (otherwise anyone could just replace wms*.exe in the URL with the original mapserv.exe), though I guess I should be doing that anyway. In response to Stephan Holl: I recognize there are other strategies that involve proxying the WMS requests. I was just hoping for something quick and easy that could be done with Apache more or less out-of-the-box using basic config files and/or modules like mod_rewrite. There have been a few cases where I needed to use mapserver on one machine to serve data using WMS to another server running mapserver as a WMS client. I just want to be able to do that with as little work as possible (i.e., if I can do it in Apache's config, then I can do it anywhere). Essentially, my ideal solution would be if I can get something like mod_rewrite to say if a request to mapserv contains 'map=/path/to/somefile.map' in the query string, and the client is not equal to some IP address, return 403, otherwise allow the request. I just don't quite know how to get mod_rewrite to work like that for me (I found some promising examples online, but couldn't get them working). Thanks again, Mike Rahkonen Jukka wrote: Hi, If it is easy to limit access to mapserv executable, then how about making a few copies of the executable and tie each copy to its own mapfile in httpd.conf? SetEnvIf Request_URI /cgi-bin/wms1.exe? MS_MAPFILE=d:/ms4w/apps/wms1.map SetEnvIf Request_URI /cgi-bin/wms2.exe? MS_MAPFILE=d:/ms4w/apps/wms2.map Just thinking, I do not know if this is secure at all. -Jukka Rahkonen- -Alkuperäinen viesti- Lähettäjä: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Puolesta Mike Leahy Lähetetty: 20. lokakuuta 2008 3:58 Vastaanottaja: mapserver-users@lists.osgeo.org Aihe: [mapserver-users] Access control for wms served from mapserver cgi Hello list, Does anyone on this list know of a simple strategy for configuring Apache to restrict access to specific mapfiles served as WMS through the cgi mapserv program? I'd like to do is restrict access to specific IPs for URLs like the following: http://host/cgi-bin/mapserv?map=/path/to/file.map[;...]. It's easy enough to limit access to the mapserv executable itself, but I'd rather do it on a per-mapfile basis. I tried a couple things using mod_rewrite in apache, but anything I've tried so far doesn't seem to work. I know that this sort of question has been asked before, but after searching/tinkering for a while, I haven't found a solution that works for me yet. Thanks for any suggestions, Mike ___ 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] Access control for wms served from mapserver cgi
Hello list, Does anyone on this list know of a simple strategy for configuring Apache to restrict access to specific mapfiles served as WMS through the cgi mapserv program? I'd like to do is restrict access to specific IPs for URLs like the following: http://host/cgi-bin/mapserv?map=/path/to/file.map[;...]. It's easy enough to limit access to the mapserv executable itself, but I'd rather do it on a per-mapfile basis. I tried a couple things using mod_rewrite in apache, but anything I've tried so far doesn't seem to work. I know that this sort of question has been asked before, but after searching/tinkering for a while, I haven't found a solution that works for me yet. Thanks for any suggestions, Mike ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Fractional line widths?
Hello Dane, If you change the name of your OUTPUTFORMAT to 'AGGA', then I think you must also change the IMAGETYPE parameter to 'AGGA' so that the map uses the correct outputformat (i.e., there can be more than one outpuformat in a mapfile). Mike Date: Thu, 4 Sep 2008 19:10:53 -0700 From: Dane Springmeyer [EMAIL PROTECTED] Subject: Re: [mapserver-users] Fractional line widths? To: thomas bonfort [EMAIL PROTECTED] Cc: mapserver-users@lists.osgeo.org Message-ID: [EMAIL PROTECTED] Content-Type: text/plain; charset=us-ascii Thomas, Thanks for the tip, but I think I don't quite understand the right syntax. First of all, I'm running the mac binary from kyngchaos, version 5.2.0 I've tried to add two style blocks like: LAYER NAME world_opacity DATA world_borders.shp STATUS ON TYPE POLYGON CLASS NAME World STYLE COLOR 242 239 249 OUTLINECOLOR-1 -1 -1 END STYLE COLOR -1 -1 -1 OUTLINECOLOR 127 127 127 OPACITY 50 WIDTH 1 END END # class END # layer to create this full mapfile: http://mapnik-utils.googlecode.com/svn/trunk/tutorials/hello_world/mapserver_comparison/mapfile_config/world.map But that does not produce a result more akin to WIDTH 0.5, from what I can tell. It simply lightens the color of the outline, and in this case make it 'seem' even thicker. It is as if the opacity is not working as a true alpha opacity. Here is the example output with OPACITY 50: http://mapnik-utils.googlecode.com/svn/trunk/tutorials/hello_world/mapserver_comparison/mapfile_config/map/hello_world_with_mapserver_mapfile_opacity.png Is this the expected behavior or have I made an error in my mapfile syntax (highly likely). Perhaps I am not correctly turning off the outline for the first style? The issue may also be with my OUTPUTFORMAT, which is not using the RGBA: OUTPUTFORMAT NAME 'AGG' DRIVER AGG/PNG IMAGEMODE RGB MIMETYPE image/png END I also tried with: OUTPUTFORMAT NAME 'AGGA' DRIVER AGG/PNG IMAGEMODE RGBA MIMETYPE image/png END but I get an error when I add the 'AGGA' (based on reading http://mapserver.gis.umn.edu/docs/howto/agg-rendering-specifics) : msPostMapParseOutputFormatSetup(): General error message. Unable to select IMAGETYPE `AGG'. Any thoughts? Thanks, Dane On Aug 31, 2008, at 2:50 PM, thomas bonfort wrote: hi. yes, you need two style blocks inside your class cheers, thomas On Sun, Aug 31, 2008 at 9:43 PM, Dane Springmeyer [EMAIL PROTECTED] wrote: Hi Thomas, Thanks for the followup. The OPACITY keyword seems to apply to both the polyon fill (COLOR) and the outline (OUTLINECOLOR). What is the trick to apply it to only the outline? I tried OUTLINEOPACITY, which of course does not exist. Do I need to pull out a style class for just the outline? Here is the mapfile I am working from: http://mapnik-utils.googlecode.com/svn/trunk/tutorials/hello_world/mapserver_comparison/mapfile_config/world.map Thanks, Dane On Aug 30, 2008, at 12:22 AM, thomas bonfort wrote: Sorry for not hopping into the thread earlier, blame holidays :) For the time being, you can achieve similar output with mapserver 5.2, by using the OPACITY keyword at the style level STYLE COLOR r g b OPACITY 50 # essentially the same as WIDTH 0.5 WIDTH 1 END cheers, thomas -- next part -- An HTML attachment was scrubbed... URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20080904/a2a331e8/attachment-0001.html -- ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Corrupt image output (solved?)
Hello again, I think I found the cause of my problem - on my server (where I had preprocessed all of my imagery), I have libgeotiff-1.2.4 installed from the F8 repositories. On my laptop I had libgeotiff-1.2.3 installed from source. I upgraded my laptop to libgeotiff-1.2.4 (I tried 1.2.5, but it didn't compile for me), and recompiled gdal and mapserver. Now it seems that imagery renders okay (after some quick tests). I didn't realize I had different libgeotiff library versions...but it also hadn't occurred to me that a GeoTiff dataset might be incompatible with different versions of libgeotiff. So should I maybe close the ticket that I opened earlier today? Mike Mike Leahy wrote: Ok, I'll file a ticket shortly...but I have a few more things I've tried that might add insight to this. It seems if I load the map via cgi mapserver, I get the same problems - so this isn't limited to mapscript. In contrast, I don't seem to have any trouble with the output values if I extract a single pixel from an image using gdal_translate to a *.grd file (at the same coordinates where I get corrupt results from mapscript/mapserver) - so the problem doesn't seem to be with gdal by itself. Also, I can point out that the corrupted areas in the output have no coincidence with tile-index boundaries. I say this out because if I render a layer from a non-tiled image dataset, the corrupted areas appear as horizontal bands across the entire width of the image output, rather than rectangular areas (though my non-tiled dataset is a single-band floating-point DEM, rather than an rgb image). However, as before, the height and number of lines of each band is variable. Maybe it's just time to upgrade my OS (F7 is EOL after all). Regards, Mike Tamas Szekeres wrote: Mike, It's quite difficult to find out what's going on. You should file a ticket including the example and sample data. Probably the problem may be reproduced in other machines as well. Best regards, Tamas 2008/8/19 Mike Leahy [EMAIL PROTECTED]: Tamas, I just gave this a try a few times - deleted the cache, and loaded one tile. It seems to happen less frequently, but I still have about a 1 in 3 chance of getting various rectangle artifacts on the image. It basically looks like something forgets to draw one or more of the rgb colours. Mike Tamas Szekeres wrote: Mike, Did you experience the same problem when calling tile.php directly when rendering an individual tile? Best regards, Tamas 2008/8/19 Mike Leahy [EMAIL PROTECTED]: Hello list, I'm wondering if anyone can help me figure out a problem I'm having with corrupted output from from a tiled geotiff dataset I'm using in a ka-Map environment. You can see what's happening to the imagery here: http://img527.imageshack.us/my.php?image=corrupthd1.png This generally happens when I'm zoomed in fairly close, and usually with this high-resolution image dataset. However, I can get corrupted output for other raster datasets (all geotiff, but not always tiled). It seems to happen when the machine is processing most intensively (i.e., usually when the imagery is being rendered by ka-Map). It also seems to be limited to the laptop I am using, which is running F7-x86_64. In contrast, I have an actual server (F8-x86_64), which has a virtually identical setup (with respect to MapServer and its various dependencies), but with lots more cpu cores and ram, and it's having no trouble at all (as far as I have noticed). The corruption in the output from the same application my laptop is not always the same - if I clear the cache for ka-Map and re-render the images, I'll get similar artifacts appearing in the output (red, green, blue and/or black rectangles), but they will vary in size and location. It happens for both GD/AGG drivers, and JPEG/PNG output formats. Until now, I figured it was just a problem with limited memory on my laptop (it was always around 100% when rendering this imagery on the web service + viewing the application in a browser), but now I've upgraded the ram - there's plenty of spare room and I'm still getting the same problem. I just finished upgrading Gdal from 1.5.0 to 1.5.2, and that didn't help any. Basically, the only real differences I can think of between my laptop and my server are the number of cpu cores (1 on my laptop vs. 8 on the server), and possibly the versions of some of the underlying libraries in the system. Does anyone know where I should start looking to find the cause of this? Or perhaps somebody recognizes this problem, and knows what I might be doing wrong... Thanks for any suggestions, Mike ___ 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
[mapserver-users] Corrupt image output
Hello list, I'm wondering if anyone can help me figure out a problem I'm having with corrupted output from from a tiled geotiff dataset I'm using in a ka-Map environment. You can see what's happening to the imagery here: http://img527.imageshack.us/my.php?image=corrupthd1.png This generally happens when I'm zoomed in fairly close, and usually with this high-resolution image dataset. However, I can get corrupted output for other raster datasets (all geotiff, but not always tiled). It seems to happen when the machine is processing most intensively (i.e., usually when the imagery is being rendered by ka-Map). It also seems to be limited to the laptop I am using, which is running F7-x86_64. In contrast, I have an actual server (F8-x86_64), which has a virtually identical setup (with respect to MapServer and its various dependencies), but with lots more cpu cores and ram, and it's having no trouble at all (as far as I have noticed). The corruption in the output from the same application my laptop is not always the same - if I clear the cache for ka-Map and re-render the images, I'll get similar artifacts appearing in the output (red, green, blue and/or black rectangles), but they will vary in size and location. It happens for both GD/AGG drivers, and JPEG/PNG output formats. Until now, I figured it was just a problem with limited memory on my laptop (it was always around 100% when rendering this imagery on the web service + viewing the application in a browser), but now I've upgraded the ram - there's plenty of spare room and I'm still getting the same problem. I just finished upgrading Gdal from 1.5.0 to 1.5.2, and that didn't help any. Basically, the only real differences I can think of between my laptop and my server are the number of cpu cores (1 on my laptop vs. 8 on the server), and possibly the versions of some of the underlying libraries in the system. Does anyone know where I should start looking to find the cause of this? Or perhaps somebody recognizes this problem, and knows what I might be doing wrong... Thanks for any suggestions, Mike ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] Re: Corrupt image output
Hello again, Just to follow-up on this, this problem isn't limited to just image rendering. I also get odd results from raster queries in php mapscript - about half the time, I'll get appropriate rgb values, but as you can see in this example (http://img411.imageshack.us/my.php?image=corrupt2rj9.png), I don't always get the correct results. Often, I'll get zeros for all three values, or just one value - in that sample image, the location on the map indicated by the red dot should have something returned for all three red/green/blue fields. So perhaps this is a problem somewhere between mapscript and the gdal library? Mike Mike Leahy wrote: Hello list, I'm wondering if anyone can help me figure out a problem I'm having with corrupted output from from a tiled geotiff dataset I'm using in a ka-Map environment. You can see what's happening to the imagery here: http://img527.imageshack.us/my.php?image=corrupthd1.png This generally happens when I'm zoomed in fairly close, and usually with this high-resolution image dataset. However, I can get corrupted output for other raster datasets (all geotiff, but not always tiled). It seems to happen when the machine is processing most intensively (i.e., usually when the imagery is being rendered by ka-Map). It also seems to be limited to the laptop I am using, which is running F7-x86_64. In contrast, I have an actual server (F8-x86_64), which has a virtually identical setup (with respect to MapServer and its various dependencies), but with lots more cpu cores and ram, and it's having no trouble at all (as far as I have noticed). The corruption in the output from the same application my laptop is not always the same - if I clear the cache for ka-Map and re-render the images, I'll get similar artifacts appearing in the output (red, green, blue and/or black rectangles), but they will vary in size and location. It happens for both GD/AGG drivers, and JPEG/PNG output formats. Until now, I figured it was just a problem with limited memory on my laptop (it was always around 100% when rendering this imagery on the web service + viewing the application in a browser), but now I've upgraded the ram - there's plenty of spare room and I'm still getting the same problem. I just finished upgrading Gdal from 1.5.0 to 1.5.2, and that didn't help any. Basically, the only real differences I can think of between my laptop and my server are the number of cpu cores (1 on my laptop vs. 8 on the server), and possibly the versions of some of the underlying libraries in the system. Does anyone know where I should start looking to find the cause of this? Or perhaps somebody recognizes this problem, and knows what I might be doing wrong... Thanks for any suggestions, Mike ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] Projection of shape objects in MapScript
Hello, I have what I hope is an easy question: when I extract shapes from query results in PHP MapScript, what projection would the shape be in? The map object usually has its own projection defined, as can the layer object...and then there's the data source itself (presumably the same as the layer object). So if I produce WKT from the shapeObj::toWkt() function, which reference system will the coordinates be in? I know I could figure this out on my own through experimentation, but I'm hoping someone already knows the answer. If it's in the documentation, then I've missed it...and I didn't turn anything up with a few web searches. Thanks for any help, Mike ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] mapscript querybypoint on tiled raster layers?
Hello list, I'm sure this one has come up before, but I can't seem to figure out what I need to do. I have some tiled raster layers that I've got in a mapfile that is being used for generating ka-map tiles. I'm trying to query the values on these layer using the queryByPoint function in php_mapscript. I have a generic identify function that returns results for any of my vector layers, and for non-tiled raster layers - just not for the tiled raster layers. Is it possible to query tiled raster layers? If so, can someone spot what I'm doing wrong below? The tiled-raster layers in the mapfile generally look like this: LAYER NAME Tiled Raster GROUP Tiled Raster STATUS ON TYPE RASTER TILEINDEX /data/index.shp TILEITEM LOCATION METADATA imageformat AGG_JPEG END PROJECTION init=epsg:4326 END END And here is the function in PHP: public function Identify($oMap,$layer,$x,$y,$cellSize) { $oLayer = $oMap-getLayerByName($layer); if (in_array($oLayer-type, array(MS_LAYER_POINT,MS_LAYER_LINE,MS_LAYER_POLYGON))) { $oLayer-set(toleranceunits,$oMap-units); $oLayer-set(tolerance,$cellSize*3); } else { $oLayer-set(tolerance,0); } $oLayer-set(template,dummy.html); $oQPoint = ms_newPointObj(); $oQPoint-setXY($x,$y); $aResults = array(); if (@$oLayer-queryByPoint($oQPoint,MS_MULTIPLE,$oLayer-tolerance) == MS_SUCCESS) { $oLayer-open(); $nResults = $oLayer-getNumResults(); for ($i=0;$i$nResults;$i++) { $oResult = $oLayer-getResult($i); $oShape = $oLayer-getShape($oResult-tileindex, $oResult-shapeindex); $aResults[] = array($oResult,$oShape); } } return $aResults; } Thanks in advance for any help, Mike ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] Re: mapscript querybypoint on tiled raster layers?
Ok...I figured out the problem pretty much right after I clicked send on that last message. I had generated my tile index.shp with relative paths for the LOCATION field (i.e., relative to the shp file). I just regenerated it with absolute path names, and it the query function works fine. So would this be a known bug of any sort, or is it just bad practice to use relative filenames with MapServer? Regards, Mike Mike Leahy wrote: Hello list, I'm sure this one has come up before, but I can't seem to figure out what I need to do. I have some tiled raster layers that I've got in a mapfile that is being used for generating ka-map tiles. I'm trying to query the values on these layer using the queryByPoint function in php_mapscript. I have a generic identify function that returns results for any of my vector layers, and for non-tiled raster layers - just not for the tiled raster layers. Is it possible to query tiled raster layers? If so, can someone spot what I'm doing wrong below? The tiled-raster layers in the mapfile generally look like this: LAYER NAME Tiled Raster GROUP Tiled Raster STATUS ON TYPE RASTER TILEINDEX /data/index.shp TILEITEM LOCATION METADATA imageformat AGG_JPEG END PROJECTION init=epsg:4326 END END And here is the function in PHP: public function Identify($oMap,$layer,$x,$y,$cellSize) { $oLayer = $oMap-getLayerByName($layer); if (in_array($oLayer-type, array(MS_LAYER_POINT,MS_LAYER_LINE,MS_LAYER_POLYGON))) { $oLayer-set(toleranceunits,$oMap-units); $oLayer-set(tolerance,$cellSize*3); } else { $oLayer-set(tolerance,0); } $oLayer-set(template,dummy.html); $oQPoint = ms_newPointObj(); $oQPoint-setXY($x,$y); $aResults = array(); if (@$oLayer-queryByPoint($oQPoint,MS_MULTIPLE,$oLayer-tolerance) == MS_SUCCESS) { $oLayer-open(); $nResults = $oLayer-getNumResults(); for ($i=0;$i$nResults;$i++) { $oResult = $oLayer-getResult($i); $oShape = $oLayer-getShape($oResult-tileindex, $oResult-shapeindex); $aResults[] = array($oResult,$oShape); } } return $aResults; } Thanks in advance for any help, Mike ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users