From e6404cb24a06eb141e81945790c3c10589c229cd Mon Sep 17 00:00:00 2001 From: Nathan Reese Date: Thu, 21 Nov 2019 09:10:36 -0700 Subject: [PATCH] [Maps] fix tooltips for geojson source (#51251) --- .../client_file_source/geojson_file_source.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/x-pack/legacy/plugins/maps/public/layers/sources/client_file_source/geojson_file_source.js b/x-pack/legacy/plugins/maps/public/layers/sources/client_file_source/geojson_file_source.js index 6c298352cc03a..11a02d58a9198 100644 --- a/x-pack/legacy/plugins/maps/public/layers/sources/client_file_source/geojson_file_source.js +++ b/x-pack/legacy/plugins/maps/public/layers/sources/client_file_source/geojson_file_source.js @@ -9,7 +9,8 @@ import React from 'react'; import { ES_GEO_FIELD_TYPE, GEOJSON_FILE, - ES_SIZE_LIMIT + ES_SIZE_LIMIT, + FEATURE_ID_PROPERTY_NAME } from '../../../../common/constants'; import { ClientFileCreateSourceEditor } from './create_client_file_source_editor'; import { ESSearchSource } from '../es_search_source'; @@ -136,12 +137,16 @@ export class GeojsonFileSource extends AbstractVectorSource { } async getGeoJsonWithMeta() { - const copiedPropsFeatures = this._descriptor.__featureCollection.features - .map(feature => ({ + const copiedPropsFeatures = this._descriptor.__featureCollection.features.map((feature, index) => { + const properties = feature.properties ? { ...feature.properties } : {}; + properties[FEATURE_ID_PROPERTY_NAME] = index; + return { type: 'Feature', geometry: feature.geometry, - properties: feature.properties ? { ...feature.properties } : {} - })); + properties, + }; + }); + return { data: { type: 'FeatureCollection',