1

I would like to custumize the openlayer3 viewer integrated in the Geoserver (2.13) to have more zoom levels (by default there are 28 zoom levels with a zoom factor of 2). In other words, I would like to have more available scale and not just 1:2, 1:4,...1:34K, 1:68K, 1:136K,...,1:558K.

I am not sure I have the good approach but maybe modifyting this file could be the solution : http://localhost:8080/geoserver/openlayers3/ol.js

Indeed, there are some parameters that could be modified :

g=void 0!==a.minZoom?a.minZoom:0;d=void 0!==a.maxZoom?a.maxZoom:28;var h=void 0!==a.zoomFactor?a.zoomFactor:2;

The problem is that I can't find this ol.js file in my geoserver.

Is the approach good?

2

The map preview that GeoServer provides is not designed to be used directly in your application. You should create an OpenLayers client that does what you want exactly and use that.

For a quick win, you could copy the one generated by GeoServer and modify it to do what you want, modifying the GeoServer src code is not the right way though.

  • 1
    Indeed, that sounds like a much better idea, thank you very much ! As suggested, I saved the "layer preview" page of geoserver to have html + ol.js + ol.css files. I modified the ol.js (as described above), and when I open the html file in a web browser I have a nice smooth zoom... except the map which no longer appears in the dedicated box but below it (and the zooms in and out buttons are duplicated). This problem exists even when I save the webpage / open it without any modifications. Any idea of which file to look/adapt in priority : html file, ol.js or ol.css file... ? – GuillR May 8 '18 at 13:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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