def bottomright_of_composite_pixel( x, y, to_projection=coordinates.rd_projection): topleft_x, topleft_y = topleft_of_composite_pixel(x, y) dx, dy = settings.COMPOSITE_CELLSIZE bottomright_x, bottomright_y = topleft_x + dx, topleft_y - dy if to_projection is coordinates.rd_projection: return bottomright_x, bottomright_y return coordinates.transform( coordinates.rd_projection, to_projection, bottomright_x, bottomright_y)
def bottomright_of_composite_pixel(x, y, to_projection=coordinates.rd_projection): topleft_x, topleft_y = topleft_of_composite_pixel(x, y) dx, dy = settings.COMPOSITE_CELLSIZE bottomright_x, bottomright_y = topleft_x + dx, topleft_y - dy if to_projection is coordinates.rd_projection: return bottomright_x, bottomright_y return coordinates.transform(coordinates.rd_projection, to_projection, bottomright_x, bottomright_y)
def topleft_of_composite_pixel(x, y, to_projection=coordinates.rd_projection): """To_projection is e.g. coordinates.google_projection.""" left, right, top, bottom = settings.COMPOSITE_EXTENT dx, dy = settings.COMPOSITE_CELLSIZE dy = -dy # Because top > bottom topleft_x = left + x * dx topleft_y = top + y * dy if topleft_x > right - 1: raise ValueError("x not in bounds") if topleft_y - 1 < bottom: raise ValueError("y not in bounds") if to_projection is coordinates.rd_projection: return topleft_x, topleft_y return coordinates.transform( coordinates.rd_projection, to_projection, topleft_x, topleft_y)
def topleft_of_composite_pixel(x, y, to_projection=coordinates.rd_projection): """To_projection is e.g. coordinates.google_projection.""" left, right, top, bottom = settings.COMPOSITE_EXTENT dx, dy = settings.COMPOSITE_CELLSIZE cells_x, cells_y = settings.COMPOSITE_CELLS if x < 0 or x >= cells_x: raise ValueError("x not in bounds") if y < 0 or y >= cells_y: raise ValueError("y not in bounds") dy = -dy # Because top > bottom in RD topleft_x = left + x * dx topleft_y = top + y * dy if to_projection is coordinates.rd_projection: return topleft_x, topleft_y return coordinates.transform(coordinates.rd_projection, to_projection, topleft_x, topleft_y)