I've searched for answer for the last couple of days with no success.
When I click on an object on the screen I get this reply from the server:
http://localhost/cgi-bin/mapserv.exe?LAYERS=testpoint&QUERY_LAYERS=testpoint&STYLES=&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetFeatureInfo&BBOX=517948%2C157505%2C535448%2C170005&FEATURE_COUNT=1&HEIGHT=500&WIDTH=700&FORMAT=image%2Fpng&INFO_FORMAT=text%2Fhtml&SRS=EPSG%3A27700&X=357&Y=241&MAP=%2FWorkTemp%2Ftest.map
Following this link returns the value for the object I just picked. I get no errors in the MapServer or OpenLayers log file.
OpenLayers code:
layer = new OpenLayers.Layer.WMS( "WMS data","http://localhost/cgi-bin/mapserv.exe?", {layers: 'testpoint' , map: '/WorkTemp/test.map', transparent: true},{isBaseLayer: false, opacity: 1, singleTile: true, visibility: true});
osMap.addLayer(layer);
info = new OpenLayers.Control.WMSGetFeatureInfo({
url: 'http://localhost/cgi-bin/mapserv.exe?',
title: 'Identify features by clicking',
queryVisible: true,
maxFeatures: 1,
vendorParams: {
map: '/WorkTemp/test.map'
} ,
info_format: 'text/html',
layers: [layer],
eventListeners: {
getfeatureinfo: function(event) {
if(event.features.length > 0) {
osMap.addPopup(new OpenLayers.Popup.FramedCloud(
"chicken",
osMap.getLonLatFromPixel(event.xy),
null,
event.text,
null,
true
));
}
}
}
});
osMap.addControl(info);
info.activate();
test.map layer
LAYER
NAME "testpoint"
TYPE POINT
STATUS ON
CONNECTIONTYPE OGR
CONNECTION "MYSQL:test,host=localhost,user=root,password=xxxxxx,port=3306"
DATA "SELECT SHAPE,test from testpoint"
DUMP TRUE
TEMPLATE "c:\WorkTemp\test_template.html"
LABELITEM "test"
PROJECTION
"init=epsg:27700"
END
CLASS
NAME "test"
STYLE
SYMBOL 'circle'
SIZE 10
COLOR 255 215 0
END
LABEL
COLOR 0 0 0
FONT arial
TYPE truetype
SIZE 8
POSITION AUTO
PARTIALS FALSE
OUTLINECOLOR 255 255 255
END
END
END # layer
This appears to be the same problem that I'm having:- Use OpenLayers WMSGetFeatureInfo on Mapserver Layer?, but I have already set my WMS layer to be OpenLayers.Layer.WMS
I downloaded and installed OSGEO4W as my starting point. I'm calling http://openspace.ordnancesurvey.co.uk/osmapapi/openspace.js for my OpenLayers commands.
Any suggestions would be gratefully appreciated.