equal
deleted
inserted
replaced
213 def img_png_tile (image, x, y, zoom, cache) : |
213 def img_png_tile (image, x, y, zoom, cache) : |
214 """ |
214 """ |
215 Render given tile, returning PNG data |
215 Render given tile, returning PNG data |
216 """ |
216 """ |
217 |
217 |
218 # remap coordinates by zoom |
|
219 x = scale_by_zoom(x, zoom) |
|
220 y = scale_by_zoom(y, zoom) |
|
221 |
|
222 # do we want to cache this? |
218 # do we want to cache this? |
223 if check_cache_threshold(TILE_WIDTH, TILE_HEIGHT, zoom) : |
219 if check_cache_threshold(TILE_WIDTH, TILE_HEIGHT, zoom) : |
224 # go via the cache |
220 # go via the cache |
225 return render_cache(cache, image, TILE_WIDTH, TILE_HEIGHT, x, y, zoom) |
221 return render_cache(cache, image, TILE_WIDTH, TILE_HEIGHT, x, y, zoom) |
226 |
222 |
231 def img_png_region (image, cx, cy, zoom, width, height, cache) : |
227 def img_png_region (image, cx, cy, zoom, width, height, cache) : |
232 """ |
228 """ |
233 Render arbitrary tile, returning PNG data |
229 Render arbitrary tile, returning PNG data |
234 """ |
230 """ |
235 |
231 |
236 x = scale_by_zoom(cx - width / 2, zoom) |
232 x = cx - width / 2 |
237 y = scale_by_zoom(cy - height / 2, zoom) |
233 y = cy - height / 2 |
238 |
234 |
239 # safely limit |
235 # safely limit |
240 if width * height > MAX_PIXELS : |
236 if width * height > MAX_PIXELS : |
241 raise ValueError("Image size: %d * %d > %d" % (width, height, MAX_PIXELS)) |
237 raise ValueError("Image size: %d * %d > %d" % (width, height, MAX_PIXELS)) |
242 |
238 |