[mapserver-users] Impossible to get getFeatureInfo result
Geo-6
support at geo6.be
Mon Jun 17 03:21:27 PDT 2013
Thanks for your help, I posted a message on Leaflet forum.
Unfortunately, this is the example I used to get GetFeatureInfo function J
Have a good day.
Jonathan Beliën
Geo-6
De : mapserver-users-bounces at lists.osgeo.org
[mailto:mapserver-users-bounces at lists.osgeo.org] De la part de Rahkonen
Jukka
Envoyé : lundi 17 juin 2013 12:11
À : 'mapserver-users at lists.osgeo.org'
Objet : Re: [mapserver-users] Impossible to get getFeatureInfo result
Hi,
Your problem is in the Leaflet code which does not take X and Y values from
the mouse click and you will be better served if you ask about that from
some Leaflet forum. However, there is a working GetFeatureInfo example at
http://projects.bryanmcbride.com/leaflet/wms_info.html
Perhaps you will find from the code what you have done differently.
-Jukka Rahkonen-
Geo-6 wrote:
Hi Im new to MapServer.
Im trying to use MapServer (MS4W) as a WMS Server with Leaflet
(http://leafletjs.com/)
The GetMap function works perfectly but I cant get a correct
GetFeatureInfo result
Here are some portions of my code :
Leaflet :
var map2 = L.map('map2', { /*minZoom: 8,*/ crs: L.CRS.EPSG3857
}).setView([50.495958, 4.42749], 8);
map2.on("click", function(e) {
var latlngStr = '(' + e.latlng.lat.toFixed(3) + ', ' +
e.latlng.lng.toFixed(3) + ')';
var SRS = map2.options.crs.code;
var BBOX = map2.getBounds().toBBoxString();
var WIDTH = map2.getSize().x;
var HEIGHT = map2.getSize().y;
var X = map2.layerPointToContainerPoint(e.layerPoint).x;
var Y = map2.layerPointToContainerPoint(e.layerPoint).y;
var URL =
'&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetFeatureInfo&LAYERS=TEST_KM_L7P&QUERY_
LAYERS=TEST_KM_L7P&STYLES=&BBOX='+BBOX+'&HEIGHT='+HEIGHT+'&WIDTH='+WIDTH+'&F
ORMAT=image%2Fpng&INFO_FORMAT=text%2Fhtml&SRS='+SRS+'&X='+X+'&Y='+Y;
$.ajax({
url:
"http://www.geocode.be/cgi-bin/mapserv.exe?map=D:/Data/Vector/test_km_L7p_wm
s.map",
dataType: "html",
type: "GET",
//async: false,
success: function(data) {
//console.log(data);
$("#url").text("http://www.geocode.be/cgi-bin/mapserv.exe?map=D:/Data/Vector
/test_km_L7p_wms.map" + URL)
$("#console").html(data);
}
});
});
MapServer MAP File :
MAP
NAME "Test2"
STATUS ON
SIZE 600 400
#SYMBOLSET "../etc/symbols.txt"
EXTENT 0 0 300000 300000
#UNITS DD
#SHAPEPATH "../data"
IMAGECOLOR 255 255 255
#FONTSET "../etc/fonts.txt"
CONFIG "PROJ_LIB" "./proj/nad/"
CONFIG "MS_ERRORFILE" "D:/Data/Vector/ms_error.txt"
CONFIG "CPL_DEBUG" "OFF"
CONFIG "PROJ_DEBUG" "ON"
DEBUG 3
#
# Start of web interface definition
#
WEB
IMAGEPATH "D:/VH_DEFAULT/Temp/"
IMAGEURL "/Temp/"
METADATA
"wms_abstract" "Demo for map context document. Blah blah..."
"wms_title" "Map Context demo" #### REQUIRED
"wms_enable_request" "*"
"wms_srs" "EPSG:31370 EPSG:4326 EPSG:3857"
"wms_feature_info_mime_type" "text/plain text/html"
END
TEMPLATE "blank.html"
END
PROJECTION
"init=epsg:31370"
END
#
# Start of layer definitions
#
LAYER
NAME TEST_KM_L7P
TYPE LINE
STATUS ON
CONNECTIONTYPE OGR
CONNECTION "./test_km_L7p.TAB"
STYLEITEM "AUTO"
DUMP TRUE
TEMPLATE "blank.html"
CLASS
NAME "TEST_KM_L7P"
END
METADATA
"wms_title" "TEST_KM_L7P" #### REQUIRED
"wms_enable_request" "*"
"gml_include_items" "all"
"wms_include_items" "all"
END
END # Layer
END # Map
My TEMPLATE file is correctly loaded but every time, no matter where I click
on the map, the [mapx], [mapy] = -1.000000, -1.000000 and [maplon], [maplat]
= 2.305489, 49.293903
I really does not see where the error is.
Thanks for your help.
Have a good day.
PS: Sorry for my bad english
Jonathan Beliën
Geo-6
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20130617/51d6275b/attachment.htm>
More information about the MapServer-users
mailing list