Skip to content

Commit

Permalink
Update with CDN
Browse files Browse the repository at this point in the history
  • Loading branch information
DenisCarriere committed Jan 25, 2017
1 parent e6f3492 commit 4504a9f
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 226 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ pids
*.pid
*.seed

wmts.js
wmts.min.js

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

Expand Down
258 changes: 37 additions & 221 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,254 +16,70 @@
$ npm install --save wtms
```

## Usage
**Download CDN** - [https://unpkg.com/wmts/wmts.min.js](https://unpkg.com/wmts/wmts.min.js)

### getCapabilities

Get Capabilities

**Parameters**

- `options` **\[Options](default {})** Options
- `options.spaces` **\[[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)]** Spaces created for XML output (optional, default `2`)
- `options.title` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Title of service
- `options.format` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Format 'png' | 'jpeg' | 'jpg'
- `options.url` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** URL of WMTS service
- `options.fees` **\[[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)]** Fees
- `options.abstract` **\[[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)]** Abstract
- `options.identifier` **\[[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)]** Identifier
- `options.keywords` **\[[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)>]** Keywords
- `options.bbox` **\[BBox]** BBox [west, south, east, north] (optional, default `[-180,-85,180,85]`)
- `options.accessConstraints` **\[[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)]** Access Constraints
- `minzoom` **\[[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)]** Minimum zoom level (optional, default `0`)
- `maxzoom` **\[[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)]** Maximum zoom level (optional, default `22`)

**Examples**
## Quickstart

```javascript
const xml = wmts.getCapabilities({
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,
bbox: [-180, -85, 180, 85]
})
//=xml
```

Returns **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** XML string

### Capabilities

Capabilities JSON scheme

**Parameters**

- `options` **\[Options](default {})** Options
- `options.url` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** URL of WMTS service

**Examples**

```javascript
Capabilities({
url: 'http://localhost:5000'
})
```xml
<declaration version="1.0" encoding="utf-8"/>
<Capabilities xmlns="http://www.opengis.net/wmts/1.0" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:gml="http://www.opengis.net/gml" xsi:schemaLocation="http://www.opengis.net/wmts/1.0 http://schemas.opengis.net/wmts/1.0/wmtsGetCapabilities_response.xsd" version="1.0.0">
<ServiceMetadataURL xlink:href="http://localhost:80/WMTS/1.0.0/WMTSCapabilities.xml"/>
<ows:ServiceIdentification>
<ows:ServiceTypeVersion>1.0.0</ows:ServiceTypeVersion>
<ows:ServiceType>OGC WMTS</ows:ServiceType>
...
```

Returns **ElementCompact** JSON scheme

### GoogleMapsCompatible
## API

GoogleMapsCompatible JSON scheme

**Parameters**
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

- `minzoom` **\[[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)]** Minimum zoom level (optional, default `0`)
- `maxzoom` **\[[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)]** Maximum zoom level (optional, default `22`)

**Examples**

```javascript
wmts.GoogleMapsCompatible(10, 17)
```

Returns **ElementCompact** JSON scheme

### TileMatrix

TileMatrix JSON scheme

**Parameters**

- `minzoom` **\[[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)]** Minimum zoom level (optional, default `0`)
- `maxzoom` **\[[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)]** Maximum zoom level (optional, default `22`)

**Examples**

```javascript
wmts.TileMatrix(0, 18)
```

Returns **ElementCompact** JSON scheme

### ServiceIdentification
### getCapabilities

ServiceIdentification JSON scheme
Get Capabilities

**Parameters**

- `options` **\[Options](default {})** Options
- `options` **Options?= {}** Options
- `options.url` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** URL of WMTS service
- `options.title` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Title of service
- `options.abstract` **\[[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)]** Abstract
- `options.keywords` **\[[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)>]** Keywords
- `options.accessConstraints` **\[[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)]** Access Constraints
- `options.fees` **\[[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)]** Fees

**Examples**

```javascript
ServiceIdentification({
title: 'Service name',
abstract: 'A long description of this service',
keywords: ['world', 'wmts', 'imagery']
})
```

Returns **ElementCompact** JSON scheme

### Keywords

Keywords JSON scheme

**Parameters**

- `keywords` **\[[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)>]**

**Examples**

```javascript
Keywords(['world', 'imagery', 'wmts'])
```

Returns **ElementCompact** JSON scheme

### OperationsMetadata

OperationsMetadata JSON scheme

**Parameters**

- `url` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** URL of Service Provider

**Examples**

```javascript
OperationsMetadata('http://localhost:5000/wmts')
```

Returns **ElementCompact** JSON scheme

### Operation

Operation JSON scheme

**Parameters**

- `operation` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Name of operation
- `restful` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** URL for RESTful
- `kvp` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** URL for KVP

Returns **ElementCompact** JSON scheme

### Get

Get JSON scheme

**Parameters**

- `url` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** URL of Service Provider
- `value` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Type of Get 'RESTful' | 'KVP'

**Examples**

```javascript
Get()
//= Get > Constraint > AllowedValues> Value
```

Returns **ElementCompact** JSON scheme

### Contents

Capabilities.Contents JSON scheme

**Parameters**

- `options` **\[Options](default {})** Options

**Examples**

```javascript
Contents()
//= Contents > [Layer, TileMatrixSet, TileMatrixSet]
```

Returns **[Element](https://developer.mozilla.org/en-US/docs/Web/API/Element)**

### Layer

Capabilities.Contents.Layer JSON scheme

**Parameters**

- `options` **\[Options](default {})** Options
- `options.title` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Title
- `options.url` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** URL
- `options.format` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Format 'png' | 'jpeg' | 'jpg'
- `options.abstract` **\[[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)]** Abstract
- `options.identifier` **\[[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)]** Identifier
- `options.bbox` **\[BBox]** BBox [west, south, east, north] (optional, default `[-180,-85,180,85]`)
- `options.minzoom` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Minimum zoom level (optional, default `0`)
- `options.maxzoom` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Maximum zoom level (optional, default `22`)
- `options.accessConstraints` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)?** Access Constraints
- `options.fees` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)?** Fees
- `options.abstract` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)?** Abstract
- `options.identifier` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)?** Identifier
- `options.keywords` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)>?** Keywords
- `options.bbox` **BBox?** BBox [west, south, east, north] (optional, default `[-180,-85,180,85]`)
- `options.spaces` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)?** Spaces created for XML output (optional, default `2`)

**Examples**

```javascript
Layer({
title: 'Tile Service'
url: 'http://localhost:5000/wmts'
format: 'jpg'
const xml = wmts.getCapabilities({
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,
bbox: [-180, -85, 180, 85]
})
```

Returns **ElementCompact** JSON scheme

### clean

Clean remove undefined attributes from object

**Parameters**

- `obj` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)**

### normalize

Normalize URL

**Parameters**

- `url` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)**

Returns **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Normalized URL

### error

Pretty Error message

**Parameters**

- `message` **...Any**
Returns **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** XML string

## License

Expand Down

0 comments on commit 4504a9f

Please sign in to comment.