-
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.
add vector source for layers in kibana.yml
- Loading branch information
1 parent
b9a0d80
commit 61d6d84
Showing
5 changed files
with
96 additions
and
19 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { AVectorSource } from './vector_source'; | ||
|
||
export class KbnYmlVectorSource extends AVectorSource { | ||
|
||
constructor(options) { | ||
super(options); | ||
} | ||
|
||
async getAvailableLayers() { | ||
return this._kbnCoreAPI.mapConfig.regionmap.layers; | ||
} | ||
|
||
|
||
} |
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 |
---|---|---|
|
@@ -12,3 +12,4 @@ export class ASource { | |
} | ||
|
||
} | ||
|
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,54 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
|
||
import { ASource } from './source'; | ||
|
||
export class AVectorSource extends ASource { | ||
|
||
constructor(options) { | ||
super(options); | ||
this._kbnCoreAPI = options.kbnCoreAPI; | ||
this._layerName = options.layerName; | ||
} | ||
|
||
getDisplayName() { | ||
return this._layerName; | ||
} | ||
|
||
async getAvailableLayers() { | ||
return []; | ||
} | ||
|
||
async getGeoJsonFeatureCollection() { | ||
|
||
const files = await this.getAvailableLayers(); | ||
const layer = files.find((file) => { | ||
return file.name === this._layerName; | ||
}); | ||
|
||
if (!layer) { | ||
return null; | ||
} | ||
|
||
if (layer.format) { | ||
if ( | ||
(layer.format.type && layer.format.type !== 'geojson') || | ||
(!layer.format.type && layer.format !== 'geojson') | ||
) { | ||
console.log('is not geojson'); | ||
throw new Error('Only geojson is implemented now'); | ||
} | ||
} | ||
|
||
const response = await fetch(layer.url); | ||
return response.json(); | ||
|
||
} | ||
|
||
|
||
} | ||
|