-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Use getFeaturesInExtent #13195
Use getFeaturesInExtent #13195
Conversation
📦 Preview the examples and docs from this branch here: https://deploy-preview-13195--ol-site.netlify.app/. |
|
The difference is not rocket science either, so I added another commit with a filter for actual geometry intersection. |
2 small questions from porting this to TS:
Thanks already! |
In this case you won't get features without a geometry, because those would not be returned as result of
In this case you'd have to cast to |
👍
If we are allowed to cast, there will never be RenderFeatures returned? I do notice another problem with the box select and VectorTileLayer: duplicate selections. Maybe per tile? |
As with the VT selection example there should to be an |
Do you mean a TS cast or using |
@EvertEt a TS cast in this case won't help, because |
Thanks you for answering The decrease in render performance is something we'd like to avoid. |
@EvertEt For points, the result would be the same. For other cases, I think it could make sense to have a |
Would this Combining the above with an Thank you both |
Exactly. The function fromRenderFeature(renderFeature) {
const geometryType = renderFeature.getType();
let geometry;
switch (geometryType) {
case GeometryType.POINT:
geometry = new Point(renderFeature.getFlatCoordinates());
break;
// ...
case GeometryType.POLYGON:
geometry = new Polygon(renderFeature.getFlatCoordinates(), GeometryLayout.XY, renderFeature.getEnds());
break;
// ...
default:
}
const feature = new Feature({
...renderFeature.getProperties(),
geometry
});
feature.setId(renderFeature.getId());
return feature;
} You would have to handle the cases for all supported geometry types. |
Interesting, I will have a look at this, thank you. |
@EvertEt In future major versions, we might be getting rid of both |
I appreciate your explanation @ahocevar , thanks! Another idea that popped up, for the usecase of using the dragBox on VectorTile, only the Feature is not needed as only the Geometry is enough. We could also make geometry.fromRenderFeature to make it a bit more efficient? (Or implement both) Lastly a comment correcting my previous post: MVT |
The |
Fixes #13194.