-
Notifications
You must be signed in to change notification settings - Fork 46
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 geo shape query filter #319
Conversation
Codecov Report
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more @@ Coverage Diff @@
## main #319 +/- ##
==========================================
+ Coverage 90.26% 90.36% +0.09%
==========================================
Files 12 12
Lines 298 301 +3
Branches 40 40
==========================================
+ Hits 269 272 +3
Misses 19 19
Partials 10 10
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
|
||
export type GeoShapeFilter = Filter & { | ||
meta: FilterMeta; | ||
geo_shape: any; |
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.
Could we define the type of geo_shape?
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.
Geo shape has variable field name property and fixed string property. How do you recommend create type in that case?
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.
Maybe we can define something like:
type GeoShape = {
ignore_unmaped: Boolean,
location: {
relation: FilterRelations,
shape: {
type: 'Polygon',
coordinates: [
[
[number, number],
[number, number],
[number, number],
[number, number],
],
],
},
}
}
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.
but location is not fixed. It could be any field name
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.
In short term I think it's ok to use any
, long term we need define the type to make it safer usage
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.
We might can use generic type for it?
type Coordinate = [number, number];
type Polygon = {
type: 'Polygon';
coordinates: Coordinate[][];
};
type Geometry = Polygon;
type Location<F extends string> = {
[K in F]: {
relation: 'INTERSECTS';
shape: Geometry;
};
};
type GeoShape<F extends string> = {
ignore_unmaped: true;
} & Location<F> & Geometry;
b6a8739
to
d0f9d00
Compare
Signed-off-by: Vijayan Balasubramanian <balasvij@amazon.com>
d0f9d00
to
0df114c
Compare
Added Geo Shape Query Filter to build geo shape query for given shape , relations and label. Signed-off-by: Vijayan Balasubramanian <balasvij@amazon.com> (cherry picked from commit 16fca69)
Added Geo Shape Query Filter to build geo shape query for given shape , relations and label. Signed-off-by: Vijayan Balasubramanian <balasvij@amazon.com> (cherry picked from commit 16fca69) Co-authored-by: Vijayan Balasubramanian <vijayan.balasubramanian@gmail.com>
…ct#325) Added Geo Shape Query Filter to build geo shape query for given shape , relations and label. Signed-off-by: Vijayan Balasubramanian <balasvij@amazon.com> (cherry picked from commit 16fca69) Co-authored-by: Vijayan Balasubramanian <vijayan.balasubramanian@gmail.com> (cherry picked from commit 4149520)
Description
Added Geo Shape Query Filter to build geo shape query for given shape , relations and label.
Issues Resolved
#213
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.