maptiler-js
Calculate tiles required for a given geographic extent. The coordinates are based on Global Mercator EPSG:3857 and made to work with existing web mapping libraries like Openlayers, Leaflet, MapboxGL, d3 etc..
Pass a geographic extent and zoom level (0-30). Coordinates must be Latitudes and Longitudes.
var tiles = maptiler;
Think of extent as the left, bottom, right and top sides of a box.
An object is returned representing an array of all tiles making up the extent at that particular zoom level. The extent arrays can be used to clip the source dataset. The tms/google arrays are how you save the file within the directory structure... And how the files are located by most mapping frameworks.
0: extent3857: 1971463833531266 -45886676820157 19724422274933163 -4578883742395198 extent4326: 17709960937500003 -3806539235133247 1771875 -37996162679728116 google: 12 4063 2516 tms: 12 4063 15791: ...2: ...3: ...
The rest is up to you. ☺
Redis Support
Node/io has a hard limit for memory usage. Which can be exceeded when calculating millions of tiles. I personally found anything over 800,000 caused a core dump. This can be overcome by using a memory cache store like Redis. Just make sure you have it installed. Along with a node client like node-redis.
redis = ;maptiler = ; maptilerredis; // Use Redis { redis;}The variable *tiles* is just the object store name in Redis that was allocated by maptiler maptiler;
Or if you have a small amout of tiles you can allow them to be stored in a regular javascript array.
{ console;} maptiler;
Most logic was ported from the maptiler python module. Adapted for node/io or the browser. Redis functionality is limited to server side.