-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add support for geo_shape represented as Well-Known Text (WKT) #3377
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
This commit moves the geo_shape queries into the Test project. Missed in the Tests refactoring
This commit adds support for Well-Known Text (WKT) representations of geo_shape. The extent of the implementation is only as far as is required by the WKT support in Elasticsearch. Deserialize from WKT to IGeoShape types. The format from which the shape is deserialized is assigned to an internal format property on the concrete implementations of GeoShape as the intention is not to expose this as a property on the IGeoShape interface. The format is assigned to the instance so that the IGeoShape instance is serialized to the same format if indexed again. GeoWKTReader is a simple tokenizer implementation for the purposes of parsing only WKT concepts that are supported by Elasticsearch. GeoShapeConverter now implements WriteJson because the original format of IGeoShape now needs to be taken into account when serializing. Add tests for roundtrip serialization of WKT. Closes #3256
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.
Looks good. I would add a test to assert a malformed WKT string.
throw new NotSupportedException(); | ||
// IGeometryCollection needs to be handled separately because it does not | ||
// implement IGeoShape, and can't because it would be a binary breaking change. | ||
// This is fixed in next major release. |
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 put something like "Fixed in 7.0" that way when we search in the code for TODOs in 7.0 we can find this.
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.
++
var radius = shape["radius"]; | ||
return ParseCircleGeoShape(shape, serializer, radius); | ||
case "envelope": | ||
case GeoShapeType.Circle: |
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.
++
@@ -7,7 +7,7 @@ | |||
<NoWarn>$(NoWarn);xUnit1013</NoWarn> | |||
</PropertyGroup> | |||
<ItemGroup> | |||
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" /> | |||
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.0-beta1-build3642" /> |
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.
Intentional?
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.
yep!
This commit adds additional unit tests for reading and writing shapes in WKT.
Wicked! |
I see what you did there @Mpdreamz 😄 |
* Add support for well known text (wkt) to geo bounding box queries * Move geo_shape queries into Tests project This commit moves the geo_shape queries into the Test project. Missed in the Tests refactoring * Add support for Z values to GeoCoordinate * Add support for WKT geo shapes This commit adds support for Well-Known Text (WKT) representations of geo_shape. The extent of the implementation is only as far as is required by the WKT support in Elasticsearch. Deserialize from WKT to IGeoShape types. The format from which the shape is deserialized is assigned to an internal format property on the concrete implementations of GeoShape as the intention is not to expose this as a property on the IGeoShape interface. The format is assigned to the instance so that the IGeoShape instance is serialized to the same format if indexed again. GeoWKTReader is a simple tokenizer implementation for the purposes of parsing only WKT concepts that are supported by Elasticsearch. GeoShapeConverter now implements WriteJson because the original format of IGeoShape now needs to be taken into account when serializing. Add tests for roundtrip serialization of WKT. Closes #3256
* Add support for well known text (wkt) to geo bounding box queries * Move geo_shape queries into Tests project This commit moves the geo_shape queries into the Test project. Missed in the Tests refactoring * Add support for Z values to GeoCoordinate * Add support for WKT geo shapes This commit adds support for Well-Known Text (WKT) representations of geo_shape. The extent of the implementation is only as far as is required by the WKT support in Elasticsearch. Deserialize from WKT to IGeoShape types. The format from which the shape is deserialized is assigned to an internal format property on the concrete implementations of GeoShape as the intention is not to expose this as a property on the IGeoShape interface. The format is assigned to the instance so that the IGeoShape instance is serialized to the same format if indexed again. GeoWKTReader is a simple tokenizer implementation for the purposes of parsing only WKT concepts that are supported by Elasticsearch. GeoShapeConverter now implements WriteJson because the original format of IGeoShape now needs to be taken into account when serializing. Add tests for roundtrip serialization of WKT. Closes #3256
* Add support for well known text (wkt) to geo bounding box queries * Move geo_shape queries into Tests project This commit moves the geo_shape queries into the Test project. Missed in the Tests refactoring * Add support for Z values to GeoCoordinate * Add support for WKT geo shapes This commit adds support for Well-Known Text (WKT) representations of geo_shape. The extent of the implementation is only as far as is required by the WKT support in Elasticsearch. Deserialize from WKT to IGeoShape types. The format from which the shape is deserialized is assigned to an internal format property on the concrete implementations of GeoShape as the intention is not to expose this as a property on the IGeoShape interface. The format is assigned to the instance so that the IGeoShape instance is serialized to the same format if indexed again. GeoWKTReader is a simple tokenizer implementation for the purposes of parsing only WKT concepts that are supported by Elasticsearch. GeoShapeConverter now implements WriteJson because the original format of IGeoShape now needs to be taken into account when serializing. Add tests for roundtrip serialization of WKT. Closes #3256 (cherry picked from commit f31b087) Includes line ending sensitive unit test from 0d0afdb
* Add support for well known text (wkt) to geo bounding box queries * Move geo_shape queries into Tests project This commit moves the geo_shape queries into the Test project. Missed in the Tests refactoring * Add support for Z values to GeoCoordinate * Add support for WKT geo shapes This commit adds support for Well-Known Text (WKT) representations of geo_shape. The extent of the implementation is only as far as is required by the WKT support in Elasticsearch. Deserialize from WKT to IGeoShape types. The format from which the shape is deserialized is assigned to an internal format property on the concrete implementations of GeoShape as the intention is not to expose this as a property on the IGeoShape interface. The format is assigned to the instance so that the IGeoShape instance is serialized to the same format if indexed again. GeoWKTReader is a simple tokenizer implementation for the purposes of parsing only WKT concepts that are supported by Elasticsearch. GeoShapeConverter now implements WriteJson because the original format of IGeoShape now needs to be taken into account when serializing. Add tests for roundtrip serialization of WKT. Closes #3256 (cherry picked from commit f31b087) Includes line ending sensitive unit test from 0d0afdb
#3401) * Add support for well known text (wkt) to geo bounding box queries * Move geo_shape queries into Tests project This commit moves the geo_shape queries into the Test project. Missed in the Tests refactoring * Add support for Z values to GeoCoordinate * Add support for WKT geo shapes This commit adds support for Well-Known Text (WKT) representations of geo_shape. The extent of the implementation is only as far as is required by the WKT support in Elasticsearch. Deserialize from WKT to IGeoShape types. The format from which the shape is deserialized is assigned to an internal format property on the concrete implementations of GeoShape as the intention is not to expose this as a property on the IGeoShape interface. The format is assigned to the instance so that the IGeoShape instance is serialized to the same format if indexed again. GeoWKTReader is a simple tokenizer implementation for the purposes of parsing only WKT concepts that are supported by Elasticsearch. GeoShapeConverter now implements WriteJson because the original format of IGeoShape now needs to be taken into account when serializing. Add tests for roundtrip serialization of WKT. Closes #3256 (cherry picked from commit f31b087) Includes line ending sensitive unit test from 0d0afdb
This PR adds support for Well-Known Text (WKT) representations
of
geo_shape
types. The extent of the implementation is only as far as isrequired by the WKT support in Elasticsearch.
GeoCoordinate
IGeoShape
types. The format from whichthe shape is deserialized is assigned to an internal format property
on the concrete implementations of GeoShape as the intention is
not to expose this as a property on the IGeoShape interface. The format
is assigned to the instance so that the IGeoShape instance is
serialized to the same format if indexed again.
GeoWKTReader
is a simple tokenizer implementationfor the purposes of parsing only WKT concepts that are supported
by Elasticsearch.
GeoShapeConverter
now implementsWriteJson()
because theoriginal format of IGeoShape now needs to be taken into account
when serializing.
Closes #3256