[postgis-users] Create View with PostGis table

opengis opengis at libero.it
Tue Nov 11 09:01:33 PST 2003


Howdy,

I need to CREATE VIEW of PostGis table.

My landusea_region table:
Field		Type
gid 		int4 
polygon_id 	int8 
name 		varchar 
langcode 		varchar 
type 		varchar 
city 		varchar 
the_geom 		geometry

Early I try with simple VIEW

test=> CREATE VIEW only_pg_view AS SELECT *  FROM landusea_region;
test=# \dv
           List of relations
 Schema |    Name         | Type |  Owner
--------+------------------+------+----------
 public | only_pg_view | view | postgres
(1 row)

PostGres-PostGis work fine, but when I try to use this view in mapserver with mapfile like:
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"  # work fine
	DATA "the_geom from only_pg_land_use"  #    DOESN’T WORK!!
	STATUS ON
	TYPE POLYGON
	LABELITEM "name"
	LABELMAXSCALE 50000
	CLASS
		TEMPLATE "land.html"
		EXPRESSION ('[type]' = 'PARK (CITY/COUNTY)' )
		NAME 'Urban park'
		COLOR 0 210 0
		LABEL
			COLOR 25 120 50
#			POSITION AUTO
		END
	END
END

I’ve this:
Server error!
The server encountered an internal error and was unable to complete your request. 
Error message: 
Premature end of script headers: mapserv 
If you think this is a server error, please contact the webmaster 
Error 500
linux_box 
mar 11 nov 2003 17:31:31 CET 
Apache/2.0.40 (Red Hat Linux) 



I suppose need INSERT INTO geometry_columns table. I try to duplicate landusea_region record:
f_table_schema f_table_name 	f_geometry_column coord_dimension srid	type 		attrelid varattnum
test		 landusea_region  	the_geom  		2		-1	MULTIPOLYGON  17464   7
in 
 test  only_pg_land_use  the_geom  2   -1   MULTIPOLYGON  17464   7

but mapserver send me same Server error!

Environment
RH9
Mapserver4
Postgres 7.3.2
PostGis 0.5

Any suggest, sample?

Best regards

P.S.
Why I need to CREATE VIEW?
Because I’ve geo-data in PostGres-PostGis table and miscellaneous data in other tables (and other remote db).
With a single VIEW I can map both of them.


---
opengis (at) libero (dot) it
AOL: open2gis




More information about the postgis-users mailing list