Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Zoom To Layer Extent button #1517

Merged
merged 1 commit into from
Apr 11, 2022
Merged

Conversation

tonnyandersson
Copy link
Collaborator

Fixes #1516.

Just add "zoomToExtent": true to any non-background layer.

Known issues:

  • Doesn't work super well with raster type layers like WMS, AGS_MAP etc. since such layers don't contain any actual features. Still works but zooms to the layer extent, whatever that is, rather than source extent.
  • For vector layers, this feature will zoom to the full extent of the source, even if there's a specified layer extent in the config. It would, however, be quite possible to extract such extent from the config and use that instead of the source extent. Perhaps that would make more sense?

Copy link
Collaborator

@johnnyblasta johnnyblasta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested with setting the extent in config for a WMS layer and it works. Perhaps a bit too much work to enter the correct extent manually for every WMS layer.

@steff-o
Copy link
Contributor

steff-o commented Apr 8, 2022

At least for vector layers I think the most usable extent would be the actual extent where there are features, not a predefined extent. If using BBOX it would require a roundtrip to the server and will result in a feature download bonanza that totally defeats the idea of BBOX. But maybe that sorts under the "suit yourself" tab if you configure a layer to allow zoomToExtent if it is too heavy for strategy all.

@tonnyandersson
Copy link
Collaborator Author

tonnyandersson commented Apr 8, 2022

You are absolutely right, @steff-o.

However, if you set an extent on a vector layer, all features seems to be loaded, regardless of strategy. The map only shows the features inside the extent, but all the others are there, lurking around invisibly. You can even click on them if you know where they are... Seems like a bug, possibly related to the supposedly fixed #1025. Haven't done any deeper digging, though.

So, right now, if you set an extent on a vector layer, the map will show the features inside the extent only, but the Zoom To feature will zoom to the full layer extent including the invisible features. And that is not how the extent option is supposed to work. But, if the extent option works the way it should, i.e. that only features inside the configured extent are loaded, the Zoom To feature will work just fine as well.

@tonnyandersson tonnyandersson merged commit 7c44717 into master Apr 11, 2022
@tonnyandersson tonnyandersson deleted the zoom-to-layer-extent branch April 11, 2022 07:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Zoom to layer extent button
3 participants