Mapserver queries
From DreamsteepWiki
see also getfeatureinfo
QUERY FEATURE INFO (GETFEATUREINFO)
Untested WFS query
/* highlightFeatures() makes the WFS request, then highlight_them() callback does the real work
* Args for WFS filter: typename, attribute, value
*/
function highlightFeatures(typename,attribute,value) {
var wfsurl = wfs_url + '&REQUEST=getfeature&typename=' + typename +
'&Filter=<Filter><PropertyIsEqualTo><PropertyName>'+attribute+'</PropertyName><Literal>'+value+'</Literal></PropertyIsEqualTo></Filter>';
OpenLayers.loadURL(wfsurl,'',null,highlight_them);
}
function highlight_them(response) {
// use the GML parser to turn the XML into a list of Feature objects
var features = new OpenLayers.Format.GML().read(response.responseText);
// have the Vector layer purge its feature list, replace them with the new ones
hilites.destroyFeatures();
hilites.addFeatures(features);
hilites.setVisibility(true);
};
}
QUERY POSTGIS
LAYER
NAME 'Test_Flaechen'
TYPE POLYGON
CONNECTIONTYPE postgis
CONNECTION 'host='localhost' user='postgres' password='pw...' dbname='WebGIS_Gruen''
DATA 'the_geom FROM public.Test_Flaechen'
#DUMP TRUE
#TEMPLATE '../../ms4w/apps/mapbender/http/html/Templates/template_Baeume.html'
METADATA
'wms_title' 'Test_Flaechen'
'wfs_title' 'Test_Flaechen'
'gml_featureid' 'id'
'gml_include_items' 'all'
END
STATUS DEFAULT
TRANSPARENCY 100
PROJECTION
"init=epsg:4149"
END
CLASS
NAME 'Test_Flaechen'
STYLE
SYMBOL 0
SIZE 10
OUTLINECOLOR 0 0 0
COLOR 150 123 90
END
END
END

