/styles/v1/{username}/{style_id}/tiles/{tileSize}/{z}/{x}/{y}{@2x}
182958
def tile(self, username, style_id, z, x, y, tile_size=512, retina=False):
        ""
        if tile_size not in (256, 512):
            raise errors.ImageSizeError('tile_size must be 256 or 512 pixels')

        pth = '/{username}/{style_id}/tiles/{tile_size}/{z}/{x}/{y}'

        values = dict(username=username, style_id=style_id,
                      tile_size=tile_size, z=z, x=x, y=y)

        uri = URITemplate(self.baseuri + pth).expand(**values)
        if retina:
            uri += '@2x'
        res = self.session.get(uri)
        self.handle_http_error(res)
        return res
852367
function TMXMapInfo (opts) {
    this.tilesets = []
    this.layers = []
    this.objectGroups = []
    this.properties = {}
    this.tileProperties = {}
    this.filename = opts.filename || opts.file || ''

    this.parseXMLFile(opts)
}
798730
@Override
    public void renderTile(Graphic g, MapTile map, Tile tile, int x, int y)
    {
        final SpriteTiled sprite = map.getSheet(tile.getSheet());
        sprite.setLocation(x, y);
        sprite.setTile(tile.getNumber());
        sprite.render(g);
    }
399779
function GridTileAnimator(grid, tiles) {
    grid.element.css(grid.style);
    tiles.forEach(function(t) {
      t.element.css(t.style);
    });
  }
1277740
def tile_bbox(self, tile_indices):
        
        (z, x, y) = tile_indices
        topleft = (x * self.tilesize, (y + 1) * self.tilesize)
        bottomright = ((x + 1) * self.tilesize, y * self.tilesize)
        nw = self.unproject_pixels(topleft, z)
        se = self.unproject_pixels(bottomright, z)
        return nw + se
369450
function(tile) {
    var x = tile.x;
    var y = tile.y;
    var xUp = x + 1 < xUpperBound;
    var xDown = x >= 0;
    var yUp = y + 1 < yUpperBound;
    var yDown = y >= 0;

    var adjacents = [];
    if (xUp) {
      adjacents.push({x: x + 1, y: y});
      if (yUp) {
        adjacents.push({x: x + 1, y: y + 1});
      }
      if (yDown) {
        adjacents.push({x: x + 1, y: y - 1});
      }
    }
    if (xDown) {
      adjacents.push({x: x - 1, y: y});
      if (yUp) {
        adjacents.push({x: x - 1, y: y + 1});
      }
      if (yDown) {
        adjacents.push({x: x - 1, y: y - 1});
      }
    }
    if (yUp) {
      adjacents.push({x: x, y: y + 1});
    }
    if (yDown) {
      adjacents.push({x: x, y: y - 1});
    }
    return adjacents;
  }
492046
function() {
        var context;
        if (this.cacheImageRecord) {
            context = this.cacheImageRecord.getRenderedContext();
        } else if (this.context2D) {
            context = this.context2D;
        } else {
            $.console.warn(
                '[Tile.drawCanvas] attempting to get tile scale %s when tile\'s not cached',
                this.toString());
            return 1;
        }
        return context.canvas.width / (this.size.x * $.pixelDensityRatio);
    }
18148
function getCoordinates(location) {
  var tile_width = 40;
  var x = location.r * tile_width;
  var y = location.c * tile_width;
  return {x: x, y: y};
}
526666
def is_valid_tile(self, x, y):
        """"""
        x = int(x)
        y = int(y)

        if x < 0:
            return False
        if y < 0:
            return False
        if x > self.size_in_tiles.X:
            return False
        if y > self.size_in_tiles.Y:
            return False

        return True
411181
def get_tile_url(self, zoom, x, y):
        
        return self.tile_url.format(**{"$z": zoom, "$x": x, "$y": y})
