[mapserver-dev] How to filter a WMS layer?

Estibaliz estibaliz_yague at donostia.org
Fri Mar 23 02:27:34 PDT 2012


Hello

I'm trying to make a filter in a WMS point layer based on Oracle. 
The result must be: the layer only represents one element (filtered by key).
If possible, with a different symbol.
But I get nothing, the layer is empty. Could you help me please?


That's what I'm trying to do:

	theSLD_BODY = '<?xml version="1.0" encoding="utf-8"?>';
	theSLD_BODY+= '<StyledLayerDescriptor version="1.0.0"
xmlns="http://www.opengis.net/sld" xmlns:gml="http://www.opengis.net/gml"
xmlns:ogc="http://www.opengis.net/ogc"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.opengis.net/sld
http://schemas.opengeospatial.net/sld/1.0.0/StyledLayerDescriptor.xsd">';
	theSLD_BODY+= '<NamedLayer><Name>myLayer</Name>';
	theSLD_BODY+= '<UserStyle><FeatureTypeStyle><Rule>';
	theSLD_BODY+=
'<ogc:Filter><ogc:PropertyIsEqualTo><ogc:PropertyName>KEY</ogc:PropertyName><ogc:Literal>aValue</ogc:Literal></ogc:PropertyIsEqualTo></ogc:Filter>';
	theSLD_BODY+=
'<PointSymbolizer><Size>12</Size><WellKnownName>square</WellKnownName></PointSymbolizer>';
	theSLD_BODY+=
'</Rule></FeatureTypeStyle></UserStyle></NamedLayer></StyledLayerDescriptor>';


	var layNew = new OpenLayers.Layer.WMS( "selectionLayer",
			lyrWMS,
			{   	"layers": "myLayer", 
				"format": "image/png",
				"version": "1.1.1",
				"transparent": "TRUE",
				"SLD_BODY": theSLD_BODY
			});


The layer description is like this:

   LAYER
        NAME        "myLayer"
        STATUS OFF
        TYPE POINT

        CONNECTIONTYPE	ORACLESPATIAL
        CONNECTION		"oraUsr/oraPwd at oraSvc"
        DATA            "GEOM FROM (SELECT KEY, field1,...,fieldn, GEOM FROM
myTable WHERE field1= 'abc' AND field2 = 'abc') USING UNIQUE KEY SRID 82337"
        HEADER      'templates/header.xml'
        TEMPLATE    'templates/template_myTable.xml'
        FOOTER      'templates/footer.xml'
        DUMP True
        PROJECTION
            "init=epsg:23030"
        End
        Class
            SYMBOL "mySymbol"
            NAME    "default"
        END #LAYER/CLASS
        METADATA
            "wms_title" "myLayer"
            "wms_abstract" ""
            "wms_extent" "574570.2661670763 4788626.351657772
589589.1130593527 4798732.780521432"
            "gml_include_items" "all"
        End
    END 



--
View this message in context: http://osgeo-org.1560.n6.nabble.com/How-to-filter-a-WMS-layer-tp4647978p4647978.html
Sent from the Mapserver - Dev mailing list archive at Nabble.com.


More information about the mapserver-dev mailing list