-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
db113de
commit d1205fb
Showing
8 changed files
with
178 additions
and
59 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
|
||
export { EMSClient } from '../../../../core_plugins/tile_map/common/ems_client'; |
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; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
|
||
import { GIS_API_PATH } from './constants'; | ||
|
||
export async function getEMSResources(emsClient, includeElasticMapsService, licenseUid, useCors) { | ||
|
||
if (!includeElasticMapsService) { | ||
return { | ||
fileLayers: [], | ||
tmsServices: [] | ||
}; | ||
} | ||
|
||
emsClient.addQueryParams({ license: licenseUid }); | ||
const fileLayerObjs = await emsClient.getFileLayers(); | ||
const tmsServicesObjs = await emsClient.getTMSServices(); | ||
|
||
const fileLayers = fileLayerObjs.map(fileLayer => { | ||
//backfill to static settings | ||
const format = fileLayer.getDefaultFormatType(); | ||
const meta = fileLayer.getDefaultFormatMeta(); | ||
|
||
return { | ||
name: fileLayer.getDisplayName(), | ||
origin: fileLayer.getOrigin(), | ||
id: fileLayer.getId(), | ||
created_at: fileLayer.getCreatedAt(), | ||
attribution: fileLayer.getHTMLAttribution(), | ||
attributions: fileLayer.getAttributions(), | ||
fields: fileLayer.getFieldsInLanguage(), | ||
url: useCors ? fileLayer.getDefaultFormatUrl() : `../${GIS_API_PATH}/data/ems?id=${encodeURIComponent(fileLayer.getId())}`, | ||
format: format, //legacy: format and meta are split up | ||
meta: meta, //legacy, format and meta are split up, | ||
emsLink: fileLayer.getEMSHotLink() | ||
}; | ||
}); | ||
|
||
const tmsServices = tmsServicesObjs.map(tmsService => { | ||
return { | ||
origin: tmsService.getOrigin(), | ||
id: tmsService.getId(), | ||
minZoom: tmsService.getMinZoom(), | ||
maxZoom: tmsService.getMaxZoom(), | ||
attribution: tmsService.getHTMLAttribution(), | ||
attributionMarkdown: tmsService.getMarkdownAttribution(), | ||
url: tmsService.getUrlTemplate() | ||
}; | ||
}); | ||
|
||
return { fileLayers, tmsServices }; | ||
} |
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