[OpenLayers-Users] getFeatureInfo problem
vrbikdan
vrbikdan at gmail.com
Tue Mar 15 17:56:00 EDT 2011
Hi,
I have a problem with getFeatureInfo. I tried several ways of set it, but
nothing work. My problem is, that I want if I click on some point in the map,
that in some div will show some information about this point. I use this code I
found here http://openlayers.org/dev/examples/getfeatureinfo-control.html :
infoControls = {
click: new OpenLayers.Control.WMSGetFeatureInfo({
url: 'http://localhost:8080/geoserver/wms',
title: 'Identify features by clicking',
layers: [bodyVsechny],
queryVisible: true
})
};
for (var i in infoControls) {
infoControls[i].events.register("getfeatureinfo", this, showInfo);
map.addControl(infoControls[i]);
};
infoControls.click.activate();
function showInfo(evt) {
if (evt.features && evt.features.length) {
highlightLayer.destroyFeatures();
highlightLayer.addFeatures(evt.features);
highlightLayer.redraw();
} else {
$('infoDiv').innerHTML = evt.text;
}
};
But if i click on some point, nothing happend and java console write me this but
I can't follow:
XMLHttpRequest cannot load http://localhost:8080/geoserver/wms?
SERVICE=WMS&VERSION=1.1.1&REQUEST=GetFeatureInfo&LAYERS=dp%3Adp1&QUERY_LAYERS=dp
%3Adp1&STYLES=&BBOX=1643701.855782%2C6571405.975387%2C1741541.25197%2C6623765.33
9753&FEATURE_COUNT=10&HEIGHT=685&WIDTH=1280&FORMAT=image%2Fpng&INFO_FORMAT=text%
2Fhtml&SRS=EPSG%3A900913&X=437&Y=470. Origin null is not allowed by Access-
Control-Allow-Origin.
GET http://localhost:8080/geoserver/wms?
SERVICE=WMS&VERSION=1.1.1&REQUEST=GetFeatureInfo&LAYERS=dp%3Adp1&QUERY_LAYERS=dp
%3Adp1&STYLES=&BBOX=1643701.855782%2C6571405.975387%2C1741541.25197%2C6623765.33
9753&FEATURE_COUNT=10&HEIGHT=685&WIDTH=1280&FORMAT=image%2Fpng&INFO_FORMAT=text%
2Fhtml&SRS=EPSG%3A900913&X=437&Y=470 undefined (undefined)
Please, can you help me? I'm quite desperate :(
Thanks, Dan
P.S. I don't know, what I should write here, what do you need to see from my
code...
More information about the Users
mailing list