-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Support serialization of geo shapes on documents #3208
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
Conversation
|
I think the geo shape support should be revisited in 7.x. For example,
|
codebrain
left a comment
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.
LGTM - a minor observation - are we going to allow geoshapes on documents?
| typeof(Attachment), | ||
| typeof(ILazyDocument) | ||
| typeof(ILazyDocument), | ||
| typeof(GeoCoordinate) |
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.
IGeoShape as well as IGeometryCollection ?
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.
Handled on lines 56 and 57 below. It's possible that a user could specify any type that implements IGeoShape e.g. IPolygonGeoShape, so json conversion should check if IGeoShape is assignable from the type.
| } | ||
|
|
||
| // adapted from https://gis.stackexchange.com/a/103465/30046 | ||
| private static IEnumerable<GeoCoordinate> GeneratePolygonCoordinates(Faker p, GeoCoordinate centroid, double maxDistance = 0.0002) |
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.
👍
This commit changes GeometryCollection to implement IGeoShape, to allow a document to have an IGeoShape member and accept a GeometryCollection. IGeoShape.Type is implemented explicitly so that the existing Type member continues to be the implicit implementation of IGeometryCollection. The ideal scenario would have been for IGeometryCollection to implement IGeoShape however this would break backwards binary compatibility, since both interfaces have a Type member.
* Support serialization of geo shapes on documents Fixes #3100 Fixes #3096 * GeometryCollection implements IGeoShape This commit changes GeometryCollection to implement IGeoShape, to allow a document to have an IGeoShape member and accept a GeometryCollection. IGeoShape.Type is implemented explicitly so that the existing Type member continues to be the implicit implementation of IGeometryCollection. The ideal scenario would have been for IGeometryCollection to implement IGeoShape however this would break backwards binary compatibility, since both interfaces have a Type member. (cherry picked from commit 96c0d4d)
* Support serialization of geo shapes on documents Fixes #3100 Fixes #3096 * GeometryCollection implements IGeoShape This commit changes GeometryCollection to implement IGeoShape, to allow a document to have an IGeoShape member and accept a GeometryCollection. IGeoShape.Type is implemented explicitly so that the existing Type member continues to be the implicit implementation of IGeometryCollection. The ideal scenario would have been for IGeometryCollection to implement IGeoShape however this would break backwards binary compatibility, since both interfaces have a Type member. (cherry picked from commit 96c0d4d) This commit includes changes from PR #3214, which were required to address incorrect serialization introduced in 6.x
Fixes #3100
Fixes #3096