-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Make geometry conversion optional for QueryRenderedFeatures #9815
Conversation
src/mbgl/tile/geometry_tile_data.cpp
Outdated
@@ -180,4 +180,11 @@ Feature convertFeature(const GeometryTileFeature& geometryTileFeature, const Can | |||
return feature; | |||
} | |||
|
|||
Feature convertFeatureProperties(const GeometryTileFeature& geometryTileFeature) { | |||
Feature feature { Point<double>() }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forcing all features to be of type point
means that the results will not be able to tell the geometry_type
of a feature.
How about a switch
statement to create the feature
with the correct geometry type ?
8c0ab02
to
ce6496f
Compare
ce6496f
to
7702e87
Compare
@@ -14,14 +14,18 @@ namespace mbgl { | |||
class RenderedQueryOptions { | |||
public: | |||
RenderedQueryOptions(optional<std::vector<std::string>> layerIDs_ = {}, | |||
optional<style::Filter> filter_ = {}) | |||
optional<style::Filter> filter_ = {}, | |||
optional<bool> geometryConversion_ = true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since geometryConversion
defaults to true, it doesn't need to be optional
: layerIDs(std::move(layerIDs_)), | ||
filter(std::move(filter_)) {} | ||
filter(std::move(filter_)), | ||
geometryConversion(std::move(geometryConversion_)) {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to use std::move
here
Feature convertFeature(const GeometryTileFeature& geometryTileFeature, const CanonicalTileID& tileID) { | ||
Feature feature { convertGeometry(geometryTileFeature, tileID) }; | ||
static Feature::geometry_type convertGeometryType(const GeometryTileFeature& geometryTileFeature) { | ||
GeometryCollection geometries = geometryTileFeature.getGeometries(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getGeometries()
ends up processing polygons - which is one of the hits you want to avoid. You might need to add a GeometryTileFeature.getGeometryType()
method to get the type of the underlying geometry, as opposed to FeatureType
The issue I was trying to optimize for is now handled differently in #10267, don't see a need anymore for adding this. Closing. |
WIP, Closes #9605,
This PR adds the option to not convert geometry when querying for rendered features. There are use-cases where you are only interested in feature properties and not the geometry.
Some temp results in ms querying for 18 features using the android binding:
Todo: