[mapserver-users] Layer Object Parameter Substitution from URLusing GIS

Heiko Schröter schroete at iup.physik.uni-bremen.de
Tue Apr 7 01:02:57 PDT 2009


On Montag, 6. April 2009 19:57:19 you wrote:

Thanks very much. Will check that out. Runtime substitution might not be an 
option since the values are passed from OpenLayer. What i have figured out OL 
passes the params in the URL.

Heiko

> You'll need to use 5.4 to get this functionality. That version add
> support to allow you to define
> validation strings to lock down what values can be passed for the
> variable. Another solution is
> to consider using runtime substitution to do something similar. That
> works well if the SQL is
> pretty much fixed:
>
>  FILTER 'wert=%myval%'
>
> It's also easier to secure.
>
> Steve
>
> >>> On 4/6/2009 at 4:01 AM, in message
>
> <200904061101.54781.schroete at iup.physik.uni-bremen.de>, Heiko Schröter
>
> <schroete at iup.physik.uni-bremen.de> wrote:
> > Hello,
> >
> > when passing a 'FILTER' parameter to be changed with the URL to use
>
> GIS
>
> > requests, mapserv(5.0.3) fails with:
> > loadLayer(): Unknown identifier. Parsing error near (FILTER):(line
>
> 1)
>
> > The call is:
> >
> > http://localhost/cgi-bin/mapserv?MAP=/MapServer/country98/heiko1.map&
> >
> > LAYERS=karte,grid,psc&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&
> > STYLES=&EXCEPTIONS=application/vnd.ogc.se_inimage&
> > FORMAT=image/png&
> > SRS=epsg:4326&BBOX=-180,7.91,-82.08,105.83&
> > WIDTH=256&HEIGHT=256&
> > MAP.LAYER[psc].FILTER='wert=0'
> > (Linebreaks included for readability)
> >
> > When omitting this part: " MAP.LAYER[psc].FILTER='wert=0'  "  the map
>
> is
>
> > generated fine (without the proper GIS data of course).
> >
> > I did read several comments in the archive and the net about this
>
> issue but
>
> > haven't found a solution to this problem.
> > What do i miss here ?
> >
> > Thanks and Regards
> > Heiko
> >
> >
> > The Mapfile:
> > MAP
> > 	NAME WELT
> >         DEBUG ON
> > 	STATUS ON
> > 	#SIZE 647 320
> >         SIZE 800 400
> > 	IMAGETYPE PNG24
> > 	IMAGECOLOR 240 240 240
> > 	SHAPEPATH "data"
> >         EXTENT -180 -90 180 90
> > 	UNITS DD
> > 	WEB
> > 		IMAGEPATH "images"
> > 		IMAGEURL "images"
> > 		MINSCALE 50000
> > 		MAXSCALE 400000000
> > 		METADATA
> > 			"wms_title" "Example WMS Server"
> > 			"wms_onlineresource"
>
> "http://localhost/cgi-bin/mapserv?map=heiko.map&"
>
> > 			"wms_srs" "epsg:4326 epsg:32661 epsg:32761"
> > 		END
> > 	END
> > 	SYMBOL
> > 		NAME 'circle'
> > 		TYPE ELLIPSE
> > 		POINTS 1 1 END
> > 		FILLED TRUE
> > 	END
> > 	SYMBOL
> > 		NAME 'star'
> > 		TYPE VECTOR
> > 		FILLED TRUE
> > 		POINTS
> > 		      0 .375
> > 		      .35 .375
> > 		      .5 0
> > 		      .65 .375
> > 		      1 .375
> > 		      .75 .625
> > 		      .875 1
> > 		      .5 .75
> > 		      .125 1
> > 		      .25 .625
> > 		END
> > 	END
> > 	PROJECTION
> > 		"init=epsg:4326"
> > 	END
> > 	LAYER
> > 		NAME "karte"
> > 		TYPE POLYGON
> > 		STATUS ON
> >                 OPACITY 50
> > 		DATA "cntry98"
> >                 METADATA
> >                   "wms_title" "karte layer"
> >                   "DESCRIPTION" "Grid"
> >                 END
> > 		PROJECTION
> > 		    "init=epsg:4326"
> > 		END
> > 		CLASS
> > 			NAME "karte_color"
> > 			OUTLINECOLOR 60 60 60
> > 			COLOR 100 100 100
> > 			SYMBOL 0
> > 		END
> > 	END
> > 	LAYER
> > 	   NAME "grid"
> > 	   OPACITY 60
> > 	   METADATA
> > 		"wms_title" "grid layer"
> > 		"DESCRIPTION" "Grid"
> > 	   END
> > 	   TYPE LINE
> > 	   STATUS ON
> > 	   PROJECTION
> > 		"init=epsg:4326"
> > 	   END
> > 	   CLASS
> > 		NAME "Graticule"
> > 		COLOR 0 0 0
> > # Labels comented out for readabilty in the moment
> > #		LABEL
> > #			COLOR 0 0 0
> > #			#FONT "fritqat"
> > #			#TYPE truetype
> > #                        MINDISTANCE 1000
> > #			SIZE SMALL
> > #			POSITION LR
> > #			PARTIALS FALSE
> > #			BUFFER 5
> > #			OUTLINECOLOR 200 200 200
> > #		END
> > 	   END
> > 	   GRID
> > 		LABELFORMAT "DD"
> > 		# LABELFORMAT '%g°' # dec degrees with symbol
> >                 # MINARCS 1
> > 		MAXARCS 1
> >                 MININTERVAL 30
> > 		MAXINTERVAL 60
> > 		# MINSUBDIVIDE 100
> > 		MAXSUBDIVIDE 300
> > 		# LABELFORMAT ’%7.0f m’ # nice if a projected SRS
>
> used
>
> > 		# MININTERVAL 20000
> > 		# MAXSUBDIVIDE 2
> > 	   END
> >  	END # Layer
> >
> > 	LAYER
> > 		NAME "psc"
> > 		CONNECTIONTYPE POSTGIS
> > 		OPACITY 80
> > 		STATUS ON
> > 		METADATA
> > 			"wms_title" "psc layer"
> > 		END
> > 		PROJECTION
> > 			"init=epsg:4326"
> > 		END
> > 		CONNECTION "user=fum password=xyz dbname=foo
>
> host=localhost"
>
> > 		DATA "geocenter from scia_psc"
> > 		FILTER "wert=1"
> > 		TYPE POINT
> > 		CLASS
> > 			COLOR 250 10 10
> > 			SYMBOL "circle"
> > 			SIZE 7
> > 		END
> >         END
> > 	LAYER
> > 		CONNECTIONTYPE POSTGIS
> > 		NAME "nlc"
> > 		OPACITY 80
> > 		STATUS ON
> > 		METADATA
> > 			"wms_title" "nlc layer"
> > 		END
> > 		PROJECTION
> > 			"init=epsg:4326"
> > 		END
> > 		CONNECTION "user=fum password=xyz dbname=foo
>
> host=localhost"
>
> > 		DATA "geocenter from scia_nlc"
> > 		FILTER "wert=1"
> > 		TYPE POINT
> > 		CLASS
> > 			COLOR 10 250 10
> > 			SYMBOL "star"
> > 			SIZE 7
> > 		END
> > 	END
> > 	LAYER
> > 		CONNECTIONTYPE POSTGIS
> > 		NAME "stro3"
> > 		OPACITY 80
> > 		STATUS ON
> > 		METADATA
> > 			"wms_title" "stro3 layer"
> > 		END
> > 		PROJECTION
> > 			"init=epsg:4326"
> > 		END
> > 		CONNECTION "user=fum password=xyz dbname=foo
>
> host=localhost"
>
> > 		DATA "geocenter from scia_stro3"
> > 		FILTER "wert=1"
> > 		TYPE POINT
> > 		CLASS
> > 			COLOR 10 10 250
> > 			SYMBOL "circle"
> > 			SIZE 7
> > 		END
> > 	END
> > END # Ende Map
> >
> > _______________________________________________
> > mapserver-users mailing list
> > mapserver-users at lists.osgeo.org
> > http://lists.osgeo.org/mailman/listinfo/mapserver-users





More information about the MapServer-users mailing list