[mapserver-users] Need examples of UTFGrid Mapserver + Ol3

Soline Villermois villermois.soline at gmail.com
Thu Oct 27 02:30:53 PDT 2016


Hi,

'm having troubles using utfgrid module with openlayers. The implementation
on Mapserver's side is quite simple, even if i have doubts about the
imagetype :

MAP
    IMAGETYPE   UTFGRID
    SIZE        2000 2000
    CONFIG "MS_ERRORFILE" "/ms4w/tmp/ms_error.txt"
    #DEBUG 4
    EXTENT -176.197 -31.0869 181.47 81.8381
    NAME "allexmaple"

PROJECTION
    "init=epsg:4326"
END
QUERYMAP
    STATUS ON
END
OUTPUTFORMAT
    NAME "utfgrid"
    DRIVER UTFGRID
    MIMETYPE "application/json"
    EXTENSION "json"
    FORMATOPTION "UTFRESOLUTION=4"
    FORMATOPTION "DUPLICATES=false"
END
WEB
    IMAGEPATH "tmp/"
    IMAGEURL "tmp/"
END
SYMBOL
    NAME "mysymbol"
    TYPE pixmap
    ANCHORPOINT 0.5 0.5
    IMAGE  "icons/mysymbol.png"
END

LAYER
    TOLERANCE 10
    CONNECTIONTYPE postgis
    NAME "example"
    CONNECTION "host=127.0.0.1 dbname=ais_data user=postgres
password=admin port=5432"
    DATA "geom from mytable using srid=4326"
    STATUS ON
    TYPE POINT
    UTFITEM   "id"
    UTFDATA   "{\"id\":\"[id]\",\"name\":\"[name]\"}"
    TEMPLATE 'query.html'
    HEADER 'header.html'
    FOOTER 'footer.html'
    CLASSITEM "ct"

    CLASS
        EXPRESSION "mysymbol"
        STYLE
            ANGLE [angle]
            SYMBOL 'mysymbol'
        END # style
    END # class
END

END

Openlayers, on the other hand, doesn't have efficient example. I don't know
what to provide in my url. Here's what I tried:

var gridSource = new ol.source.TileUTFGrid({
       url: 'http://localhost:5000/cgi-bin/mapserv.exe?map=/ms4w/apps/tutorial/htdocs/essai.map&layers=example&tiled=true&mode=map&type=utfgrid&format=application/json'
      });
 var mySuperLayer = new ol.layer.Tile({
           source: gridSource
      });

But nothing appears and my url stays in pending until timeout

I just don't know how to debug that, any help would be highly appreciated
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20161027/c2070596/attachment-0001.html>


More information about the mapserver-users mailing list