return the pixel position corresponding of the specified tile
@ignore
967536
function (x, y, v) {
            var tileX = Math.floor(x),
                tileY = Math.floor(y);
            var ret = v || new me.Vector2d();

            if (this.staggerX) {
                ret.y = tileY * (this.tileheight + this.sidelengthy);
                if (this.doStaggerX(tileX)) {
                    ret.y += this.rowheight;
                }
                ret.x = tileX * this.columnwidth;
            } else {
                ret.x = tileX * (this.tilewidth + this.sidelengthx);
                if (this.doStaggerY(tileY)) {
                    ret.x += this.columnwidth;
                }
                ret.y = tileY * this.rowheight;
            }

            return ret;
        }
754657
function(pixel) {
        $.console.assert(this.viewer,
            "[Viewport.imageToWindowCoordinates] the viewport must have a viewer.");
        var viewerCoordinates = this.imageToViewerElementCoordinates(pixel);
        return viewerCoordinates.plus(
                $.getElementPosition(this.viewer.element));
    }
589258
def get_tile_image(self, x, y, layer):
        
        try:
            assert (x >= 0 and y >= 0)
        except AssertionError:
            raise ValueError

        try:
            layer = self.layers[layer]
        except IndexError:
            raise ValueError

        assert (isinstance(layer, TiledTileLayer))

        try:
            gid = layer.data[y][x]
        except (IndexError, ValueError):
            raise ValueError
        except TypeError:
            msg = "Tiles must be specified in integers."
            logger.debug(msg)
            raise TypeError

        else:
            return self.get_tile_image_by_gid(gid)
1361738
public Coordinate tileTopLeft(int tx, int ty, int zoomLevel) {
        int px = tx * tileSize;
        int py = ty * tileSize;
        Coordinate result = pixelsToMeters(px, py, zoomLevel);
        return result;
    }
1209516
def get_pixel(x,y)
      index = (y*@width + x)
      pointindex = index*3
      Color.from_rgba(
        @array[pointindex+2].ord,
        @array[pointindex+1].ord,
        @array[pointindex].ord,
        @alpha ? @alpha[index].ord : 255
        )

    end
106980
def pixel(bounding_box)
      x, y = MapKit.latlng2pixel(@lat, @lng, bounding_box.zoom)
      tile_x, tile_y = MapKit.latlng2pixel(bounding_box.top, bounding_box.left, bounding_box.zoom)
      [x-tile_x, y-tile_y]
    end
505411
public float getFloatPixelValue(GriddedTile griddedTile, Double value) {

		double pixel = 0;
		if (value == null) {
			if (griddedCoverage != null) {
				pixel = griddedCoverage.getDataNull();
			}
		} else {
			pixel = valueToPixelValue(griddedTile, value);
		}

		float pixelValue = (float) pixel;

		return pixelValue;
	}
146023
private static TileMatrix getTileMatrixAtLengthIndex(
			List<TileMatrix> tileMatrices, int index) {
		return tileMatrices.get(tileMatrices.size() - index - 1);
	}
548296
def tileAddress(self, zoom, point):
        ""
        [x, y] = point
        assert x <= self.MAXX and x >= self.MINX
        assert y <= self.MAXY and y >= self.MINY
        assert zoom in range(0, len(self.RESOLUTIONS))

        tileS = self.tileSize(zoom)
        offsetX = abs(x - self.MINX)
        if self.originCorner == 'bottom-left':
            offsetY = abs(y - self.MINY)
        elif self.originCorner == 'top-left':
            offsetY = abs(self.MAXY - y)
        col = offsetX / tileS
        row = offsetY / tileS
        # We are exactly on the edge of a tile and the extent
        if x in (self.MINX, self.MAXX) and col.is_integer():
            col = max(0, col - 1)
        if y in (self.MINY, self.MAXY) and row.is_integer():
            row = max(0, row - 1)
        return [
            int(math.floor(col)),
            int(math.floor(row))
        ]
170028
public Double getValue(GriddedTile griddedTile, short pixelValue) {
		int unsignedPixelValue = getUnsignedPixelValue(pixelValue);
		Double value = getValue(griddedTile, unsignedPixelValue);
		return value;
	}
