-
Notifications
You must be signed in to change notification settings - Fork 2
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
Add view animation convenience functionality #570
Comments
Please also consider zoom to extent |
This could be an A basic showcase would be to have a map and then set:
We could pass some more options to the
Regarding features, extent etc. I don't have a clear idea yet... |
Following scenarios are thought of:
|
Just a minor consideration of setting layer property |
The last option is once a feature is already loaded in a vector layer, it is possible to zoom to the available features? |
I have a snippet for getting the extent of a feature of a vector tile layer, even if split across multiple tiles: import { createEmpty as createEmptyExtent, extend } from "ol/extent";
function getFeaturesInMapExtent(eoxMap, layerName) {
const olMap = eoxMap.map;
const view = olMap.getView();
const mapExtent = view.calculateExtent(olMap.getSize());
const layer = eoxMap.getLayerById(layerName);
return layer.getSource().getFeaturesInExtent(mapExtent);
}
function mergeExtents(featureParts) {
return featureParts.reduce((extent, featurePart) => {
return extend(extent, featurePart.getExtent());
}, createEmptyExtent());
}
export default function getFeatureExtent(eoxMap, layerName, parcelId) {
const featureParts = getFeaturesInMapExtent(eoxMap, layerName).filter(
(f) => f.get("id") == parcelId
);
return mergeExtents(featureParts);
} |
keep in mind that this only works in features in loaded tiles. If you can't guarantee that all tiles of the feature are already loaded, a simple pre-calculated extent is the safer option. |
Two things are not fully implemented yet: 1.) selectById 2.) |
Closed in favor of the two newly created issues. |
E.g.
The text was updated successfully, but these errors were encountered: