When I make a getGetFeatureInfoUrl request with OpenLayers 4.x, Geoserver 2.10.1 and WMS 1.3.0 with the code below, the width and height returned default to 256.

var url = lyr.getSource().getGetFeatureInfoUrl(
evt.coordinate, viewResolution, viewProjection,
{'INFO_FORMAT': 'text/html', 'FEATURE_COUNT': 50, 'WIDTH': 500, 

If I set the popup I display it in to dynamically resize, it too is always 256x256, leaving empty space if there are only a few fields or long scroll bars if there is a lot of data.

Am I setting the params wrong? Do I have to change the html formatting with a .flt file in the Geoserver templates directory? Ideally, I'd like to know the actual width and height or not pass them at all.

2 Answers 2


Width and Height in a GetFeatureInfo request relate to the width and height of the Map (product of a GetMap request) to which you are supplying your I/J pixel coordinate. This has nothing to do with the size of the response.


I don't think there is any way to work out the size of the html returned from a getfeatureinfo request before it returned.

If the sizing and presentation of the information is important to you then request the information in a machine readable format like json or gml and produce exactly the display you want.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.