191995
function TMXTiledMap (opts) {
    TMXTiledMap.superclass.constructor.call(this, opts)

    this.anchorPoint = ccp(0, 0)

    var mapInfo

    var initialize = function () {
        this.mapSize        = mapInfo.mapSize
        this.tileSize       = mapInfo.tileSize
        this.mapOrientation = mapInfo.orientation
        this.objectGroups   = mapInfo.objectGroups
        this.properties     = mapInfo.properties
        this.tileProperties = mapInfo.tileProperties

        // Add layers to map
        var idx = 0
        mapInfo.layers.forEach(function (layerInfo) {
            if (layerInfo.visible) {
                var child = this.parseLayer({layerInfo: layerInfo, mapInfo: mapInfo})
                this.addChild({child: child, z: idx, tag: idx})

                var childSize   = child.contentSize
                var currentSize = this.contentSize
                currentSize.width  = Math.max(currentSize.width,  childSize.width)
                currentSize.height = Math.max(currentSize.height, childSize.height)
                this.contentSize = currentSize

                idx++
            }
        }.bind(this))
    }.bind(this)


    if (opts.file) {
        mapInfo = new TMXMapInfo({file: opts.file})
        initialize()
    } else if (opts.url) {
        var xhr = new XMLHttpRequest
        xhr.onreadystatechange = function () {
            if (xhr.readyState == 4) {
                var url = opts.url

                // Create absolute URL
                if (/^\/\//.test(url)) {
                    // URL prefixed with double slash
                    url = window.location.protocol + url
                } else if (/^\//.test(url)) {
                    // URL with single slash prefix
                    url = window.location.protocol + "//" + window.location.hostname + url
                } else {
                    url = window.location.href.replace(/\/[^\/]*$/, '/') + url
                }

                mapInfo = new TMXMapInfo({filename: url, xml: xhr.responseText})
                initialize()
            }
        }
        xhr.open('GET', opts.url, true)
        xhr.send(null)
    } else if (opts.xml) {
        mapInfo = new TMXMapInfo({xml: opts.xml})
        initialize()
    }
}
782240
function tileRsys (x, y, z) {
    let max = Math.pow(2, z);
    return { scale: 1 / max, center: { x: 2 * (x + 0.5) / max - 1, y: 1 - 2 * (y + 0.5) / max } };
}
1166529
function pixelToTileCoords(x, y, v) {
         var ret = v || new me.Vector2d();
         return ret.set(x / this.tilewidth, y / this.tileheight);
       }
1104770
function(style)
	{
		if (style != null)
		{
			var pairs = style.split(';');
			var stylename = pairs[0];
			
			if (stylename.indexOf('=') < 0)
			{
				return stylename;
			}
		}
				
		return '';
	}
34307
function() {

            var step = this.step;

            return {
                x: -step,
                y: -step,
                width: 2 * step,
                height: 2 * step
            };
        }
495272
function overzoomGeometry(rings, nativeTile, newExtent, newTile) {
  var diffZ = newTile.level - nativeTile.level;
  if (diffZ === 0) {
    return rings;
  } else {
    var newRings = [];
    // (offsetX, offsetY) is the (0,0) of the new tile
    var offsetX = newExtent * (newTile.x - (nativeTile.x << diffZ));
    var offsetY = newExtent * (newTile.y - (nativeTile.y << diffZ));
    for (var i = 0; i < rings.length; i++) {
      var ring = [];
      for (var i2 = 0; i2 < rings[i].length; i2++) {
        ring.push(rings[i][i2].sub(new Point(offsetX, offsetY)));
      }
      newRings.push(ring);
    }
    return newRings;
  }
}
770842
function( level ) {

        if(this.emulateLegacyImagePyramid) {
            return $.TileSource.prototype.getTileWidth.call(this, level);
        }

        var scaleFactor = Math.pow(2, this.maxLevel - level);

        if (this.tileSizePerScaleFactor && this.tileSizePerScaleFactor[scaleFactor]) {
            return this.tileSizePerScaleFactor[scaleFactor].width;
        }
        return this._tileWidth;
    }