[mapserver-users] Impossible to get getFeatureInfo result

Geo-6 support at geo6.be
Mon Jun 17 02:42:24 PDT 2013


Hi I’m new to MapServer.

 

I’m trying to use MapServer (MS4W) as a WMS Server with Leaflet
(http://leafletjs.com/)

 

The “GetMap” function works perfectly but I can’t 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/5ea829ff/attachment.htm>


More information about the MapServer-users mailing list