Skip to content

Commit

Permalink
[Maps] convert elasticsearch_utils to TS (elastic#93984)
Browse files Browse the repository at this point in the history
* [Maps] convert elasticsearch_utils to TS

* tslint

* clean up

* i18n cleanup

* update elasticsearch_geo_utils tests

* fix unit test

* review feedback

Co-authored-by: Kibana Machine <[email protected]>
  • Loading branch information
nreese and kibanamachine committed Mar 10, 2021
1 parent 9fe2f68 commit c5b48e2
Show file tree
Hide file tree
Showing 10 changed files with 194 additions and 166 deletions.
18 changes: 9 additions & 9 deletions x-pack/plugins/maps/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,15 @@ export enum ES_SPATIAL_RELATIONS {
WITHIN = 'WITHIN',
}

export const GEO_JSON_TYPE = {
POINT: 'Point',
MULTI_POINT: 'MultiPoint',
LINE_STRING: 'LineString',
MULTI_LINE_STRING: 'MultiLineString',
POLYGON: 'Polygon',
MULTI_POLYGON: 'MultiPolygon',
GEOMETRY_COLLECTION: 'GeometryCollection',
};
export enum GEO_JSON_TYPE {
POINT = 'Point',
MULTI_POINT = 'MultiPoint',
LINE_STRING = 'LineString',
MULTI_LINE_STRING = 'MultiLineString',
POLYGON = 'Polygon',
MULTI_POLYGON = 'MultiPolygon',
GEOMETRY_COLLECTION = 'GeometryCollection',
}

export const POLYGON_COORDINATES_EXTERIOR_INDEX = 0;
export const LON_INDEX = 0;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -397,12 +397,10 @@ describe('createExtentFilter', () => {
minLon: -89,
};
const filter = createExtentFilter(mapExtent, geoFieldName);
expect(filter).toEqual({
geo_bounding_box: {
location: {
top_left: [-89, 39],
bottom_right: [-83, 35],
},
expect(filter.geo_bounding_box).toEqual({
location: {
top_left: [-89, 39],
bottom_right: [-83, 35],
},
});
});
Expand All @@ -415,12 +413,10 @@ describe('createExtentFilter', () => {
minLon: -190,
};
const filter = createExtentFilter(mapExtent, geoFieldName);
expect(filter).toEqual({
geo_bounding_box: {
location: {
top_left: [-180, 89],
bottom_right: [180, -89],
},
expect(filter.geo_bounding_box).toEqual({
location: {
top_left: [-180, 89],
bottom_right: [180, -89],
},
});
});
Expand All @@ -436,12 +432,10 @@ describe('createExtentFilter', () => {
const leftLon = filter.geo_bounding_box.location.top_left[0];
const rightLon = filter.geo_bounding_box.location.bottom_right[0];
expect(leftLon).toBeGreaterThan(rightLon);
expect(filter).toEqual({
geo_bounding_box: {
location: {
top_left: [100, 39],
bottom_right: [-160, 35],
},
expect(filter.geo_bounding_box).toEqual({
location: {
top_left: [100, 39],
bottom_right: [-160, 35],
},
});
});
Expand All @@ -457,12 +451,10 @@ describe('createExtentFilter', () => {
const leftLon = filter.geo_bounding_box.location.top_left[0];
const rightLon = filter.geo_bounding_box.location.bottom_right[0];
expect(leftLon).toBeGreaterThan(rightLon);
expect(filter).toEqual({
geo_bounding_box: {
location: {
top_left: [160, 39],
bottom_right: [-100, 35],
},
expect(filter.geo_bounding_box).toEqual({
location: {
top_left: [160, 39],
bottom_right: [-100, 35],
},
});
});
Expand All @@ -475,12 +467,10 @@ describe('createExtentFilter', () => {
minLon: -191,
};
const filter = createExtentFilter(mapExtent, geoFieldName);
expect(filter).toEqual({
geo_bounding_box: {
location: {
top_left: [-180, 39],
bottom_right: [180, 35],
},
expect(filter.geo_bounding_box).toEqual({
location: {
top_left: [-180, 39],
bottom_right: [180, 35],
},
});
});
Expand Down
Loading

0 comments on commit c5b48e2

Please sign in to comment.