Friday 5 August 2016

Display GeoServer's UTFGrid output in OpenLayers 3


GeoServer added UTFGrid output for vector features starting from the 2.9-beta version. It is implemented as a WMS service output format.



After installing GeoServer 2.9-beta, adding a datastore with a PostGIS connection and publishing a layer that contains vector features, I can click the WMS UTFGrid entry from the available formats list on the Layer Preview page in the admin UI and indeed get a UTFGrid representation of my data displayed in the browser.


How can I now integrate this as a UTFGrid layer into OpenLayers 3? The only resource that I could find on this topic is this official example. However, it uses ol.source.TileUTFGrid as the layer's source and passes a URL which ends in .json. GeoServer, however, publishes a WMS URL which expects further parameters such as request, bbox etc.


Simply passing the URL generated by the Layer Preview page gives Uncaught SyntaxError: Unexpected token : in the browser's console.


What would be the correct way to include GeoServer's UTFGrid output as a layer?




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...