<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=iso-8859-1"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
span.shorttext
{mso-style-name:short_text;}
span.hps
{mso-style-name:hps;}
.MsoChpDefault
{mso-style-type:export-only;
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=FR-BE link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span lang=EN-US>Hi I’m new to MapServer.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>I’m trying to use MapServer (MS4W) as a WMS Server with Leaflet (<a href="http://leafletjs.com/">http://leafletjs.com/</a>)<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>The “GetMap” function works perfectly but I can’t get a correct “GetFeatureInfo” result…<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>Here are some portions of my code :<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>Leaflet :<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'>var map2 = L.map('map2', { /*minZoom: 8,*/ crs: L.CRS.EPSG3857 }).setView([50.495958, 4.42749], 8);<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'>map2.on("click", function(e) {<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> var latlngStr = '(' + e.latlng.lat.toFixed(3) + ', ' + e.latlng.lng.toFixed(3) + ')';<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> </span><span style='font-family:"Courier New"'>var SRS = map2.options.crs.code;<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span style='font-family:"Courier New"'> </span><span lang=EN-US style='font-family:"Courier New"'>var BBOX = map2.getBounds().toBBoxString();<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> var WIDTH = map2.getSize().x;<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> var HEIGHT = map2.getSize().y;<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> var X = map2.layerPointToContainerPoint(e.layerPoint).x;<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> var Y = map2.layerPointToContainerPoint(e.layerPoint).y;<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> 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+'&FORMAT=image%2Fpng&INFO_FORMAT=text%2Fhtml&SRS='+SRS+'&X='+X+'&Y='+Y;<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> $.ajax({<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> url: "http://www.geocode.be/cgi-bin/mapserv.exe?map=D:/Data/Vector/test_km_L7p_wms.map",<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> dataType: "html",<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> type: "GET",<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> //async: false,<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> success: function(data) {<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> //console.log(data);<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> $("#url").text("http://www.geocode.be/cgi-bin/mapserv.exe?map=D:/Data/Vector/test_km_L7p_wms.map" + URL)<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> $("#console").html(data);<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> }<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> });<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'>});<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-family:"Courier New"'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>MapServer MAP File :<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'>MAP<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> NAME "Test2"<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> STATUS ON<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> SIZE 600 400<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> #SYMBOLSET "../etc/symbols.txt"<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> EXTENT 0 0 300000 300000<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> #UNITS DD<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> #SHAPEPATH "../data"<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> </span><span style='font-family:"Courier New"'>IMAGECOLOR 255 255 255<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span style='font-family:"Courier New"'> #FONTSET "../etc/fonts.txt"<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span style='font-family:"Courier New"'> </span><span lang=EN-US style='font-family:"Courier New"'>CONFIG "PROJ_LIB" "./proj/nad/"<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'><o:p> </o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> CONFIG "MS_ERRORFILE" "D:/Data/Vector/ms_error.txt"<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> CONFIG "CPL_DEBUG" "OFF"<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> CONFIG "PROJ_DEBUG" "ON"<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> DEBUG 3<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'><o:p> </o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> #<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> # Start of web interface definition<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> #<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> WEB<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> IMAGEPATH "D:/VH_DEFAULT/Temp/"<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> IMAGEURL "/Temp/"<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> METADATA<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> "wms_abstract" "Demo for map context document. Blah blah..."<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> "wms_title" "Map Context demo" #### REQUIRED<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> "wms_enable_request" "*"<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> "wms_srs" "EPSG:31370 EPSG:4326 EPSG:3857"<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> "wms_feature_info_mime_type" "text/plain text/html"<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> END<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> TEMPLATE "blank.html"<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> END<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'><o:p> </o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> PROJECTION<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> "init=epsg:31370"<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> END<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'><o:p> </o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> #<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> # Start of layer definitions<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> #<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> LAYER<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> NAME TEST_KM_L7P<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> TYPE LINE<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> STATUS ON<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> CONNECTIONTYPE OGR<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> CONNECTION "./test_km_L7p.TAB"<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> STYLEITEM "AUTO"<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> DUMP TRUE<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> TEMPLATE "blank.html"<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> CLASS<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> NAME "TEST_KM_L7P"<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> END<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> METADATA<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> "wms_title" "TEST_KM_L7P" #### REQUIRED<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> "wms_enable_request" "*"<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> "gml_include_items" "all"<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> "wms_include_items" "all"<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> END<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'> END # Layer<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US style='font-family:"Courier New"'>END # Map<o:p></o:p></span></p><p class=MsoNormal style='margin-left:35.4pt'><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>My TEMPLATE file is correctly loaded but every time, </span><span class=hps><span lang=EN>no matter</span></span><span class=shorttext><span lang=EN> </span></span><span class=hps><span lang=EN>where</span></span><span class=shorttext><span lang=EN> </span></span><span class=hps><span lang=EN>I click on the map</span></span><span lang=EN-US>, the [mapx], [mapy] = -1.000000, -1.000000 and [maplon], [maplat] = 2.305489, 49.293903<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>I really does not see where the error is.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>Thanks for your help.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>Have a good day.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>PS: Sorry for my bad english<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='mso-fareast-language:FR-BE'>Jonathan Beliën<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='mso-fareast-language:FR-BE'>Geo-6<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p></div></body></html>