[mapserver-users] UTFGrid format in OpenLayers3

Seth G geographika at gmail.com
Thu Mar 31 12:37:12 PDT 2016


Hi,

I managed to get the UTFGrid working as a tile service from MapServer 
(rather than via WMS). I simply had to set the map's image type using 
runtime substitution by adding "&map.imagetype=utfgrid" to the 
querystring e.g.

mapserv -nh 
"QUERY_STRING=map=C:/mapserver-tutorial-data/mapfiles/utf_grid.map&layers=countries&mode=tile&tile=0+0+0&tilemode=gmap&map.imagetype=utfgrid"

I then ran into a further problem. The UTFGrid only returns Unicode 
replacement characters so is unusable.

I did some debugging and in the maputfgrid.cpp file there is the 
following line:

utf8 = msConvertWideStringToUTF8 (string, "UCS-4LE");

It takes a string such as "                  (( 
77777                                    " and returns a junk looking 
string such as 
"øˆ€€ øˆ€€ øˆ€€ øˆ€€ øˆ€€ øˆ€€ øˆ€€ øˆ€€ øˆ€€ øŠ€€¨øˆ€€ ø°€ ø°€·ø°€·øˆ€€ øˆ€€ øˆ€€ øˆ€€ øˆ€€ øˆ€€ øˆ€€ øˆ€€ øˆ€€ øˆ€€ øˆ€€ øˆ€€ øˆ€€ øˆ€€ øˆ€€ øˆ€€ øˆ€€ øˆ€"

I'm not sure where the "UCS-4LE" encoding is coming from. I'm running on 
a Windows server which could make a difference, however I tried a few 
other encodings with no success. The dataset is a shapefile.
Has anyone got the UTFGrid output working on Windows?

Thanks,

Seth

On 18/03/2016 22:54, Seth G wrote:
> Hi list,
>
> I'm looking at trying to set up an OpenLayer3 demo using the UTFGrid 
> format provided by MapServer.
>
> http://mapserver.org/development/rfc/ms-rfc-93.html#rfc93
> http://mapserver.org/output/utfgrid_output.html
>
> As luck would have it, it appears OpenLayers2 actually has a better 
> implementation on the client-side. See links:
>
> http://dev.openlayers.org/examples/utfgrid.html
> http://dev.openlayers.org/docs/files/OpenLayers/Layer/UTFGrid-js.html
>
> OL3 seems to require a server-side component to return a callback with 
> details on the service. Even if I set this up, it expects the UTFGrid 
> service to use a tile grid format ({x}{y}{z}). 
> http://openlayers.org/en/v3.14.2/examples/tileutfgrid.html
>
> I can configure MapServer to return UTFGrids using WMS GetMap requests 
> (as stated in the RFC), but not when using the tile mode - 
> http://mapserver.org/output/tile_mode.html
>
> I can probably hack together a workaround to work out tile numbers 
> from BBOXes, but I was wondering if I'm missing something simple to 
> get this to work directly.
> Has anyone manged to set this up?
>
> Thanks for any advice,
>
> Seth
>
> --
> web:http://geographika.co.uk
> twitter: @geographika
>
>
>
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20160331/b9eb04b1/attachment.html>


More information about the mapserver-users mailing list