GithubHelp home page GithubHelp logo

brncsk / ol3-tilecache Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ghettovoice/ol-tilecache

1.0 1.0 0.0 53 KB

OpenLayer 3 tile url function to load tile seeded with TileCache URL scheme

License: Other

HTML 11.11% JavaScript 88.89%

ol3-tilecache's Introduction

Build Status view on npm

TileCache url function for OpenLayers 3

Allows create custom ol.TileUrlFunctionType to load tiles seeded with TileCache.

Installation

Install it thought NPM or Bower:

npm install openlayers ol3-tilecache
bower install ol3-tilecache

Or download the latest version archive and add it with script tag:

<script src="ol3-tilecache/dist/bundle.min.js"></script>

Usage

Plugin is packed into UMD wrapper, import it with CommonJS or ES6:

import TileCacheUrlFunction from 'ol3-tilecache';
const TileCacheUrlFunction = require('ol3-tilecache');

In Browser environment it is available as ol.TileCacheUrlFunction.

Members

createTileUrlFunction

Arguments

  • url : string URL template
  • tileGrid : ol.tilegrid.TileGrid Custom tile grid. Default is EPSG:3857 x/y/z grid
  • extent : ol.Extent Tile grid extent. Default is EPSG:3857 extent

Returns: ol.TileUrlFunctionType

Available URL placeholders:

z | 0z - zoom level (simple number or padded with zero)
x1, x2, x3 - X axis index parts (remnant from dividing the tile X index on 10^9 broken down by 3 digits)
y1, y2, y3 - Y axis index parts (remnant from dividing the tile Y index on 10^9 broken down by 3 digits)

Example usage:

import ol from 'openlayers';
import TileCacheUrlFunction from 'ol3-tilecache';

const map = new ol.Map({
    target: 'map',
    view: new ol.View({
        projection: 'EPSG:3857',
        center: [4189972.14, 7507950.67],
        zoom: 5
    }),
    layers: [
        new ol.layer.Tile({
            source: new ol.source.XYZ({
                tileUrlFunction: ol.TileCacheUrlFunction.createTileUrlFunction('http://tilecache_server/{0z}/{x1}/{x2}/{x3}/{-y1}/{-y2}/{-y3}.png')
            })
        })
    ]
});

License

MIT (c) 2016, Vladimir Vershinin

ol3-tilecache's People

Contributors

brncsk avatar ghettovoice avatar

Stargazers

 avatar

Watchers

 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.