I need to zoom map to show some selected features from layer. So I am creating a temporary layer with features and zoom to this temporary layer. The problem - usually the scale is too small, so I need to specify a minimum scale.

How can I achieve this?

For now I use several workarounds:

// I found that WFS layer start to work from 500 scale level, so if map scale level is lower than scale to 500
if (map.getScale() <  500) {
    map.zoomToScale(500, false);
} else {
    //feature could be selected under offcanvas - this could cause feature be not selected
    //easy workaround - zoomout a bit after zooming to all selected features

Your Answer

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

Browse other questions tagged or ask your own question.