Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store the API constants in a dict #4673

Merged
merged 1 commit into from
Feb 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/src/Map.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import {
} from 'ol/extent.js';
import {get as getProjection} from 'ol/proj.js';

import * as constants from './constants.js';
import constants from './constants.js';

import {getFeaturesFromLayer} from './Querent.js';
import * as themes from './Themes.js';
Expand Down
4 changes: 2 additions & 2 deletions api/src/Themes.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import TileWMS from 'ol/source/TileWMS.js';
import WMTS, {optionsFromCapabilities} from 'ol/source/WMTS.js';
import TileLayer from 'ol/layer/Tile.js';

import {themesUrl} from './constants.js';
import constants from './constants.js';

/**
* @type {Promise<import('gmf/themes.js').GmfThemesResponse>}
* @hidden
*/
const themesPromise = fetch(themesUrl).then(response => response.json());
const themesPromise = fetch(constants.themesUrl).then(response => response.json());

/**
* @type {Promise<Map<string, overlayDefinition>>|undefined}
Expand Down
53 changes: 12 additions & 41 deletions api/src/constants.js
Original file line number Diff line number Diff line change
@@ -1,45 +1,16 @@
import EPSG21781 from '@geoblocks/proj/src/EPSG_21781.js';
import EPSG2056 from '@geoblocks/proj/src/EPSG_2056.js';

/**
* @type {string}
* @hidden
*/
export const themesUrl =
'https://geomapfish-demo-dc.camptocamp.com/2.4/themes?version=2&background=background';

/**
* @type {Array<string>}
* @hidden
*/
export const supportedProjections = [EPSG21781, EPSG2056];

/**
* @type {string}
* @hidden
*/
export const projection = EPSG21781;


/**
* @type {Array.<number>}
* @hidden
*/
export const resolutions = [250, 100, 50, 20, 10, 5, 2, 1, 0.5, 0.25, 0.1, 0.05];


/**
* @type {Array.<number>}
* @hidden
*/
export const extent = [420000, 30000, 660000, 350000];


/**
* The name of the layer to use as background. May be a single value
* (WMTS) or a comma-separated list of layer names (WMS).
* @type {string}
* @hidden
*/
//export const backgroundLayer = 'default'; // WMS
export const backgroundLayer = 'Test aus Olten'; // WMTS
export default {
themesUrl: 'https://geomapfish-demo-dc.camptocamp.com/2.4/themes?version=2&background=background',
projection: EPSG21781,
supportedProjections: [EPSG21781, EPSG2056],
resolutions: [250, 100, 50, 20, 10, 5, 2, 1, 0.5, 0.25, 0.1, 0.05],
extent: [420000, 30000, 660000, 350000],
/**
* The name of the layer to use as background. May be a single value
* (WMTS) or a comma-separated list of layer names (WMS).
*/
backgroundLayer: 'Test aus Olten',
};