[postgis-users] Create View with PostGis table

Heiko.Kehlenbrink at vermes.fh-oldenburg.de Heiko.Kehlenbrink at vermes.fh-oldenburg.de
Thu Nov 13 23:40:47 PST 2003


Quoting OpenGis <opengis at libero.it>: 
 
Hi all, 
 
for me something like : 
. 
. 
. 
DATA "the_geom from v_land_t as foo USING UNIQUE oid USING SRID=[your srid]" 
. 
. 
. 
 
works well with adressing views in the mapserver. 
 
regards  
 
heiko 
 
 
> Thanks every one! 
> [1] 
> CREATE VIEW only_pg_land_use AS SELECT t0.oid, t0.* FROM landusea_region 
> t0; 
> Work fine! 
>  
> >My landusea_region table: 
> >Field		Type 
> >gid 		int4  
> >polygon_id 	int8  
> >name 		varchar  
> >langcode 	varchar  
> >type 		varchar  
> >city 		varchar  
> >the_geom 	geometry 
> > 
> But it's not enough! 
> I found another trouble next step: 
> I try to perform view with a condition like: 
> [2] 
> test=> CREATE VIEW v_pG_w AS SELECT t0.oid, t0.* FROM landusea_region t0 
>  
> where gid < 10; 
> CREATE VIEW 
> or 
> [3] 
> test=> CREATE VIEW v_land_t AS SELECT t0.oid, t0.*, num_pop FROM  
> landusea_region t0, tab_zu where t0.name= tab_zu.nm; 
> CREATE VIEW 
>  
> -- both run OK in psql & in phpPgAdmin 
>  
> Instead doesn't work with this mapfile: 
> LAYER 
>     NAME LandUseA_region 
> #    DATA LandUseA_region                               # original shape 
>  
> file -- work fine 
>     CONNECTIONTYPE postgis 
>     CONNECTION "user=pg_user password=pg_passwd dbname=test 
> host=linux_box" 
> #    DATA "the_geom from landusea_region"        # OK (table from 
> shp2pgsql) 
> #    DATA "the_geom from only_pg_land_use"     # OK (view from previous 
>  
> tab with oid column) [1] 
>     DATA "the_geom from v_pg_w"                      # NO ERROR NO  
> DISPLAY [2] 
> #    DATA "the_geom from v_land_t"                   # NO ERROR NO  
> DISPLAY [3] 
>  
> When I run mapserver I've map with all layer less LandUseA_region 
> layer 
> and It's very strange there isn't any error!? 
>  
> It's a big problem because only in [2] I can use FILTER in mapfile, but 
>  
> in [3] I need to perform where condition before mapfile in order to  
> obtain data from another table. 
>  
> I think that where condition lose geometry data type. It's right? How  
> can resolve [3]? 
>  
> Have you any advice? 
>  
> Thanks in advance 
>  
> --  
> opengis (at) libero (dot) it 
> AOL: open2gis 
>  
>  
>  
> _______________________________________________ 
> postgis-users mailing list 
> postgis-users at postgis.refractions.net 
> http://postgis.refractions.net/mailman/listinfo/postgis-users 
>  
>  



More information about the postgis-users mailing list