Currently whenever I try to preview any WMS layer under Geoserver's layer preview page &width=768&height=339 automatically gets set in the request. I'd like to change these values.

Is there a way to specify the default width and height that the Geoserver layer preview page uses?

2 Answers 2


I believe that the the preview tool is meant to be a way to quickly look at the data and styling for the admin, it's not intended for customization as far I as know.

The documentation on the layer preview page provided on the geoserver website doesn't provide any methods on how to change the layer preview page width and height values as far as I could find.

I've come across this discussion which alludes to a possibility of achieving this with a modification to the java code and or in the URL at specific parameters.

On a separate note, utilizing the GetMAP method certainly allows for the specifying of the width and height output, which you could read more about here

  • I realize you can specify the width/height using GetMap. The reason I wanted to change the default size is really to get around another problem that I haven't yet been able to solve. Namely that getMAP crashes for me when the size is smaller than the number of pixels in my raster. The discussion you linked to answers this question that unless I edit Geoserver's java code and rebuild it changing the defaults probably isn't going to happen.
    – apricity
    Commented Feb 20, 2016 at 18:11
  • Why not ask us that question then?
    – Ian Turton
    Commented Feb 20, 2016 at 19:34
  • I already asked it some time ago... no answer though (that's why I'm exploring workarounds). See the link in my above comment for that question.
    – apricity
    Commented Feb 23, 2016 at 18:50

Geoserver manage this for you attending to your layer content. I don't know for what porpouses you need to do this but you can make your own GetMap request defining your own values for the params you need.


Look at this example of javascript code that shows how to construct this GetMap request:

function getGeoserverMiniatura(denuncia, width){

    tipo = denuncia.tipo;
    coords = denuncia.coordenadas;
    //alert(coords + ' ' + tipo);
    var extension = [];
    var tabla = '';
    if(tipo == 'Point'){
        extension = new ol.geom.Point(coords).getExtent();
        tabla = 'denuncias_puntos';
    if(tipo == 'LineString'){
        extension = new ol.geom.LineString(coords).getExtent();
        tabla = 'denuncias_lineas';
    if(tipo == 'Polygon'){
        extension = new ol.geom.Polygon(coords).getExtent();
        tabla = 'denuncias_poligonos';
    extension[0] = extension[0] - 0.001; //Xmin
    extension[1] = extension[1] - 0.001; //Ymin
    extension[2] = extension[2] + 0.001; //Xmax
    extension[3] = extension[3] + 0.001; //Ymax

    var dif = Math.abs(extension[2] - extension[0]) / Math.abs(extension[3] - extension[1]) ;
    var height = Math.round(width / dif);
    return "" +
        "&layers=jahr:OI.OrthoimageCoverage,jahr:" + tabla + "&styles=&bbox=" + 
        extension + "&width=" + width + "&height=" + height + 
        "&srs=EPSG:4258&format=image/png&cql_filter=1=1;gid='" + denuncia.gid + "'";


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.