Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@mapbox/whoots-js

mapbox6.7mISC3.1.0

Request tiles from WMS servers that support EPSG:3857

WMS, tiles, EPSG:3857

readme

npm version Build Status Coverage Status

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

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/

changelog

Breaking changes, which may affect downstream projects are marked with a :warning:

3.1.0

2018-Jul-12
  • Replace legacy Rollup jsnext:main with now standard module (#74)
  • :warning: Drop support for Node 4

3.0.0

2017-Feb-13
  • :warning: whoots-js is now a scoped package under the @mapbox namespace

2.1.0

Jul 15, 2016
  • Release as ES6 module alongside UMD build, add jsnext:main to package.json

2.0.0

Jun 1, 2016
  • :warning: Refactor for a classless API

1.1.0

May 23, 2016
  • Make getTileBbox and getMercCoords public

1.0.0

May 23, 2016
  • Initial release