[postgis-users] Create View with PostGis table

Obe, Regina DND\MIS robe.dnd at ci.boston.ma.us
Wed Nov 12 05:53:26 PST 2003


I'm confused not sure if you put in the right view definition or a typo or
what, but the view definition you provided is called

only_pg_view

But the view you are trying to use is called 

only_pg_land_use

Those 2 should match correct?





-----Original Message-----
From: opengis [mailto:opengis at libero.it]
Sent: Tuesday, November 11, 2003 12:02 PM
To: postgis-users
Subject: [postgis-users] Create View with PostGis table


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


_______________________________________________
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