Hi Edu, that shouldn't be neccesary as when a table is declared without
a schema name, it is put/looked up in the public schema anyway???
Though..., I myself am doing some testing and have a DATA string like:
DATA 'the_geom FROM (select *, oid from "public"."testpoints") as foo
using unique oid using SRID=28992'
(so I DO use the public schema string?), try and see.
Some other tests/things you can do:
- either in psql or in pgadmin3, connect to the same database as the
same user as you have in your mapfile and try to fire the DATA-query
select string and see if that results in your records/geometries.
- do you have something like:
CONNECTIONTYPE postgis
CONNECTION "host=localhost dbname=testgis password='xxxx' user=user"
in your mapfile? (probably anyway, otherwise you should get those
errormessages...)
- I 'wrote' my first postgresql-mapfile by using the free qgis
(http://qgis.org/) to connect to the database, and then use the option
'Export to Mapserver Map' to write a starting for a mapfile. It's a very
fine tool for viewing postgis data!
- you are sure you can see all functions and casts in the database you
are using? You have to use the scripts for every db you have. pgadmin3
shows you all functions and casts in a nice and easy way for a given
database.
Ok that's all I know :-) Good luck.
Richard
Edu Montaña wrote:
Hello Steven and Richard, thanks for yours quick responses.
In answer to Steven, yes I have in my .map file the WEB sentence like
following:
WEB
METADATA
"wms_title" "Map File 01"
"wms_fees" "none"
"wms_onlineresource"
"http://127.0.0.1:81/cgi-bin/mapserv40/mapserv?map=/usr/local/apache2/htdocs/mapfile_01.map&"
"wms_latlonboundingbox" "-180,-180,180,180"
"wms_formatlist"
"image/gif,image/png,image/jpg,image/jpeg,image/tif,image/bmp"
END
IMAGEPATH "/tmp/"
LOG "/usr/local/apache2/logs/mapserver.log"
END
In answer to Richard, yes when I installed postgis, I executed:
psql -d [yourdatabase] -f lwpostgis.sql
and
psql -d [yourdatabase] -f spatial_ref_sys.sql
Watching several post with errors similar to mine , I don't know if it
can be because I don't have append in front of the table name the schema
public:
DATA "the_geom from layer_07"
I have't been able to prove this last one.
Best regards,
Edu
From: Richard Duivenvoorde <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
CC: Steven De Vriendt <[EMAIL PROTECTED]>,
[email protected]
Subject: Re: [UMN_MAPSERVER-USERS] [postgis-users] help with WMS query
Mapserver and postgis
Date: Sat, 10 Mar 2007 15:33:40 +0100
Hi Edu,
did you run the proper scripts in the debian postgresql-8.1-postgis
package, as described in the README.Debian.gz? :
quote:
NOTE: To install PostGIS you must run the lwpostgis.sql script in each
PostgreSQL database you want PostGIS in as the PostgreSQL superuser
(generally the 'postgres' user)! The Debian utilities do not do
this automatically as they can't be sure what state your database is
in,
what database(s) you would want PostGIS installed in, or how to
authenticate as the PostgreSQL superuser to your database. It is
likely
that a PostGIS user would also want the Spatial References installed
and
so it is recommended that the spatial_ref_sys.sql also be run in each
database you have PostGIS installed in.
For me it looks like you either miss the spatial functions, or casts
which are defined in these scripts? See the error:
'ERROR: function setsrid(box3d, integer) does not exist HINT: No
function matches the given name and argument types. You may need to
add explicit type casts. '
Hope this helps.
Richard
Steven De Vriendt wrote:
Edu,
Have you declared the WEB-parameter in your map-file ?
Should be something like this:
WEB
IMAGEPATH "c:/ms4w/tmp/ms_tmp/"
IMAGEURL "/ms_tmp/"
METADATA
"wms_title" "Aalter_WMS"
"wms_onlineresource"
"http://localhostcgi-bin/mapserv.exe?map=/ms4w/apps/chameleon/samples/map/wmsserver.map&"
"wms_srs" "EPSG:31300"
END
END
You have to define this before using mapserver as WMS-server.
Regards,
Steven
On 3/10/07, Edu Montaña <[EMAIL PROTECTED]> wrote:
Hello, I'm newbie in mapserver and postgis, and I have a problem that I
don't know how to fix it. I have installed mapserver in a debian
system with
postgis, but when I make a request WMS I obtain the following error:
msDrawMap(): Image handling error. Failed to draw layer named
'layer_07'.
prepare_database(): Query error. Error executing POSTGIS DECLARE
(the actual
query) statement: 'DECLARE mycursor BINARY CURSOR FOR SELECT
asbinary(force_collection(force_2d(the_geom)),'NDR'),gid::text from
layer_07
WHERE the_geom && setSRID('BOX3D(63208.0999421528
4203763.49990343,404291.899999981 4487999.99999998)'::BOX3D,
find_srid('','layer_07','the_geom') )' Postgresql reports the error as
'ERROR: function setsrid(box3d, integer) does not exist HINT: No
function
matches the given name and argument types. You may need to add
explicit type
casts. ' More Help: Error with POSTGIS data variable. You specified
'check
your .map file'. Standard ways of specifiying are : (1)
'geometry_column
from geometry_table' (2) 'geometry_column from (sub query) as foo using
unique column name using SRID=srid#' Make sure you put in the 'using
unique
column name' and 'using SRID=#' clauses in. For more help, please see
http://postgis.refractions.net/documentation/ Mappostgis.c - version
of Jan
23/2004.
I don't understand this error because I have defined in my database the
function setsrid.
I tried to define in the data declaration in my .map file the
following:
DATA "the_geom from layer_07 using unique the_geom using
SRID=23030"
but it doesn't work.
My WMS query is:
http://192.168.0.66:80/cgi-bin/mapserv40/mapserv?map=/usr/local/apache2/htdocs/mapservertest.mapSERVICE=WMS&Request=GetMap&LAYERS=layer_07&format=image/jpeg&bbox=222966.0,4416557.0,223027.0,4416597.0&srs=EPSG:23030&styles=default&VERSION=1.1.1&Height=600&Width=500
My layer declaration on the .map file is the following:
LAYER
NAME "layer_07"
TYPE POLYGON
STATUS ON
CONNECTIONTYPE POSTGIS
CONNECTION "host=192.168.0.147 dbname=testdb
user=postgres
password=postgres port=5432"
DATA "the_geom from layer_07"
TRANSPARENCY 25
CLASS
NAME 'layer_07'
COLOR 188 229 193
OUTLINECOLOR 0 0 0
END
METADATA
"wms_name" "layer_07"
"wms_title" "Layer 07."
END
PROJECTION
"init=epsg:23030"
END
END
I hope that your can help me, it very urgent.
Thanks in advance
P.D.: Sorry for my poor english
_________________________________________________________________
Acepta el reto MSN Premium: Protección para tus hijos en internet.
Descárgalo y pruébalo 2 meses gratis.
http://join.msn.com?XAPID=1697&DI=1055&HL=Footer_mailsenviados_proteccioninfantil
_______________________________________________
postgis-users mailing list
[EMAIL PROTECTED]
http://postgis.refractions.net/mailman/listinfo/postgis-users
_________________________________________________________________
Grandes éxitos, superhéroes, imitaciones, cine y TV...
http://es.msn.kiwee.com/ Lo mejor para tu móvil.