FW: [UMN_MAPSERVER-USERS] postgis schema

Terence Maru terence at WAIROADC.GOVT.NZ
Sun Sep 2 22:35:55 EDT 2007


 
Hi Barend, doesn't work for me.

<Mapscript - begin>
$parcelLayer = ms_newLayerObj($map);
$parcelLayer->set("connectiontype", MS_POSTGIS);
$parcelLayer->set("name", "parcels");

$connector = "user=web dbname=districts host=localhost";
$parcelLayer->set("connection", $connector);

$sql = "the_geom from hbDistrict.parcels";
$parcelLayer->set("data", $sql);
$parcelLayer->set("status", MS_DEFAULT);
$parcelLayer->set("type", MS_LAYER_POLYGON);
<Mapscript - end>

<Error - begin>
Warning: [MapServer Error]: prepare_database(): 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 hbDistrict.parcels WHERE the_geom && setSRID('BOX3D(-180 -90,180 90)'::BOX3D, find_srid('','hbDistrict.parcels','the_geom') )' Postgresql reports the error as 'ERROR: function force_2d(hbDistrict.geometry) does not exist LINE 1: ...INARY CURSOR FOR SELECT asbinary(force_collection(force_2d(t... ^ 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.
<Error - end>

I have a database called districts, a schema called hbDistrict and a table called parcels.  I cannot set the search_path by using the data variable with "the_geom from hbDistrict.parcels".  I have created another database called test.  This database is created without schema's (public schema).  The data variable "the_geom from parcels" works (by works, I mean no errors).

bm


-----Original Message-----
From: Barend Köbben [mailto:kobben at itc.nl] 
Sent: Monday, 3 September 2007 2:08 p.m.
To: Terence Maru
Subject: Re: [UMN_MAPSERVER-USERS] postgis schema

Just use the normal SQL 'prefixing' where eg. public.mytable is the table in the public schema, or myschema.mytable the same in another schema...


__
Barend Köbben
International Institute for Geo-information Sciences and Earth Observation (ITC) PO Box 6, 7500AA Enschede (The Netherlands)
ph: +31 (0)53 4874253; fax: +31 (0)53 4874335



On 03-09-2007 03:50, "Terence Maru" <terence at WAIROADC.GOVT.NZ> wrote:

> Hi all, im trying to connect to a postgres/postgis database.  The
> connection process defines the database to connect to.  The data
> variable defines the table and column (the_geom) to connect to.  How do
> I tell mapserver to use a certain schema?  Thanks.
>  
> bm
> 
> ##############################################################################
> #######
> This e-mail message has been scanned for Viruses by McAfee and content has
> been cleared by MailMarshal
> ##############################################################################
> #######

#####################################################################################
This e-mail message has been scanned for Viruses by McAfee and content has
been cleared by MailMarshal
#####################################################################################



More information about the mapserver-users mailing list