1 |
# Copyright (C) 2003, 2005 by Intevation GmbH |
# Copyright (C) 2003, 2005, 2006 by Intevation GmbH |
2 |
# Authors: |
# Authors: |
3 |
# Bernhard Herzog <[email protected]> |
# Bernhard Herzog <[email protected]> |
4 |
|
# Bernhard Reiter <[email protected]> |
5 |
# |
# |
6 |
# This program is free software under the GPL (>=v2) |
# This program is free software under the GPL (>=v2) |
7 |
# Read the file COPYING coming with the software for details. |
# Read the file COPYING coming with the software for details. |
15 |
import os |
import os |
16 |
import binascii |
import binascii |
17 |
import unittest |
import unittest |
18 |
|
import locale |
19 |
|
|
20 |
|
import localessupport |
21 |
from mockgeo import SimpleShapeStore |
from mockgeo import SimpleShapeStore |
22 |
import support |
import support |
23 |
support.initthuban() |
support.initthuban() |
345 |
(-24, 65, -23, 66), [0, 0], (20, 20), opts) |
(-24, 65, -23, 66), [0, 0], (20, 20), opts) |
346 |
self.assertEquals(img_data, data) |
self.assertEquals(img_data, data) |
347 |
|
|
348 |
|
def test_projected_raster_decimalcommalocale(self): |
349 |
|
if not Thuban.Model.resource.has_gdal_support(): |
350 |
|
raise support.SkipTest("No gdal support") |
351 |
|
|
352 |
|
def _do_project_island(): |
353 |
|
"""Project island.tif and return result.""" |
354 |
|
layer = RasterLayer("raster layer", |
355 |
|
os.path.join("..", "Data", "iceland", |
356 |
|
"island.tif")) |
357 |
|
|
358 |
|
dc = MockDC(size = (10, 5)) |
359 |
|
renderer = SimpleRenderer(dc, map, 34, (800, 2250)) |
360 |
|
|
361 |
|
projection = "+proj=latlong +to_meter=0.017453 +ellps=clrk66" |
362 |
|
new_projection = "+proj=utm +zone=27 +ellps=clrk66" |
363 |
|
|
364 |
|
return renderer.projected_raster_layer(layer, \ |
365 |
|
projection, new_projection, \ |
366 |
|
(322003.1320390497, 6964094.1718668584, 876022.1891829354, 7460469.6276894147), [0, 0], (10,5), 1) |
367 |
|
|
368 |
|
oldlocale = localessupport.setdecimalcommalocale() |
369 |
|
img_data2 = _do_project_island() |
370 |
|
locale.setlocale(locale.LC_NUMERIC, oldlocale) |
371 |
|
|
372 |
|
img_data1 = _do_project_island() |
373 |
|
|
374 |
|
self.assertEquals(img_data1, img_data2) |
375 |
|
|
376 |
def test_raster_no_projection(self): |
def test_raster_no_projection(self): |
377 |
"""Test BaseRenderer with raster layer and no projections |
"""Test BaseRenderer with raster layer and no projections |
378 |
|
|