Skip to content

Commit

Permalink
Update examples
Browse files Browse the repository at this point in the history
  • Loading branch information
DenisCarriere committed Jan 20, 2017
1 parent 92157f3 commit deb2b45
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 24 deletions.
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,15 @@ Get Capabilities

```javascript
const xml = wmts.getCapabilities({
uri: 'http://localhost:5000/WMTS',
title: 'service_name',
url: 'http://localhost:5000/WMTS',
title: 'Tile Service XYZ',
identifier: 'service-123',
abstract: '© OSM data',
keyword: ['world', 'imagery', 'wmts'],
format: 'png',
minzoom: 10,
maxzoom: 18
maxzoom: 18,
bbox: [-180, -85, 180, 85]
})
```

Expand Down
23 changes: 15 additions & 8 deletions examples/browserify/bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const wmts = require('../')

console.log(`
wmts.getCapabilities({
uri: 'http://localhost:5000/WMTS',
url: 'http://localhost:5000/WMTS',
title: 'Tile Service XYZ',
identifier: 'service-123',
abstract: '© OSM data',
Expand All @@ -15,7 +15,7 @@ wmts.getCapabilities({
})
`)
const xml = wmts.getCapabilities({
uri: 'http://localhost:5000/WMTS',
url: 'http://localhost:5000/WMTS',
title: 'Tile Service XYZ',
identifier: 'service-123',
abstract: '© OSM data',
Expand All @@ -31,25 +31,28 @@ console.log(xml)
const convert = require("xml-js");
const mercator = require("global-mercator");
const utils_1 = require("./utils");
/**
* Default Values
*/
// Default Values
const MINZOOM = 0;
const MAXZOOM = 20;
const SPACES = 2;
const BBOX = [-180, -85, 180, 85];
/**
* Get Capabilities
*
* @param {Options} options Options
* @param {number} [options.spaces=2] Spaces created for XML output
* @returns {string} XML string
* @example
* const xml = wmts.getCapabilities({
* uri: 'http://localhost:5000/WMTS',
* title: 'service_name',
* url: 'http://localhost:5000/WMTS',
* title: 'Tile Service XYZ',
* identifier: 'service-123',
* abstract: '© OSM data',
* keyword: ['world', 'imagery', 'wmts'],
* format: 'png',
* minzoom: 10,
* maxzoom: 18
* maxzoom: 18,
* bbox: [-180, -85, 180, 85]
* })
*/
function getCapabilities(options) {
Expand All @@ -69,6 +72,7 @@ exports.getCapabilities = getCapabilities;
/**
* Capabilities JSON scheme
*
* @param {Options} options Options
* @param {string} options.url <required>
* @returns {ElementCompact} JSON scheme
* @example
Expand Down Expand Up @@ -151,6 +155,7 @@ exports.TileMatrix = TileMatrix;
/**
* ServiceIdentification JSON scheme
*
* @param {Options} options Options
* @param {string} options.title [required] Title
* @param {string} options.abstract Abstract
* @param {string[]} options.keywords Keywords
Expand Down Expand Up @@ -268,6 +273,7 @@ exports.Get = Get;
/**
* Capabilities.Contents JSON scheme
*
* @param {Options} options Options
* @param {string} title Title of Service
* @param {string} uri URI of Service Provider
* @returns {Element}
Expand All @@ -289,6 +295,7 @@ exports.Contents = Contents;
/**
* Capabilities.Contents.Layer JSON scheme
*
* @param {Options} options Options
* @param {string} options.title [required] Title
* @param {string} options.url [required] URL
* @param {string} options.format [required] Format 'png' | 'jpeg' | 'jpg'
Expand Down
4 changes: 2 additions & 2 deletions examples/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const wmts = require('../')

console.log(`
wmts.getCapabilities({
uri: 'http://localhost:5000/WMTS',
url: 'http://localhost:5000/WMTS',
title: 'Tile Service XYZ',
identifier: 'service-123',
abstract: '© OSM data',
Expand All @@ -14,7 +14,7 @@ wmts.getCapabilities({
})
`)
const xml = wmts.getCapabilities({
uri: 'http://localhost:5000/WMTS',
url: 'http://localhost:5000/WMTS',
title: 'Tile Service XYZ',
identifier: 'service-123',
abstract: '© OSM data',
Expand Down
23 changes: 15 additions & 8 deletions examples/webpack/bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@

console.log(`
wmts.getCapabilities({
uri: 'http://localhost:5000/WMTS',
url: 'http://localhost:5000/WMTS',
title: 'Tile Service XYZ',
identifier: 'service-123',
abstract: '© OSM data',
Expand All @@ -60,7 +60,7 @@
})
`)
const xml = wmts.getCapabilities({
uri: 'http://localhost:5000/WMTS',
url: 'http://localhost:5000/WMTS',
title: 'Tile Service XYZ',
identifier: 'service-123',
abstract: '© OSM data',
Expand All @@ -80,25 +80,28 @@
const convert = __webpack_require__(2);
const mercator = __webpack_require__(37);
const utils_1 = __webpack_require__(38);
/**
* Default Values
*/
// Default Values
const MINZOOM = 0;
const MAXZOOM = 20;
const SPACES = 2;
const BBOX = [-180, -85, 180, 85];
/**
* Get Capabilities
*
* @param {Options} options Options
* @param {number} [options.spaces=2] Spaces created for XML output
* @returns {string} XML string
* @example
* const xml = wmts.getCapabilities({
* uri: 'http://localhost:5000/WMTS',
* title: 'service_name',
* url: 'http://localhost:5000/WMTS',
* title: 'Tile Service XYZ',
* identifier: 'service-123',
* abstract: '© OSM data',
* keyword: ['world', 'imagery', 'wmts'],
* format: 'png',
* minzoom: 10,
* maxzoom: 18
* maxzoom: 18,
* bbox: [-180, -85, 180, 85]
* })
*/
function getCapabilities(options) {
Expand All @@ -118,6 +121,7 @@
/**
* Capabilities JSON scheme
*
* @param {Options} options Options
* @param {string} options.url <required>
* @returns {ElementCompact} JSON scheme
* @example
Expand Down Expand Up @@ -200,6 +204,7 @@
/**
* ServiceIdentification JSON scheme
*
* @param {Options} options Options
* @param {string} options.title [required] Title
* @param {string} options.abstract Abstract
* @param {string[]} options.keywords Keywords
Expand Down Expand Up @@ -317,6 +322,7 @@
/**
* Capabilities.Contents JSON scheme
*
* @param {Options} options Options
* @param {string} title Title of Service
* @param {string} uri URI of Service Provider
* @returns {Element}
Expand All @@ -338,6 +344,7 @@
/**
* Capabilities.Contents.Layer JSON scheme
*
* @param {Options} options Options
* @param {string} options.title [required] Title
* @param {string} options.url [required] URL
* @param {string} options.format [required] Format 'png' | 'jpeg' | 'jpg'
Expand Down
10 changes: 7 additions & 3 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,15 @@ const BBOX: BBox = [-180, -85, 180, 85]
* @returns {string} XML string
* @example
* const xml = wmts.getCapabilities({
* uri: 'http://localhost:5000/WMTS',
* title: 'service_name',
* url: 'http://localhost:5000/WMTS',
* title: 'Tile Service XYZ',
* identifier: 'service-123',
* abstract: '© OSM data',
* keyword: ['world', 'imagery', 'wmts'],
* format: 'png',
* minzoom: 10,
* maxzoom: 18
* maxzoom: 18,
* bbox: [-180, -85, 180, 85]
* })
*/
export function getCapabilities(options: Options): string {
Expand Down

0 comments on commit deb2b45

Please sign in to comment.