aboutsummaryrefslogtreecommitdiff
path: root/utils/maketiles.js
blob: 29b0c2786d4aa981900c47362709c4ab2c9d5e73 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// A converter from the unusable tileUpdate format (the tiles object) to a `locs` list of tile coordinates and `tilespaces`---an object linking `locs` to small spaces which contain the tile data.

const tilekeys = require('../utils/tilekeys');
const Space = require('../space');

module.exports = (tiles) =>{
  let locs = tilekeys(tiles);
  let tilespaces = {};
  for (loc of locs){
    tilespaces[loc] = new Space();
    tilespaces[loc].fromfetch(tiles, [loc, loc], conform=false);
  }
  return {'tilespaces':tilespaces, 'locs':locs};
}