Hello all,

I've being using geodjango since it was in a branch in a number of
projects, and in one project specifically I was getting and
OGRGeometry Exception intermitently.

After debuging the code I noticed that de wkt string generated from
geometries were taking the current locale into account, thus raising
the Exceptions due to a bad WKT string representation. Here goes an
example:

>>> import locale
>>> from django.contrib.gis.geos import Point
>>> p = Point(-45.23, -23.15)
>>> p.wkt
'POINT (-45.2299999999999969 -23.1499999999999986)'
>>> locale.getlocale()
(None, None)
>>> locale.setlocale(locale.LC_ALL, ('pt_BR','UTF-8'))
'pt_BR.UTF8'
>>> p.wkt
'POINT (-45,2299999999999969 -23,1499999999999986)'

Notice de comma "," for decimal separator in the last output.

It must be something in the GEOS C library and in this case should be
fixed there, but maybe it should be avoided reseting de locale before
calling the C routine and restoring the locale to what it was just
after.

I think the reason this problem was not always happening is related to
the some setlocale thread safety issue.

Any thoughts / tips on this?


Regards,

Luiz Fernando Barbosa Vital
ZNC Sistemas

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to