Spaces:
Sleeping
Sleeping
File size: 1,703 Bytes
e7b2eb4 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | [](https://badge.fury.io/js/%40mapbox%2Fwhoots-js)
[](http://travis-ci.org/mapbox/whoots-js)
[](https://coveralls.io/github/mapbox/whoots-js?branch=master)
## whoots-js
Request tiles from WMS servers that support EPSG:3857.
This project is a JavaScript port of https://github.com/timwaters/whoots by Tim Waters.
### What is it?
Given a `z/x/y` tile coordinate like `19/154308/197167`, `whoots-js` can request imagery from an EPSG:3857 supporting WMS server like this:
```
http://geodata.state.nj.us/imagerywms/Natural2015?
bbox=-8242663.382160267,4966572.349857613,-8242586.945131982,4966648.786885899
&format=image/png&service=WMS&version=1.1.1&request=GetMap&srs=EPSG:3857
&width=256&height=256&layers=Natural2015
```
### Usage
```js
var WhooTS = require('@mapbox/whoots-js');
// Get an image url for a given tile coordinate
var baseUrl = 'http://geodata.state.nj.us/imagerywms/Natural2015';
var layer = 'Natural2015';
var url = WhooTS.getURL(baseUrl, layer, 154308, 197167, 19);
```
### Server
This project includes a sample redirecting wms proxy server in `server.js`.
`npm run server` will start a local server on port 8080 that redirects tile requests.
Valid tile requests look like:
```
http://localhost:8080/tms/{z}/{x}/{y}/{layer}/{endpoint}
http://localhost:8080/tms/19/154308/197167/Natural2015/http://geodata.state.nj.us/imagerywms/Natural2015
```
### Documentation
Complete API documentation is here: http://mapbox.github.io/whoots-js/
|