[File upload] Rename geo-shape field to geometry (#120023)

This commit is contained in:
Thomas Neirynck 2021-12-01 09:35:01 -05:00 committed by GitHub
parent ae12131aca
commit f4bfd4dfc0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 5 deletions

View file

@ -105,7 +105,7 @@ export class JsonUploadAndParse extends Component<FileUploadComponentProps, Stat
} as unknown as Settings;
const mappings = {
properties: {
coordinates: {
geometry: {
type: this.state.geoFieldType,
},
},

View file

@ -225,7 +225,7 @@ describe('toEsDoc', () => {
test('should convert feature to geo_point ES document', () => {
const esDoc = toEsDoc(FEATURE_COLLECTION.features[0], ES_FIELD_TYPES.GEO_POINT);
expect(esDoc).toEqual({
coordinates: [-112.0372, 46.608058],
geometry: [-112.0372, 46.608058],
population: 200,
});
});
@ -233,7 +233,7 @@ describe('toEsDoc', () => {
test('should convert feature to geo_shape ES document', () => {
const esDoc = toEsDoc(FEATURE_COLLECTION.features[0], ES_FIELD_TYPES.GEO_SHAPE);
expect(esDoc).toEqual({
coordinates: {
geometry: {
type: 'Point',
coordinates: [-112.0372, 46.608058],
},
@ -244,7 +244,7 @@ describe('toEsDoc', () => {
test('should convert GeometryCollection feature to geo_shape ES document', () => {
const esDoc = toEsDoc(GEOMETRY_COLLECTION_FEATURE, ES_FIELD_TYPES.GEO_SHAPE);
expect(esDoc).toEqual({
coordinates: {
geometry: {
type: 'GeometryCollection',
geometries: [
{

View file

@ -375,7 +375,7 @@ export function toEsDoc(
) {
const properties = feature.properties ? feature.properties : {};
return {
coordinates:
geometry:
geoFieldType === ES_FIELD_TYPES.GEO_SHAPE
? feature.geometry
: (feature.geometry as Point).coordinates,