-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Maps] deprecate 'map.regionmap' kibana config and 'Configured GeoJSO…
…N' source (#103373) * [Maps] deprecate 'map.regionmap' kibana config and 'Configured GeoJSON' source * clean up message * revert change to KibanaRegionmapSource.getGeoJsonWithMeta * tslint * doc updates * clean up Co-authored-by: Kibana Machine <[email protected]>
- Loading branch information
1 parent
1965315
commit bf6be21
Showing
15 changed files
with
144 additions
and
189 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 0 additions & 55 deletions
55
x-pack/plugins/maps/public/classes/sources/kibana_regionmap_source/create_source_editor.js
This file was deleted.
Oops, something went wrong.
56 changes: 56 additions & 0 deletions
56
x-pack/plugins/maps/public/classes/sources/kibana_regionmap_source/fetch_geojson.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import _ from 'lodash'; | ||
import { i18n } from '@kbn/i18n'; | ||
import { FeatureCollection } from 'geojson'; | ||
import * as topojson from 'topojson-client'; | ||
import { GeometryCollection } from 'topojson-specification'; | ||
import fetch from 'node-fetch'; | ||
|
||
export enum FORMAT_TYPE { | ||
GEOJSON = 'geojson', | ||
TOPOJSON = 'topojson', | ||
} | ||
|
||
export async function fetchGeoJson( | ||
fetchUrl: string, | ||
format: FORMAT_TYPE, | ||
featureCollectionPath: string | ||
): Promise<FeatureCollection> { | ||
let fetchedJson; | ||
try { | ||
const response = await fetch(fetchUrl); | ||
if (!response.ok) { | ||
throw new Error('Request failed'); | ||
} | ||
fetchedJson = await response.json(); | ||
} catch (e) { | ||
throw new Error( | ||
i18n.translate('xpack.maps.util.requestFailedErrorMessage', { | ||
defaultMessage: `Unable to fetch vector shapes from url: {fetchUrl}`, | ||
values: { fetchUrl }, | ||
}) | ||
); | ||
} | ||
|
||
if (format === FORMAT_TYPE.GEOJSON) { | ||
return fetchedJson; | ||
} | ||
|
||
if (format === FORMAT_TYPE.TOPOJSON) { | ||
const features = _.get(fetchedJson, `objects.${featureCollectionPath}`) as GeometryCollection; | ||
return topojson.feature(fetchedJson, features); | ||
} | ||
|
||
throw new Error( | ||
i18n.translate('xpack.maps.util.formatErrorMessage', { | ||
defaultMessage: `Unable to fetch vector shapes from url: {format}`, | ||
values: { format }, | ||
}) | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 0 additions & 39 deletions
39
...ins/maps/public/classes/sources/kibana_regionmap_source/kibana_regionmap_layer_wizard.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.