Pierre,<br><br>What do you mean by reading the raster layer as a GDAL layer? In the PostGIS in Action raster example it seemed to just connect to the database, with no query using :<br><br>Data "PG:host=localhost ....."<br>
<br>I tried removing CONNECTION and DATA and using the following:<br><br>DATA "PG:host=18.00.00.00 dbname=raster_analysis user=postgres port=5434 password=password schema='myschema' table='pop_800'"<br>
<br>This did not work either. Should I be just connecting to the data, and not trying to have a query there also?<br><br>-David<br><br><div class="gmail_quote">On Thu, Feb 16, 2012 at 3:31 PM, Pierre Racine <span dir="ltr"><<a href="mailto:Pierre.Racine@sbf.ulaval.ca">Pierre.Racine@sbf.ulaval.ca</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">From what I know there is no way this should work. You have to read the raster layer as a GDAL layer. This is what is done in PostGIS in Action.<br>
<br>
Pierre<br>
<div><div class="h5"><br>
> -----Original Message-----<br>
> From: <a href="mailto:postgis-users-bounces@postgis.refractions.net">postgis-users-bounces@postgis.refractions.net</a> [mailto:<a href="mailto:postgis-users-">postgis-users-</a><br>
> <a href="mailto:bounces@postgis.refractions.net">bounces@postgis.refractions.net</a>] On Behalf Of David Quinn<br>
> Sent: Thursday, February 16, 2012 3:14 PM<br>
> To: PostGIS Users Discussion<br>
> Subject: [postgis-users] Mapserver/Postgis connection and WMS query<br>
><br>
> Hi List,<br>
><br>
> (I did send a very similar question to the mapserver list two days ago but I didn't<br>
> hear any comments or suggestions. This is a problem between mapserver and<br>
> postgis).<br>
><br>
> I'm using mapserver to display some rasters as WMS layers using Openlayers. At<br>
> the moment I have all my rasters in a web-readable folder and it works fine. I<br>
> want to try accessing the rasters using postgis, but I'm not sure exactly how to<br>
> do this. I've read through this <a href="http://mapserver.org/input/vector/postgis.html" target="_blank">http://mapserver.org/input/vector/postgis.html</a><br>
> and the relevant part of PostGIS in Action. My original map file (which worked)<br>
> looked like this:<br>
><br>
> LAYER<br>
> NAME "new_york_pop"<br>
> DATA "/home//htdocs/data/new_york_pop.tif"<br>
> STATUS OFF<br>
> TYPE RASTER<br>
> METADATA<br>
> "wms_title" "WMS new_york Raster"<br>
> "wms_srs" "EPSG:900913"<br>
> END<br>
> END<br>
><br>
> I tried changing this to the following:<br>
><br>
> LAYER<br>
> NAME "new_york_pop"<br>
> TYPE RASTER<br>
> CONNECTIONTYPE POSTGIS<br>
> CONNECTION "host=18.00.00.00 dbname=raster_analysis user=postgres<br>
> password=mypassword port=5434"<br>
> DATA "SELECT ST_AsTIFF(ST_Clip(r.rast, 1, p.geom, NULL, TRUE)) FROM<br>
> us_pop_800 AS r, cities AS p WHERE ST_Intersects(r.rast, p.geom) AND <a href="http://p.name" target="_blank">p.name</a><br>
> = 'new_york'"<br>
> STATUS OFF<br>
> METADATA<br>
> "wms_title" "WMS new_york Raster"<br>
> "wms_srs" "EPSG:900913"<br>
> END<br>
> END<br>
><br>
> I want to clip my raster to the polygon and to display the clipped raster using a<br>
> WMS query. The SQL query runs fine within the SQL console of Postgresql and<br>
> returns a few tiffs, but it does not work on mapserver. My mapserver error log<br>
> shows the following:<br>
><br>
> [Tue Feb 14 12:16:29 <a href="tel:2012%5D.918681" value="+12012918681">2012].918681</a> msDrawMap(): Image handling error. Failed<br>
> to draw layer named 'new_york_pop'.<br>
> [Tue Feb 14 12:16:29 <a href="tel:2012%5D.917535" value="+12012917535">2012].917535</a> msDrawMap(): rendering using<br>
> outputformat named png (AGG/PNG).<br>
> [Tue Feb 14 12:16:29 <a href="tel:2012%5D.918757" value="+12012918757">2012].918757</a> msDrawRasterLayerLow(): Unable to access<br>
> file. Corrupt, empty or missing file 'SELECT ST_AsTIFF(ST_Clip(r.rast, 1, p.geom,<br>
> NULL, TRUE)) FROM us_pop_raster AS r, cities AS p WHERE ST_Intersects(r.rast,<br>
> p.geom) AND <a href="http://p.name" target="_blank">p.name</a> = 'new_york'' for layer 'new_york_pop'.<br>
> [Tue Feb 14 12:16:29 <a href="tel:2012%5D.918766" value="+12012918766">2012].918766</a> msDrawMap(): Image handling error. Failed<br>
> to draw layer named 'new_york_pop'.<br>
><br>
> I would appreciate any suggestions for debugging this. I have connected to the<br>
> postgresql database using a php file from the same location so mapserver<br>
> should have the correct permissions to connect (and my port is 5434, rather than<br>
> the usual 5432).<br>
><br>
> Thank you,<br>
> David<br>
<br>
</div></div>_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a><br>
<a href="http://postgis.refractions.net/mailman/listinfo/postgis-users" target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br>
</blockquote></div><br>