35 |
proj = BaseProjection(params) |
proj = BaseProjection(params) |
36 |
result2 = proj.Forward(1,1) |
result2 = proj.Forward(1,1) |
37 |
|
|
38 |
locale.setlocale(locale.LC_NUMERIC, savedlocale) |
try: |
39 |
|
locale.setlocale(locale.LC_NUMERIC, savedlocale) |
40 |
|
except: |
41 |
|
# python under some circumstances (observed 2.3.5-2 Debian Sarge) |
42 |
|
# does not accept savedlocale directly |
43 |
|
# deviating from the documentation |
44 |
|
locale.setlocale(locale.LC_NUMERIC, savedlocale[0]) |
45 |
if result1 != result2: |
if result1 != result2: |
46 |
return True |
return True |
47 |
return False |
return False |
49 |
class Projection(BaseProjection): |
class Projection(BaseProjection): |
50 |
"""A proj4 projection object that remembers the parameters. |
"""A proj4 projection object that remembers the parameters. |
51 |
|
|
52 |
Note: it seems that calling |
The proj library is not robust against decimal_point != '.' locales. |
53 |
|
Since python 2.4 calls C extensions with the set locale, it can create |
54 |
|
a problem. It seems that calling |
55 |
self.assuregoodlocale() |
self.assuregoodlocale() |
56 |
self.assureinitlocale() |
self.assureinitlocale() |
57 |
before BaseProjection.__init__() is enough to work around the bug. |
before BaseProjection.__init__() is enough to work around this. |
58 |
|
|
59 |
We assuming that the locale stays the same after a projection |
We assuming that the locale stays the same after a projection |
60 |
has been initialised |
has been initialised |