[mapserver-users] Re: showing certain classes selected via cgi

Puneet Kishor punk.kish at gmail.com
Thu Oct 27 11:34:30 EDT 2011


Seems like I *can* do the following per the docs at http://mapserver.org/cgi/runsub.html (more below)
On Oct 27, 2011, at 8:56 AM, Puneet Kishor wrote:

> (I thought I had asked this question and received and answer, but can't find it now... maybe I just dreamed it and never did ask. Here goes...)
> 
> 
> I have a map with a layer with 100s of classes. I want to send a class name via the URI, and get back a map of only that class. So, the following will return the map with all the classes
> 
> 	http://server/map
> 
> and, the following will return the map with only foo and bar classes
> 
> 	http://server/map?classes=foo,bar
> 
> The above URI pattern is just a suggestion. How can I achieve the above?
> 
> One thought comes is to split the layer with 100s of classes into 100s of layers each with one class.
> 
> In any case, what is the advised way forward?
> 
> 

So, I tried the following

	CONNECTION "host=localhost port=5432 dbname=macromap user=postgres password=postgres"
	CONNECTIONTYPE POSTGIS
	PROCESSING "CLOSE_CONNECTION=DEFER"
	DATA "the_geom FROM table USING UNIQUE gid USING srid=4326"
	FILTER "class_name = '%class%'"

	METADATA
		'class_name_validation_pattern' '^[A-Za-z]+$'
	END

And, requested the map at http://server/cgi-bin/app?mode=map&layers=layer&class=Foo but got the following error --

	select "interval_name",encode(ST_AsBinary(ST_Force_2D("the_geoms"),'NDR'),'hex') as geom,
	"gid" from table where the_geom && GeomFromText('POLYGON((-180.150250417362 -90,-180.150250417362 
	90,180.150250417362 90,180.150250417362 -90,-180.150250417362 -90))',4326) and 
	(class_name = '%class%')

So, %class% didn't get interpolated into the requested value. What am I doing wrong?

--
Puneet Kishor


More information about the mapserver-users mailing list