Giter Site home page Giter Site logo

tilelive-promise's Introduction

Build Status

tilelive-promise

Adds an extended Promise-based interface to the existing tilelive components, or exposes new components to older tilelive systems.

This module supplies either a modern or a legacy wrapper for the tilelive (TileSource) object.

For sources that implement getTile(), getGrid() and getInfo(), creates a new getAsync() generic function.

For sources that implement getAsync(), supplies the callback-based getTile(), getGrid() and getInfo().

If both getTile() and getAsync() are present, the instance is returned unmodified.

Promise<object> getAsync(options)

The new function allows to treat get*() as promises, permits additional parameter passing with each request (e.g. scaling, format, language), and allow non-tile data to be retrieved through the same system.

Both tile and grid requests via GetAsync() may also use an index parameter instead of (x,y) coordinates. Index is a single 56bit quadtile integer, allowing up to zoom 26.

getAsync() returns a Promise that resolves to an object. The content of the object depends on the type.

Legacy vs New interface

get*() tilelive API getAsync() API
getTile(z, x, y,
  callback<err, tile, headers>)
Promise{data, headers} getAsync({z, x, y})
or
Promise{data, headers} getAsync(
  {type:'tile', z, x, y})
getGrid(z, x, y,
  callback<err, grid, headers>)
Promise{data, headers} getAsync(
  {type:'grid', z, x, y})
getInfo(callback<err, info>) Promise{data} getAsync({type:'info'})

tilelive-promise's People

Contributors

adamwight avatar nyurik avatar wmde-fisch avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.