[mapserver-users] why doesn't a view work in the data string?

Mr. Puneet Kishor punk.kish at gmail.com
Sat Sep 3 20:18:18 EDT 2011


Another oddity about MapScript. I have the PostGIS functions and definitions installed in the public schema of my db. I have moved the data tables to different schema to keep things tidy. I modified the search_path like so

ALTER DATABASE mydb SET search_path = public, data1, data2;

The following works fine, which is strange because I would expect it to require the schema prefix (in spite of having modified the search_path, I require the prefix in other clients, such as pgAdmin3) --

$layer_one->{data} = 'the_geom FROM (SELECT gid, class_name, class_color, the_geom FROM table) a_view USING UNIQUE gid';
$layer_one->setFilter('gid NOT IN ( .. a bunch of gids .. )');

Yet, if I make a view with the above logic like so

CREATE VIEW data1.a_view AS
	SELECT gid, class_name, class_color, the_geom 
	FROM data1.table 
	WHERE gid NOT IN ( .. a bunch of gids .. );
	
and use that to access the data with the following code, I get a crash "prepareImage() error: Can't call method 'save' on an undefined value"

$layer_one->{data} = 'the_geom FROM a_view USING UNIQUE did';


--
Puneet Kishor


More information about the mapserver-users mailing list