[postgis-users] help with WMS query Mapserver and postgis

Richard Duivenvoorde rdmailings at DUIF.NET
Sat Mar 10 09:33:40 EST 2007


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 <edumon20 at hotmail.com> 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
>> postgis-users at postgis.refractions.net
>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>>
> 
> 
> 



More information about the mapserver-users mailing list