[mapserver-users] Query feature using openlayers and mapserver

Aypes apestgas at yahoo.com.hk
Thu Oct 29 02:13:54 EDT 2009

Dear all, 

I might open a topic in a wrong forum, because I do not know whether I
should ask this question in Mapserver or OpenLayers forum. If I did, I feel
sorry about that. 

I want to query the layer with using openlayers. However, I do not know how
to 'call' the templates from mapfile to the html file.I have found topics
about query using mapserver and openlayers, but I have still no idea how to
code in html file. The query function is fine when using mapserver alone. 

In the mapfile, I have put metadata into web like this: 
        HEADER "/ms4w/Apache/htdocs/web_header.html" 
        FOOTER "/ms4w/Apache/htdocs/web_footer.html" 
        EMPTY  "empty.html" 
        "wms_title" "WMS" 
        "wms_srs"       "EPSG:4269" 
        "wms_feature_info_mime_type" "text/html" 
        template "/ms4w/Apache/htdocs/web.html" 
        imagepath "/ms4w/Apache/htdocs/tmp/" 
        imageurl "/tmp/" 

And in the layer, data from postgresql postgis (with attribute ID) was used
with metadata: 
Name "Abc" 
                "wms_title" "Abc" 
                "wms_srs" "EPSG:4269" 

I also have put header footer in layer and template in the class 
        Name "abc" 
        Template "/ms4w/Apache/htdocs/query.html" 

The code in html file: 
var layer = new OpenLayers.Layer.MapServer( "ABC WMS",   
        {layers: 'Abc'} ); 
I tried {layers: 'Abc', mode: 'query', params ='ID'}  but it did not work. 

I found an example of query: http://www.co.sweet.wy.us/mapserver/map.html
I want to query the layer by a click instead of dragging and a new window
come out to display information. 
How can I make this in html file? 

Furthermore, I find many examples using new OpenLayers.Layer.WMS. But when I
use it, it displays nothing. I can only use new OpenLayers.Layer.MapServer
to display map. What is the problem? 

View this message in context: http://n2.nabble.com/Query-feature-using-openlayers-and-mapserver-tp3910093p3910093.html
Sent from the Mapserver - User mailing list archive at Nabble.com.

More information about the mapserver-users mailing list