[mapserver-users] ENC: Openlayers Identify Problem
Lime, Steve D (DNR)
steve.lime at state.mn.us
Thu Jun 9 05:26:52 PDT 2011
Looking at the URL it seems to be operating in image coordinates which is fine but there's no image size passed (nor one defined in the mapfile) so my guess
is that MapServer can't turn that click into a real map coordinate. Try adding the imgsize variable to your query call.
Steve
________________________________________
From: mapserver-users-bounces at lists.osgeo.org [mapserver-users-bounces at lists.osgeo.org] On Behalf Of Matheus Lacarini [matheus.lacarini at sntgeo.com.br]
Sent: Thursday, June 09, 2011 7:02 AM
To: mapserver-users at lists.osgeo.org
Subject: [mapserver-users] ENC: Openlayers Identify Problem
Hello all,
I´m from Brasil and i have a problem with the openlayers identify my query its perfect in the mapfile and the layer file but the query result :msQueryByPoint(): Search returned no results. No matching record(s) found.My url is : http://localhost/cgi-bin/mapserv.exe?img.x=762&img.y=433&mode=query&layer=gtile_topodata&map=C:/var/webmapit/mapserver.d/mapfiles/users/sntgeo/sntgeo-map_004.map&imgext=-104.42206737491+-39.398253504337+-2.9560446250874+11.398253504337
Part of my map file :
NAME "sntgeo-map_004_"
EXTENT -95.883434 -35.000146 -11.494678 7.000146
FONTSET "/var/webmapit/mapserver.d/fonts/wmi_defaultFontSet.cfg"
CONFIG "MS_ERRORFILE" "c:/var/webmapit/mapserver.d/mapfiles/users/sntgeo/sntgeo-map_004.errors.log"
DEBUG 5
IMAGETYPE AGGPNG24
MAXSIZE 4096 #-- Larg/Alt maxima da imagem de saida 2384 = A0
SHAPEPATH "/var/webmapit/mapserver.d/mapfiles/users"
SYMBOLSET "/var/webmapit/mapserver.d/symbols/wmi_defaultSymbolSet.sym"
UNITS DD
INCLUDE "/var/webmapit/mapserver.d/mapfiles/include/wmi_map_outputformats.map"
INCLUDE "/var/webmapit/mapserver.d/mapfiles/include/wmi_projection_4326.map"
WEB
IMAGEPATH "/var/www/html/tmp/" #--alterar no servidor
IMAGEURL "/tmp/" #--alterar no servidor
HEADER "topodata_web_header.html"
FOOTER "topodata_web_footer.html"
........
Layer file:
...
HEADER "C:\var\webmapit\mapserver.d\mapfiles\users\sntgeo\topodata_muni_header.html"
TEMPLATE "C:\var\webmapit\mapserver.d\mapfiles\users\sntgeo\topodata_muni_temp.html"
FOOTER "C:\var\webmapit\mapserver.d\mapfiles\users\sntgeo\topodata_muni_footer.html"
END
Índex:
// INI: http://dev.openlayers.org/releases/OpenLayers-2.10/examples/click-handler.html
OpenLayers.Control.Click = OpenLayers.Class(OpenLayers.Control, {
defaultHandlerOptions: {
'single': true,
'double': false,
'pixelTolerance': 0,
'stopSingle': false,
'stopDouble': false
},
initialize: function(options) {
this.handlerOptions = OpenLayers.Util.extend(
{}, this.defaultHandlerOptions
);
OpenLayers.Control.prototype.initialize.apply(
this, arguments
);
this.handler = new OpenLayers.Handler.Click(
this, {
'click': this.onClick
}, this.handlerOptions
);
},
onClick: function(evt) {
var tempXY = explodeArray(evt.xy,',');
var aX = explodeArray(tempXY[0],'=');
var aY = explodeArray(tempXY[1],'=');
var tmpPixel = new OpenLayers.Pixel();
tmpPixel.x = aX[1];
tmpPixel.y = aY[1];
var aLonLat = map.getLonLatFromViewPortPx(tmpPixel);
doIdentify(aLonLat.lon,aLonLat.lat, aX[1], aY[1] );
//alert('X=' + aLonLat.lon + ' Y=' + aLonLat.lat);
}
});
var controls;
controls = {
"single": new OpenLayers.Control.Click({
handlerOptions: {
"single": true
}
})
};
var props = document.getElementById("props");
// FIM: http://dev.openlayers.org/releases/OpenLayers-2.10/examples/click-handler.html
.....
// INI - do identify...
var control;
for(var key in controls) {
control = controls[key];
// only to route output here
control.key = key;
map.addControl(control);
}
.......
function toggle(key) {
var control = controls[key];
if(control.active) {
control.deactivate();
} else {
control.activate();
}
var status = document.getElementById(key + "Status");
status.innerHTML = control.active ? "Navegar" : "Consultar";
.....
What is the problem?
Thanks
Matheus Lacarini
More information about the MapServer-users
mailing list