Skip to content

A nodejs map tile file reader coordinating by X,Y,Z.

License

Notifications You must be signed in to change notification settings

fuzhenn/tiler-file

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tiler-file

Circle CI

A nodejs map tile file reader coordinating by X,Y,Z.

Introduction

This is a map tile file reader for map tiles in XYZ schema.

Because the path rule to store tile files is arbitrary, a path template phrase is needed to interprate XYZ to a actual file path.

lodash is used here as the template engine. You can see how to use it in the example below.

See Also

tiler-arcgis-file: a nodejs map tile reader for exploded tiles by ESRI ArcGIS

tiler-arcgis-bundle: a nodejs map tile reader for compact tiles by ESRI ArcGIS 10.0-10.2

Install

npm install tiler-file

Usage

var Tiler = require('tiler-file');
//template of the file path, lodash's template is used here.
//x, y, z is the tile's coordinate values.
var tiler = new Tiler(
    __dirname+'/sample/<%- z %>/<%- parseInt(x/10) %>/<%- parseInt(y/10) %>/<%- x %>_<%- y %>.png'
);
//tile's x,y,z
//actual path is __dirname+'/sample/6/5/2/53_25.png 
tiler.getTile(53, 25, 6, function(error, tile) {
    if (error) {
        throw error;
    }
    if (error) {
        throw error;
    }
    console.log(tile.lastModified);
    fs.writeFileSync('53_25.png', tile.data);
});

About

A nodejs map tile file reader coordinating by X,Y,Z.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published