989196
def pixel_to_geo(pixel, level):
        """"""
        pixel_x = pixel[0]
        pixel_y = pixel[1]
        map_size = float(TileSystem.map_size(level))
        x = (TileSystem.clip(pixel_x, (0, map_size - 1)) / map_size) - 0.5
        y = 0.5 - (TileSystem.clip(pixel_y, (0, map_size - 1)) / map_size)
        lat = 90 - 360 * atan(exp(-y * 2 * pi)) / pi
        lon = 360 * x
        return round(lat, 6), round(lon, 6)
388161
def get_pixel(framebuf, x, y):
        """"""
        index = (y >> 3) * framebuf.stride + x
        offset = y & 0x07
        return (framebuf.buf[index] >> offset) & 0x01
910250
function tileToPixelCoords(q, r, v) {
         var x, y;
         var ret = v || new me.Vector2d();

         if (this.staggeraxis === "x") {
           //flat top
           x = q * this.columnwidth;

           if (this.staggerindex === "odd") {
             y = r * (this.tileheight + this.sidelengthy);
             y = y + this.rowheight * (q & 1);
           } else {
             y = r * (this.tileheight + this.sidelengthy);
             y = y + this.rowheight * (1 - (q & 1));
           }
         } else {
           //pointy top
           y = r * this.rowheight;

           if (this.staggerindex === "odd") {
             x = q * (this.tilewidth + this.sidelengthx);
             x = x + this.columnwidth * (r & 1);
           } else {
             x = q * (this.tilewidth + this.sidelengthx);
             x = x + this.columnwidth * (1 - (r & 1));
           }
         }

         return ret.set(x, y);
       }
880800
public short getPixelValue(GriddedTile griddedTile, Double value) {
		int unsignedPixelValue = getUnsignedPixelValue(griddedTile, value);
		short pixelValue = getPixelValue(unsignedPixelValue);
		return pixelValue;
	}
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};
}
145877
def _get_tiles(self):
        """"""
        while self._running:
            self._updated.wait()
            self._updated.clear()

            # Save off current view and find the nearest tile.
            satellite = self._satellite
            zoom = self._zoom
            size = self._size
            n = 2 ** zoom
            x_offset = self._convert_longitude(self._longitude)
            y_offset = self._convert_latitude(self._latitude)

            # Get the visible tiles around that location - getting most relevant first
            for x, y, z in [(0, 0, 0), (1, 0, 0), (0, 1, 0), (-1, 0, 0), (0, -1, 0),
                            (0, 0, -1), (0, 0, 1),
                            (1, 1, 0), (1, -1, 0), (-1, -1, 0), (-1, 1, 0)]:
                # Restart if we've already zoomed to another level
                if self._zoom != zoom:
                    break

                # Don't get tile if it falls off the grid
                x_tile = int(x_offset // size) + x
                y_tile = int(y_offset // size) + y
                z_tile = zoom + z
                if (x_tile < 0 or x_tile >= n or y_tile < 0 or y_tile >= n or
                        z_tile < 0 or z_tile > 20):
                    continue
                # noinspection PyBroadException
                try:

                    # Don't bother rendering if the tile is not visible
                    top = y_tile * size - y_offset + self._screen.height // 2
                    left = (x_tile * size - x_offset + self._screen.width // 4) * 2
                    if z == 0 and (left > self._screen.width or left + self._size * 2 < 0 or
                                   top > self._screen.height or top + self._size < 0):
                        continue

                    if satellite:
                        self._get_satellite_tile(x_tile, y_tile, z_tile)
                    else:
                        self._get_vector_tile(x_tile, y_tile, z_tile)
                # pylint: disable=broad-except
                except Exception:
                    self._oops = "{} - tile loc: {} {} {}".format(
                        traceback.format_exc(), x_tile, y_tile, z_tile)

                # Generally refresh screen after we've downloaded everything
                self._screen.force_update()
229577
def positions_with_tile(self):
        
        for p, tile in numpy.ndenumerate(self._array):
            yield p, tile